PNGLoader.h 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #pragma once
  7. #include <AK/String.h>
  8. #include <LibGfx/Bitmap.h>
  9. #include <LibGfx/ImageDecoder.h>
  10. namespace Gfx {
  11. RefPtr<Gfx::Bitmap> load_png(String const& path);
  12. RefPtr<Gfx::Bitmap> load_png_from_memory(u8 const*, size_t, String const& mmap_name = "<memory>");
  13. struct PNGLoadingContext;
  14. class PNGImageDecoderPlugin final : public ImageDecoderPlugin {
  15. public:
  16. virtual ~PNGImageDecoderPlugin() override;
  17. PNGImageDecoderPlugin(const u8*, size_t);
  18. virtual IntSize size() override;
  19. virtual RefPtr<Gfx::Bitmap> bitmap() override;
  20. virtual void set_volatile() override;
  21. [[nodiscard]] virtual bool set_nonvolatile(bool& was_purged) override;
  22. virtual bool sniff() override;
  23. virtual bool is_animated() override;
  24. virtual size_t loop_count() override;
  25. virtual size_t frame_count() override;
  26. virtual ImageFrameDescriptor frame(size_t i) override;
  27. private:
  28. OwnPtr<PNGLoadingContext> m_context;
  29. };
  30. }