diff options
Diffstat (limited to 'src/osx/graphics/quartz/Image.cpp')
-rw-r--r-- | src/osx/graphics/quartz/Image.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/osx/graphics/quartz/Image.cpp b/src/osx/graphics/quartz/Image.cpp index 901b3ff4..e2664322 100644 --- a/src/osx/graphics/quartz/Image.cpp +++ b/src/osx/graphics/quartz/Image.cpp @@ -1,10 +1,12 @@ #include "cru/osx/graphics/quartz/Image.hpp" +#include "cru/osx/graphics/quartz/Convert.hpp" namespace cru::platform::graphics::osx::quartz { QuartzImage::QuartzImage(IGraphicsFactory* graphics_factory, IImageFactory* image_factory, CGImageRef image, bool auto_release) : OsxQuartzResource(graphics_factory), + image_factory_(image_factory), image_(image), auto_release_(auto_release) {} @@ -13,4 +15,15 @@ QuartzImage::~QuartzImage() { CGImageRelease(image_); } } + +float QuartzImage::GetWidth() { return CGImageGetWidth(image_); } + +float QuartzImage::GetHeight() { return CGImageGetHeight(image_); } + +std::unique_ptr<IImage> QuartzImage::CreateWithRect(const Rect& rect) { + auto new_cg_image = CGImageCreateWithImageInRect(image_, Convert(rect)); + + return std::make_unique<QuartzImage>(GetGraphicsFactory(), image_factory_, + new_cg_image, true); +} } // namespace cru::platform::graphics::osx::quartz |