ImageCodecPlugin.h 827 B

12345678910111213141516171819202122232425262728
  1. /*
  2. * Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
  3. * Copyright (c) 2022, Andreas Kling <andreas@ladybird.org>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <LibImageDecoderClient/Client.h>
  9. #include <LibWeb/Platform/ImageCodecPlugin.h>
  10. namespace Ladybird {
  11. class ImageCodecPlugin final : public Web::Platform::ImageCodecPlugin {
  12. public:
  13. explicit ImageCodecPlugin(NonnullRefPtr<ImageDecoderClient::Client>);
  14. virtual ~ImageCodecPlugin() override;
  15. virtual NonnullRefPtr<Core::Promise<Web::Platform::DecodedImage>> decode_image(ReadonlyBytes, Function<ErrorOr<void>(Web::Platform::DecodedImage&)> on_resolved, Function<void(Error&)> on_rejected) override;
  16. void set_client(NonnullRefPtr<ImageDecoderClient::Client>);
  17. private:
  18. RefPtr<ImageDecoderClient::Client> m_client;
  19. };
  20. }