LodePNG is a PNG image decoder.
It is made for C (ISO C90), and has a C++ wrapper with a more convenient interface on top. More info at: http://members.gamedev.net/lode/projects/LodePNG/
Data Structures | |
struct | LodePNG_Decoder |
struct | LodePNG_DecodeSettings |
struct | LodePNG_InfoColor |
struct | LodePNG_InfoPng |
struct | LodePNG_InfoRaw |
struct | LodePNG_IText |
struct | LodePNG_Text |
struct | LodePNG_Time |
struct | LodePNG_UnknownChunks |
struct | LodeZlib_DecompressSettings |
Macros | |
#define | LODEPNG_COMPILE_ANCILLARY_CHUNKS /*any code or struct datamember related to chunks other than IHDR, IDAT, PLTE, tRNS, IEND*/ |
#define | LODEPNG_COMPILE_DECODER /*deflate&zlib decoder and png decoder*/ |
#define | LODEPNG_COMPILE_PNG /*png encoder and png decoder*/ |
#define | LODEPNG_COMPILE_UNKNOWN_CHUNKS /*handling of unknown chunks*/ |
#define | LODEPNG_COMPILE_ZLIB /*deflate&zlib encoder and deflate&zlib decoder*/ |
Typedefs | |
typedef struct LodePNG_Decoder | LodePNG_Decoder |
typedef struct LodePNG_DecodeSettings | LodePNG_DecodeSettings |
typedef struct LodePNG_InfoColor | LodePNG_InfoColor |
typedef struct LodePNG_InfoPng | LodePNG_InfoPng |
typedef struct LodePNG_InfoRaw | LodePNG_InfoRaw |
typedef struct LodePNG_IText | LodePNG_IText |
typedef struct LodePNG_Text | LodePNG_Text |
typedef struct LodePNG_Time | LodePNG_Time |
typedef struct LodePNG_UnknownChunks | LodePNG_UnknownChunks |
typedef struct LodeZlib_DecompressSettings | LodeZlib_DecompressSettings |
Functions | |
unsigned | LodePNG_append_chunk (unsigned char **out, size_t *outlength, const unsigned char *chunk) |
unsigned | LodePNG_chunk_check_crc (const unsigned char *chunk) |
unsigned char | LodePNG_chunk_critical (const unsigned char *chunk) |
unsigned char * | LodePNG_chunk_data (unsigned char *chunk) |
const unsigned char * | LodePNG_chunk_data_const (const unsigned char *chunk) |
void | LodePNG_chunk_generate_crc (unsigned char *chunk) |
unsigned | LodePNG_chunk_length (const unsigned char *chunk) |
unsigned char * | LodePNG_chunk_next (unsigned char *chunk) |
const unsigned char * | LodePNG_chunk_next_const (const unsigned char *chunk) |
unsigned char | LodePNG_chunk_private (const unsigned char *chunk) |
unsigned char | LodePNG_chunk_safetocopy (const unsigned char *chunk) |
void | LodePNG_chunk_type (char type[5], const unsigned char *chunk) |
unsigned char | LodePNG_chunk_type_equals (const unsigned char *chunk, const char *type) |
unsigned | LodePNG_convert (unsigned char *out, const unsigned char *in, LodePNG_InfoColor *infoOut, LodePNG_InfoColor *infoIn, unsigned w, unsigned h) |
unsigned | LodePNG_create_chunk (unsigned char **out, size_t *outlength, unsigned length, const char *type, const unsigned char *data) |
void | LodePNG_decode (LodePNG_Decoder *decoder, unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize) |
unsigned | LodePNG_decode32 (unsigned char **out, unsigned *w, unsigned *h, const unsigned char *in, size_t insize) |
void | LodePNG_Decoder_cleanup (LodePNG_Decoder *decoder) |
void | LodePNG_Decoder_copy (LodePNG_Decoder *dest, const LodePNG_Decoder *source) |
void | LodePNG_Decoder_init (LodePNG_Decoder *decoder) |
void | LodePNG_DecodeSettings_init (LodePNG_DecodeSettings *settings) |
unsigned | LodePNG_InfoColor_addPalette (LodePNG_InfoColor *info, unsigned char r, unsigned char g, unsigned char b, unsigned char a) |
void | LodePNG_InfoColor_cleanup (LodePNG_InfoColor *info) |
void | LodePNG_InfoColor_clearPalette (LodePNG_InfoColor *info) |
unsigned | LodePNG_InfoColor_copy (LodePNG_InfoColor *dest, const LodePNG_InfoColor *source) |
unsigned | LodePNG_InfoColor_getBpp (const LodePNG_InfoColor *info) |
unsigned | LodePNG_InfoColor_getChannels (const LodePNG_InfoColor *info) |
void | LodePNG_InfoColor_init (LodePNG_InfoColor *info) |
unsigned | LodePNG_InfoColor_isAlphaType (const LodePNG_InfoColor *info) |
unsigned | LodePNG_InfoColor_isGreyscaleType (const LodePNG_InfoColor *info) |
void | LodePNG_InfoPng_cleanup (LodePNG_InfoPng *info) |
unsigned | LodePNG_InfoPng_copy (LodePNG_InfoPng *dest, const LodePNG_InfoPng *source) |
void | LodePNG_InfoPng_init (LodePNG_InfoPng *info) |
void | LodePNG_InfoRaw_cleanup (LodePNG_InfoRaw *info) |
unsigned | LodePNG_InfoRaw_copy (LodePNG_InfoRaw *dest, const LodePNG_InfoRaw *source) |
void | LodePNG_InfoRaw_init (LodePNG_InfoRaw *info) |
void | LodePNG_inspect (LodePNG_Decoder *decoder, const unsigned char *in, size_t size) |
unsigned | LodePNG_IText_add (LodePNG_IText *text, const char *key, const char *langtag, const char *transkey, const char *str) |
void | LodePNG_IText_cleanup (LodePNG_IText *text) |
void | LodePNG_IText_clear (LodePNG_IText *text) |
unsigned | LodePNG_IText_copy (LodePNG_IText *dest, const LodePNG_IText *source) |
void | LodePNG_IText_init (LodePNG_IText *text) |
unsigned | LodePNG_Text_add (LodePNG_Text *text, const char *key, const char *str) |
void | LodePNG_Text_cleanup (LodePNG_Text *text) |
void | LodePNG_Text_clear (LodePNG_Text *text) |
unsigned | LodePNG_Text_copy (LodePNG_Text *dest, const LodePNG_Text *source) |
void | LodePNG_Text_init (LodePNG_Text *text) |
void | LodePNG_UnknownChunks_cleanup (LodePNG_UnknownChunks *chunks) |
unsigned | LodePNG_UnknownChunks_copy (LodePNG_UnknownChunks *dest, const LodePNG_UnknownChunks *src) |
void | LodePNG_UnknownChunks_init (LodePNG_UnknownChunks *chunks) |
unsigned | LodeZlib_decompress (unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodeZlib_DecompressSettings *settings) |
void | LodeZlib_DecompressSettings_init (LodeZlib_DecompressSettings *settings) |
Variables | |
const LodeZlib_DecompressSettings | LodeZlib_defaultDecompressSettings |
#define LODEPNG_COMPILE_ANCILLARY_CHUNKS /*any code or struct datamember related to chunks other than IHDR, IDAT, PLTE, tRNS, IEND*/ |
#define LODEPNG_COMPILE_DECODER /*deflate&zlib decoder and png decoder*/ |
#define LODEPNG_COMPILE_PNG /*png encoder and png decoder*/ |
#define LODEPNG_COMPILE_UNKNOWN_CHUNKS /*handling of unknown chunks*/ |
#define LODEPNG_COMPILE_ZLIB /*deflate&zlib encoder and deflate&zlib decoder*/ |
typedef struct LodePNG_Decoder LodePNG_Decoder |
typedef struct LodePNG_DecodeSettings LodePNG_DecodeSettings |
typedef struct LodePNG_InfoColor LodePNG_InfoColor |
typedef struct LodePNG_InfoPng LodePNG_InfoPng |
typedef struct LodePNG_InfoRaw LodePNG_InfoRaw |
typedef struct LodePNG_IText LodePNG_IText |
typedef struct LodePNG_Text LodePNG_Text |
typedef struct LodePNG_Time LodePNG_Time |
typedef struct LodePNG_UnknownChunks LodePNG_UnknownChunks |
typedef struct LodeZlib_DecompressSettings LodeZlib_DecompressSettings |
unsigned LodePNG_append_chunk | ( | unsigned char ** | out, |
size_t * | outlength, | ||
const unsigned char * | chunk | ||
) |
References i, and LodePNG_chunk_length().
Referenced by decodeGeneric().
unsigned LodePNG_chunk_check_crc | ( | const unsigned char * | chunk | ) |
References Crc32_crc(), LodePNG_chunk_length(), and LodePNG_read32bitInt().
Referenced by decodeGeneric().
unsigned char LodePNG_chunk_critical | ( | const unsigned char * | chunk | ) |
Referenced by decodeGeneric().
unsigned char* LodePNG_chunk_data | ( | unsigned char * | chunk | ) |
const unsigned char* LodePNG_chunk_data_const | ( | const unsigned char * | chunk | ) |
Referenced by decodeGeneric().
void LodePNG_chunk_generate_crc | ( | unsigned char * | chunk | ) |
References Crc32_crc(), LodePNG_chunk_length(), and LodePNG_set32bitInt().
Referenced by LodePNG_create_chunk().
unsigned LodePNG_chunk_length | ( | const unsigned char * | chunk | ) |
References LodePNG_read32bitInt().
Referenced by decodeGeneric(), LodePNG_append_chunk(), LodePNG_chunk_check_crc(), LodePNG_chunk_generate_crc(), LodePNG_chunk_next(), and LodePNG_chunk_next_const().
unsigned char* LodePNG_chunk_next | ( | unsigned char * | chunk | ) |
References LodePNG_chunk_length().
const unsigned char* LodePNG_chunk_next_const | ( | const unsigned char * | chunk | ) |
References LodePNG_chunk_length().
Referenced by decodeGeneric().
unsigned char LodePNG_chunk_private | ( | const unsigned char * | chunk | ) |
unsigned char LodePNG_chunk_safetocopy | ( | const unsigned char * | chunk | ) |
void LodePNG_chunk_type | ( | char | type[5], |
const unsigned char * | chunk | ||
) |
References i.
unsigned char LodePNG_chunk_type_equals | ( | const unsigned char * | chunk, |
const char * | type | ||
) |
Referenced by decodeGeneric().
unsigned LodePNG_convert | ( | unsigned char * | out, |
const unsigned char * | in, | ||
LodePNG_InfoColor * | infoOut, | ||
LodePNG_InfoColor * | infoIn, | ||
unsigned | w, | ||
unsigned | h | ||
) |
References LodePNG_InfoColor::bitDepth, c, LodePNG_InfoColor::colorType, i, LodePNG_InfoColor::key_b, LodePNG_InfoColor::key_defined, LodePNG_InfoColor::key_g, LodePNG_InfoColor::key_r, LodePNG_InfoColor_equal(), LodePNG_InfoColor_getBpp(), LodePNG_InfoColor_isAlphaType(), LodePNG_InfoColor_isGreyscaleType(), LodePNG_InfoColor::palette, LodePNG_InfoColor::palettesize, and readBitsFromReversedStream().
Referenced by LodePNG_decode().
unsigned LodePNG_create_chunk | ( | unsigned char ** | out, |
size_t * | outlength, | ||
unsigned | length, | ||
const char * | type, | ||
const unsigned char * | data | ||
) |
References i, length, LodePNG_chunk_generate_crc(), and LodePNG_set32bitInt().
void LodePNG_decode | ( | LodePNG_Decoder * | decoder, |
unsigned char ** | out, | ||
size_t * | outsize, | ||
const unsigned char * | in, | ||
size_t | insize | ||
) |
References LodePNG_InfoColor::bitDepth, LodePNG_InfoPng::color, LodePNG_InfoRaw::color, LodePNG_DecodeSettings::color_convert, LodePNG_InfoColor::colorType, decodeGeneric(), LodePNG_Decoder::error, LodePNG_InfoPng::height, LodePNG_Decoder::infoPng, LodePNG_Decoder::infoRaw, LodePNG_convert(), LodePNG_InfoColor_copy(), LodePNG_InfoColor_equal(), LodePNG_InfoColor_getBpp(), out, LodePNG_Decoder::settings, and LodePNG_InfoPng::width.
Referenced by LodePNG_decode32().
unsigned LodePNG_decode32 | ( | unsigned char ** | out, |
unsigned * | w, | ||
unsigned * | h, | ||
const unsigned char * | in, | ||
size_t | insize | ||
) |
void LodePNG_Decoder_cleanup | ( | LodePNG_Decoder * | decoder | ) |
References LodePNG_Decoder::infoPng, LodePNG_Decoder::infoRaw, LodePNG_InfoPng_cleanup(), and LodePNG_InfoRaw_cleanup().
Referenced by LodePNG_decode32(), and LodePNG_Decoder_copy().
void LodePNG_Decoder_copy | ( | LodePNG_Decoder * | dest, |
const LodePNG_Decoder * | source | ||
) |
void LodePNG_Decoder_init | ( | LodePNG_Decoder * | decoder | ) |
void LodePNG_DecodeSettings_init | ( | LodePNG_DecodeSettings * | settings | ) |
unsigned LodePNG_InfoColor_addPalette | ( | LodePNG_InfoColor * | info, |
unsigned char | r, | ||
unsigned char | g, | ||
unsigned char | b, | ||
unsigned char | a | ||
) |
References a(), b, data, LodePNG_InfoColor::palette, and LodePNG_InfoColor::palettesize.
void LodePNG_InfoColor_cleanup | ( | LodePNG_InfoColor * | info | ) |
References LodePNG_InfoColor_clearPalette().
Referenced by LodePNG_InfoColor_copy(), LodePNG_InfoPng_cleanup(), and LodePNG_InfoRaw_cleanup().
void LodePNG_InfoColor_clearPalette | ( | LodePNG_InfoColor * | info | ) |
References LodePNG_InfoColor::palette, and LodePNG_InfoColor::palettesize.
Referenced by LodePNG_InfoColor_cleanup().
unsigned LodePNG_InfoColor_copy | ( | LodePNG_InfoColor * | dest, |
const LodePNG_InfoColor * | source | ||
) |
References i, LodePNG_InfoColor_cleanup(), LodePNG_InfoColor::palette, and LodePNG_InfoColor::palettesize.
Referenced by LodePNG_decode(), LodePNG_InfoPng_copy(), and LodePNG_InfoRaw_copy().
unsigned LodePNG_InfoColor_getBpp | ( | const LodePNG_InfoColor * | info | ) |
References LodePNG_InfoColor::bitDepth, LodePNG_InfoColor::colorType, and getBpp().
Referenced by decodeGeneric(), LodePNG_convert(), LodePNG_decode(), and postProcessScanlines().
unsigned LodePNG_InfoColor_getChannels | ( | const LodePNG_InfoColor * | info | ) |
References LodePNG_InfoColor::colorType, and getNumColorChannels().
void LodePNG_InfoColor_init | ( | LodePNG_InfoColor * | info | ) |
References LodePNG_InfoColor::bitDepth, LodePNG_InfoColor::colorType, LodePNG_InfoColor::key_b, LodePNG_InfoColor::key_defined, LodePNG_InfoColor::key_g, LodePNG_InfoColor::key_r, LodePNG_InfoColor::palette, and LodePNG_InfoColor::palettesize.
Referenced by LodePNG_InfoPng_copy(), LodePNG_InfoPng_init(), LodePNG_InfoRaw_copy(), and LodePNG_InfoRaw_init().
unsigned LodePNG_InfoColor_isAlphaType | ( | const LodePNG_InfoColor * | info | ) |
References LodePNG_InfoColor::colorType.
Referenced by LodePNG_convert().
unsigned LodePNG_InfoColor_isGreyscaleType | ( | const LodePNG_InfoColor * | info | ) |
References LodePNG_InfoColor::colorType.
Referenced by LodePNG_convert().
void LodePNG_InfoPng_cleanup | ( | LodePNG_InfoPng * | info | ) |
References LodePNG_InfoPng::color, LodePNG_InfoPng::itext, LodePNG_InfoColor_cleanup(), LodePNG_IText_cleanup(), LodePNG_Text_cleanup(), LodePNG_UnknownChunks_cleanup(), LodePNG_InfoPng::text, and LodePNG_InfoPng::unknown_chunks.
Referenced by LodePNG_Decoder_cleanup(), LodePNG_InfoPng_copy(), and LodePNG_inspect().
unsigned LodePNG_InfoPng_copy | ( | LodePNG_InfoPng * | dest, |
const LodePNG_InfoPng * | source | ||
) |
References LodePNG_InfoPng::color, LodePNG_InfoPng::itext, LodePNG_InfoColor_copy(), LodePNG_InfoColor_init(), LodePNG_InfoPng_cleanup(), LodePNG_IText_copy(), LodePNG_Text_copy(), LodePNG_UnknownChunks_copy(), LodePNG_UnknownChunks_init(), LodePNG_InfoPng::text, and LodePNG_InfoPng::unknown_chunks.
Referenced by LodePNG_Decoder_copy().
void LodePNG_InfoPng_init | ( | LodePNG_InfoPng * | info | ) |
References LodePNG_InfoPng::background_b, LodePNG_InfoPng::background_defined, LodePNG_InfoPng::background_g, LodePNG_InfoPng::background_r, LodePNG_InfoPng::color, LodePNG_InfoPng::compressionMethod, LodePNG_InfoPng::filterMethod, LodePNG_InfoPng::height, LodePNG_InfoPng::interlaceMethod, LodePNG_InfoPng::itext, LodePNG_InfoColor_init(), LodePNG_IText_init(), LodePNG_Text_init(), LodePNG_UnknownChunks_init(), LodePNG_InfoPng::phys_defined, LodePNG_InfoPng::text, LodePNG_InfoPng::time_defined, LodePNG_InfoPng::unknown_chunks, and LodePNG_InfoPng::width.
Referenced by LodePNG_Decoder_copy(), LodePNG_Decoder_init(), and LodePNG_inspect().
void LodePNG_InfoRaw_cleanup | ( | LodePNG_InfoRaw * | info | ) |
References LodePNG_InfoRaw::color, and LodePNG_InfoColor_cleanup().
Referenced by LodePNG_Decoder_cleanup(), and LodePNG_InfoRaw_copy().
unsigned LodePNG_InfoRaw_copy | ( | LodePNG_InfoRaw * | dest, |
const LodePNG_InfoRaw * | source | ||
) |
References LodePNG_InfoRaw::color, LodePNG_InfoColor_copy(), LodePNG_InfoColor_init(), and LodePNG_InfoRaw_cleanup().
Referenced by LodePNG_Decoder_copy().
void LodePNG_InfoRaw_init | ( | LodePNG_InfoRaw * | info | ) |
References LodePNG_InfoRaw::color, and LodePNG_InfoColor_init().
Referenced by LodePNG_Decoder_copy(), and LodePNG_Decoder_init().
void LodePNG_inspect | ( | LodePNG_Decoder * | decoder, |
const unsigned char * | in, | ||
size_t | size | ||
) |
References LodePNG_InfoColor::bitDepth, checkColorValidity(), LodePNG_InfoPng::color, LodePNG_InfoColor::colorType, LodePNG_InfoPng::compressionMethod, Crc32_crc(), LodePNG_Decoder::error, LodePNG_InfoPng::filterMethod, LodePNG_InfoPng::height, LodePNG_DecodeSettings::ignoreCrc, LodePNG_Decoder::infoPng, LodePNG_InfoPng::interlaceMethod, LodePNG_InfoPng_cleanup(), LodePNG_InfoPng_init(), LodePNG_read32bitInt(), LodePNG_Decoder::settings, and LodePNG_InfoPng::width.
Referenced by decodeGeneric().
unsigned LodePNG_IText_add | ( | LodePNG_IText * | text, |
const char * | key, | ||
const char * | langtag, | ||
const char * | transkey, | ||
const char * | str | ||
) |
References LodePNG_IText::keys, LodePNG_IText::langtags, LodePNG_IText::num, string_init(), string_set(), LodePNG_IText::strings, and LodePNG_IText::transkeys.
Referenced by decodeGeneric(), and LodePNG_IText_copy().
void LodePNG_IText_cleanup | ( | LodePNG_IText * | text | ) |
References LodePNG_IText_clear().
Referenced by LodePNG_InfoPng_cleanup().
void LodePNG_IText_clear | ( | LodePNG_IText * | text | ) |
References i, LodePNG_IText::keys, LodePNG_IText::langtags, LodePNG_IText::num, string_cleanup(), LodePNG_IText::strings, and LodePNG_IText::transkeys.
Referenced by LodePNG_IText_cleanup().
unsigned LodePNG_IText_copy | ( | LodePNG_IText * | dest, |
const LodePNG_IText * | source | ||
) |
References LodePNG_IText::keys, LodePNG_IText::langtags, LodePNG_IText_add(), LodePNG_IText::num, LodePNG_IText::strings, and LodePNG_IText::transkeys.
Referenced by LodePNG_InfoPng_copy().
void LodePNG_IText_init | ( | LodePNG_IText * | text | ) |
References LodePNG_IText::keys, LodePNG_IText::langtags, NULL, LodePNG_IText::num, LodePNG_IText::strings, and LodePNG_IText::transkeys.
Referenced by LodePNG_InfoPng_init().
unsigned LodePNG_Text_add | ( | LodePNG_Text * | text, |
const char * | key, | ||
const char * | str | ||
) |
References LodePNG_Text::keys, LodePNG_Text::num, string_init(), string_set(), and LodePNG_Text::strings.
Referenced by decodeGeneric(), and LodePNG_Text_copy().
void LodePNG_Text_cleanup | ( | LodePNG_Text * | text | ) |
References LodePNG_Text_clear().
Referenced by LodePNG_InfoPng_cleanup().
void LodePNG_Text_clear | ( | LodePNG_Text * | text | ) |
References i, LodePNG_Text::keys, LodePNG_Text::num, string_cleanup(), and LodePNG_Text::strings.
Referenced by LodePNG_Text_cleanup().
unsigned LodePNG_Text_copy | ( | LodePNG_Text * | dest, |
const LodePNG_Text * | source | ||
) |
References LodePNG_Text::keys, LodePNG_Text_add(), LodePNG_Text::num, and LodePNG_Text::strings.
Referenced by LodePNG_InfoPng_copy().
void LodePNG_Text_init | ( | LodePNG_Text * | text | ) |
References LodePNG_Text::keys, NULL, LodePNG_Text::num, and LodePNG_Text::strings.
Referenced by LodePNG_InfoPng_init().
void LodePNG_UnknownChunks_cleanup | ( | LodePNG_UnknownChunks * | chunks | ) |
References LodePNG_UnknownChunks::data, and i.
Referenced by LodePNG_InfoPng_cleanup(), and LodePNG_UnknownChunks_copy().
unsigned LodePNG_UnknownChunks_copy | ( | LodePNG_UnknownChunks * | dest, |
const LodePNG_UnknownChunks * | src | ||
) |
References LodePNG_UnknownChunks::data, LodePNG_UnknownChunks::datasize, i, j, and LodePNG_UnknownChunks_cleanup().
Referenced by LodePNG_InfoPng_copy().
void LodePNG_UnknownChunks_init | ( | LodePNG_UnknownChunks * | chunks | ) |
References LodePNG_UnknownChunks::data, LodePNG_UnknownChunks::datasize, and i.
Referenced by LodePNG_InfoPng_copy(), and LodePNG_InfoPng_init().
unsigned LodeZlib_decompress | ( | unsigned char ** | out, |
size_t * | outsize, | ||
const unsigned char * | in, | ||
size_t | insize, | ||
const LodeZlib_DecompressSettings * | settings | ||
) |
References adler32(), ucvector::data, LodeZlib_DecompressSettings::ignoreAdler32, LodeFlate_inflate(), LodeZlib_read32bitInt(), ucvector::size, and ucvector_init_buffer().
Referenced by LodePNG_decompress().
void LodeZlib_DecompressSettings_init | ( | LodeZlib_DecompressSettings * | settings | ) |
References LodeZlib_DecompressSettings::ignoreAdler32.
Referenced by LodePNG_DecodeSettings_init().
const LodeZlib_DecompressSettings LodeZlib_defaultDecompressSettings |