aboutsummaryrefslogtreecommitdiff
path: root/include/cru/platform/graphics/ImageFactory.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/cru/platform/graphics/ImageFactory.h')
-rw-r--r--include/cru/platform/graphics/ImageFactory.h15
1 files changed, 13 insertions, 2 deletions
diff --git a/include/cru/platform/graphics/ImageFactory.h b/include/cru/platform/graphics/ImageFactory.h
index d2c2a468..2339a069 100644
--- a/include/cru/platform/graphics/ImageFactory.h
+++ b/include/cru/platform/graphics/ImageFactory.h
@@ -1,18 +1,29 @@
#pragma once
-#include "Image.h"
#include "Resource.h"
#include "cru/common/io/Stream.h"
namespace cru::platform::graphics {
+enum class ImageFormat { Jpeg, Png };
+
struct CRU_PLATFORM_GRAPHICS_API IImageFactory
: public virtual IGraphicsResource {
virtual std::unique_ptr<IImage> DecodeFromStream(io::Stream* stream) = 0;
/**
+ * \brief Encode an image to a stream.
+ * \param image The image to encode.
+ * \param stream The stream to write to.
+ * \param format The format to encode to.
+ * \param quality The quality to encode to.
+ * \todo Implement on macOS and Windows.
+ */
+ virtual void EncodeToStream(IImage* image, io::Stream* stream,
+ ImageFormat format, float quality) = 0;
+
+ /**
* \brief Create an empty bitmap with given width and height.
* \remarks Implementation should ensure that the bitmap supports alpha
* channel. It had better be in 32-bit rgba format.
- * \todo Implement on Windows.
*/
virtual std::unique_ptr<IImage> CreateBitmap(int width, int height) = 0;
};