From 74bb9cd27242b9320f99ff4d2b50c3051576cc14 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 8 Feb 2022 16:53:51 +0800 Subject: ... --- include/cru/osx/graphics/quartz/Image.h | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 include/cru/osx/graphics/quartz/Image.h (limited to 'include/cru/osx/graphics/quartz/Image.h') diff --git a/include/cru/osx/graphics/quartz/Image.h b/include/cru/osx/graphics/quartz/Image.h new file mode 100644 index 00000000..458f5db0 --- /dev/null +++ b/include/cru/osx/graphics/quartz/Image.h @@ -0,0 +1,32 @@ +#pragma once +#include "Resource.h" +#include "cru/platform/graphics/Image.h" +#include "cru/platform/graphics/ImageFactory.h" + +#include + +namespace cru::platform::graphics::osx::quartz { +class QuartzImage : public OsxQuartzResource, public virtual IImage { + public: + QuartzImage(IGraphicsFactory* graphics_factory, IImageFactory* image_factory, + CGImageRef image, bool auto_release); + + CRU_DELETE_COPY(QuartzImage) + CRU_DELETE_MOVE(QuartzImage) + + ~QuartzImage() override; + + public: + float GetWidth() override; + float GetHeight() override; + + std::unique_ptr CreateWithRect(const Rect& rect) override; + + CGImageRef GetCGImage() const { return image_; } + + private: + IImageFactory* image_factory_; + CGImageRef image_; + bool auto_release_ = false; +}; +} // namespace cru::platform::graphics::osx::quartz -- cgit v1.2.3