ImageCodecPlugin.h 695 B

12345678910111213141516171819202122232425262728293031323334353637
  1. /*
  2. * Copyright (c) 2020-2022, Andreas Kling <kling@serenityos.org>
  3. * Copyright (c) 2022, Dex♪ <dexes.ttp@gmail.com>
  4. *
  5. * SPDX-License-Identifier: BSD-2-Clause
  6. */
  7. #pragma once
  8. #include <AK/RefPtr.h>
  9. #include <AK/Vector.h>
  10. #include <LibGfx/Forward.h>
  11. namespace Web::Platform {
  12. struct Frame {
  13. RefPtr<Gfx::Bitmap> bitmap;
  14. size_t duration { 0 };
  15. };
  16. struct DecodedImage {
  17. bool is_animated { false };
  18. u32 loop_count { 0 };
  19. Vector<Frame> frames;
  20. };
  21. class ImageCodecPlugin {
  22. public:
  23. static ImageCodecPlugin& the();
  24. static void install(ImageCodecPlugin&);
  25. virtual ~ImageCodecPlugin();
  26. virtual Optional<DecodedImage> decode_image(ReadonlyBytes) = 0;
  27. };
  28. }