DDraceNetwork Docs
image_loader.h
Go to the documentation of this file.
1#ifndef ENGINE_GFX_IMAGE_LOADER_H
2#define ENGINE_GFX_IMAGE_LOADER_H
3
4#include <base/types.h>
5
6#include <engine/image.h>
7
8#include <vector>
9
11{
12 const uint8_t *m_pData;
13 size_t m_Size;
14 size_t m_ReadOffset = 0;
15 bool m_Error = false;
16
17public:
18 CByteBufferReader(const uint8_t *pData, size_t Size) :
19 m_pData(pData),
20 m_Size(Size) {}
21
22 bool Read(void *pData, size_t Size);
23 bool Error() const { return m_Error; }
24};
25
27{
28 std::vector<uint8_t> m_vBuffer;
29
30public:
31 void Write(const void *pData, size_t Size);
32 const uint8_t *Data() const { return m_vBuffer.data(); }
33 size_t Size() const { return m_vBuffer.size(); }
34};
35
37{
38 CImageLoader() = delete;
39
40public:
41 enum
42 {
48 };
49
50 static bool LoadPng(CByteBufferReader &Reader, const char *pContextName, CImageInfo &Image, int &PngliteIncompatible);
51 static bool LoadPng(IOHANDLE File, const char *pFilename, CImageInfo &Image, int &PngliteIncompatible);
52
53 static bool SavePng(CByteBufferWriter &Writer, const CImageInfo &Image);
54 static bool SavePng(IOHANDLE File, const char *pFilename, const CImageInfo &Image);
55};
56
57#endif // ENGINE_GFX_IMAGE_LOADER_H
Definition: image_loader.h:11
size_t m_Size
Definition: image_loader.h:13
const uint8_t * m_pData
Definition: image_loader.h:12
bool m_Error
Definition: image_loader.h:15
CByteBufferReader(const uint8_t *pData, size_t Size)
Definition: image_loader.h:18
bool Error() const
Definition: image_loader.h:23
bool Read(void *pData, size_t Size)
Definition: image_loader.cpp:11
size_t m_ReadOffset
Definition: image_loader.h:14
Definition: image_loader.h:27
const uint8_t * Data() const
Definition: image_loader.h:32
std::vector< uint8_t > m_vBuffer
Definition: image_loader.h:28
size_t Size() const
Definition: image_loader.h:33
void Write(const void *pData, size_t Size)
Definition: image_loader.cpp:29
Definition: image.h:12
Definition: image_loader.h:37
@ PNGLITE_COMPRESSION_TYPE
Definition: image_loader.h:46
@ PNGLITE_BIT_DEPTH
Definition: image_loader.h:44
@ PNGLITE_COLOR_TYPE
Definition: image_loader.h:43
@ PNGLITE_FILTER_TYPE
Definition: image_loader.h:47
@ PNGLITE_INTERLACE_TYPE
Definition: image_loader.h:45
static bool LoadPng(CByteBufferReader &Reader, const char *pContextName, CImageInfo &Image, int &PngliteIncompatible)
Definition: image_loader.cpp:137
static bool SavePng(CByteBufferWriter &Writer, const CImageInfo &Image)
Definition: image_loader.cpp:338
CImageLoader()=delete
void * IOHANDLE
Definition: logger.h:11