diff options
author | crupest <crupest@outlook.com> | 2022-05-07 20:53:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-07 20:53:57 +0800 |
commit | ee5aa17e44cb36b386e89032cab96caf87b5b524 (patch) | |
tree | a7cef6c60f55e3870900016e0f1a4efe578efbf0 /include/cru/platform/graphics/Image.h | |
parent | 5bc684dcc1d121bf6e02d0800174c7977c72d101 (diff) | |
parent | cb850a6d6d13fc5b2c0cdd8773e368e23252c459 (diff) | |
download | cru-ee5aa17e44cb36b386e89032cab96caf87b5b524.tar.gz cru-ee5aa17e44cb36b386e89032cab96caf87b5b524.tar.bz2 cru-ee5aa17e44cb36b386e89032cab96caf87b5b524.zip |
Merge pull request #54 from crupest/create-image
Diffstat (limited to 'include/cru/platform/graphics/Image.h')
-rw-r--r-- | include/cru/platform/graphics/Image.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/include/cru/platform/graphics/Image.h b/include/cru/platform/graphics/Image.h index 51e27678..de3b32d5 100644 --- a/include/cru/platform/graphics/Image.h +++ b/include/cru/platform/graphics/Image.h @@ -6,5 +6,21 @@ struct CRU_PLATFORM_GRAPHICS_API IImage : public virtual IGraphicsResource { virtual float GetWidth() = 0; virtual float GetHeight() = 0; virtual std::unique_ptr<IImage> CreateWithRect(const Rect& rect) = 0; + + /** + * \brief Create a painter for this image. + * \remarks Not all image could create a painter. If not this method will + * throw. Currently we only ensure images returned by + * IImageFactory::CreateBitmap or CloneToBitmap can create a painter. + * \todo Implement on Windows. + */ + virtual std::unique_ptr<IPainter> CreatePainter() = 0; + + /** + * \brief Create a bitmap image with the same pixels as this image's. + * \remarks This method can be used to create a bitmap image, so you can draw + * on the new bitmap, if the original image can't be directly painted. + */ + virtual std::unique_ptr<IImage> CloneToBitmap(); }; } // namespace cru::platform::graphics |