#pragma once #include #include #include #include class GraphicsBitmap; class ImageDecoderPlugin { public: virtual ~ImageDecoderPlugin() {} virtual Size size() = 0; virtual RefPtr bitmap() = 0; protected: ImageDecoderPlugin() {} }; class ImageDecoder : public RefCounted { public: static NonnullRefPtr create(const u8* data, size_t size) { return adopt(*new ImageDecoder(data, size)); } ~ImageDecoder(); Size size() const { return m_plugin->size(); } int width() const { return size().width(); } int height() const { return size().height(); } RefPtr bitmap() const { return m_plugin->bitmap(); } private: ImageDecoder(const u8*, size_t); mutable OwnPtr m_plugin; };