1#ifndef ENGINE_GFX_IMAGE_LOADER_H
2#define ENGINE_GFX_IMAGE_LOADER_H
3
4#include <cstddef>
5#include <cstdint>
6#include <vector>
7
8enum EImageFormat
9{
10 IMAGE_FORMAT_R = 0,
11 IMAGE_FORMAT_RA,
12 IMAGE_FORMAT_RGB,
13 IMAGE_FORMAT_RGBA,
14};
15
16typedef std::vector<uint8_t> TImageByteBuffer;
17struct SImageByteBuffer
18{
19 SImageByteBuffer(std::vector<uint8_t> *pvBuff) :
20 m_LoadOffset(0), m_pvLoadedImageBytes(pvBuff), m_Err(0) {}
21 size_t m_LoadOffset;
22 std::vector<uint8_t> *m_pvLoadedImageBytes;
23 int m_Err;
24};
25
26enum
27{
28 PNGLITE_COLOR_TYPE = 1 << 0,
29 PNGLITE_BIT_DEPTH = 1 << 1,
30 PNGLITE_INTERLACE_TYPE = 1 << 2,
31 PNGLITE_COMPRESSION_TYPE = 1 << 3,
32 PNGLITE_FILTER_TYPE = 1 << 4,
33};
34
35bool LoadPng(SImageByteBuffer &ByteLoader, const char *pFileName, int &PngliteIncompatible, size_t &Width, size_t &Height, uint8_t *&pImageBuff, EImageFormat &ImageFormat);
36bool SavePng(EImageFormat ImageFormat, const uint8_t *pRawBuffer, SImageByteBuffer &WrittenBytes, size_t Width, size_t Height);
37
38#endif // ENGINE_GFX_IMAGE_LOADER_H
39