blob: e7e2814301c754effad05b7db31afcd939873f0e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
#pragma once
#include "Resource.h"
#include "cru/base/io/Stream.h"
namespace cru::platform::graphics {
enum class ImageFormat { Jpeg, Png, Gif };
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 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.
*/
virtual std::unique_ptr<IImage> CreateBitmap(int width, int height) = 0;
};
} // namespace cru::platform::graphics
|