49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
|
#ifndef PNGCHUNK_HPP
|
||
|
#define PNGCHUNK_HPP
|
||
|
|
||
|
#include "include/array/GrowableObjectArray.hpp"
|
||
|
|
||
|
class PNGChunk{
|
||
|
|
||
|
protected:
|
||
|
|
||
|
unsigned int chunkLength;
|
||
|
unsigned int chunkTypeInt;
|
||
|
unsigned char* chunkData;
|
||
|
unsigned int crc32;
|
||
|
|
||
|
PNGChunk(unsigned int chunkLength ,unsigned int type, const unsigned char* chunkData, unsigned int crc32);
|
||
|
|
||
|
public:
|
||
|
|
||
|
static const char* CHUNKTYPE_IHDR;
|
||
|
static const char* CHUNKTYPE_PHYS;
|
||
|
static const char* CHUNKTYPE_TEXT;
|
||
|
static const char* CHUNKTYPE_ZTXT;
|
||
|
static const char* CHUNKTYPE_TRNS;
|
||
|
static const char* CHUNKTYPE_IDAT;
|
||
|
static const char* CHUNKTYPE_PLTE;
|
||
|
static const char* CHUNKTYPE_ITXT;
|
||
|
static const char* CHUNKTYPE_TIME;
|
||
|
static const char* CHUNKTYPE_IEND;
|
||
|
|
||
|
static unsigned int chunkTypeToInt(const char* type);
|
||
|
|
||
|
static GrowableObjectArray* readChunks(const unsigned char* pngdata, const char* type);
|
||
|
|
||
|
unsigned int getChunkLength();
|
||
|
|
||
|
unsigned int getChunkType();
|
||
|
|
||
|
const unsigned char* getChunkData();
|
||
|
|
||
|
unsigned int getCRC32();
|
||
|
|
||
|
unsigned int isCRC32Matched();
|
||
|
|
||
|
~PNGChunk();
|
||
|
|
||
|
};
|
||
|
|
||
|
#endif // PNGCHUNK_HPP
|