39 #define LODEPNG_COMPILE_ZLIB
40 #define LODEPNG_COMPILE_PNG
42 #define LODEPNG_COMPILE_ENCODER
43 #define LODEPNG_COMPILE_DISK
51 #ifdef LODEPNG_COMPILE_DECODER
52 typedef struct LodeZlib_DecompressSettings
54 unsigned ignoreAdler32;
55 } LodeZlib_DecompressSettings;
57 extern const LodeZlib_DecompressSettings LodeZlib_defaultDecompressSettings;
58 void LodeZlib_DecompressSettings_init(LodeZlib_DecompressSettings* settings);
61 #ifdef LODEPNG_COMPILE_ENCODER
74 #ifdef LODEPNG_COMPILE_ZLIB
79 #ifdef LODEPNG_COMPILE_DECODER
82 unsigned LodeZlib_decompress(
unsigned char** out,
size_t* outsize,
const unsigned char* in,
size_t insize,
const LodeZlib_DecompressSettings* settings);
85 #ifdef LODEPNG_COMPILE_ENCODER
92 #ifdef LODEPNG_COMPILE_PNG
121 unsigned LodePNG_append_chunk(
unsigned char** out,
size_t* outlength,
const unsigned char* chunk);
122 unsigned LodePNG_create_chunk(
unsigned char** out,
size_t* outlength,
unsigned length,
const char* type,
const unsigned char* data);
155 #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
156 typedef struct LodePNG_Time
162 unsigned char minute;
163 unsigned char second;
166 typedef struct LodePNG_Text
173 void LodePNG_Text_init(LodePNG_Text* text);
174 void LodePNG_Text_cleanup(LodePNG_Text* text);
175 unsigned LodePNG_Text_copy(LodePNG_Text* dest,
const LodePNG_Text* source);
178 void LodePNG_Text_clear(LodePNG_Text* text);
179 unsigned LodePNG_Text_add(LodePNG_Text* text,
const char* key,
const char* str);
182 typedef struct LodePNG_IText
191 void LodePNG_IText_init(LodePNG_IText* text);
192 void LodePNG_IText_cleanup(LodePNG_IText* text);
193 unsigned LodePNG_IText_copy(LodePNG_IText* dest,
const LodePNG_IText* source);
196 void LodePNG_IText_clear(LodePNG_IText* text);
197 unsigned LodePNG_IText_add(LodePNG_IText* text,
const char* key,
const char* langtag,
const char* transkey,
const char* str);
200 #ifdef LODEPNG_COMPILE_UNKNOWN_CHUNKS
201 typedef struct LodePNG_UnknownChunks
207 unsigned char* data[3];
210 } LodePNG_UnknownChunks;
212 void LodePNG_UnknownChunks_init(LodePNG_UnknownChunks* chunks);
213 void LodePNG_UnknownChunks_cleanup(LodePNG_UnknownChunks* chunks);
214 unsigned LodePNG_UnknownChunks_copy(LodePNG_UnknownChunks* dest,
const LodePNG_UnknownChunks* src);
227 #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
230 unsigned background_defined;
231 unsigned background_r;
232 unsigned background_g;
233 unsigned background_b;
242 unsigned char time_defined;
246 unsigned phys_defined;
249 unsigned char phys_unit;
253 #ifdef LODEPNG_COMPILE_UNKNOWN_CHUNKS
255 LodePNG_UnknownChunks unknown_chunks;
279 #ifdef LODEPNG_COMPILE_DECODER
281 typedef struct LodePNG_DecodeSettings
283 LodeZlib_DecompressSettings zlibsettings;
286 unsigned color_convert;
288 #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
289 unsigned readTextChunks;
292 #ifdef LODEPNG_COMPILE_UNKNOWN_CHUNKS
293 unsigned rememberUnknownChunks;
295 } LodePNG_DecodeSettings;
297 void LodePNG_DecodeSettings_init(LodePNG_DecodeSettings* settings);
299 typedef struct LodePNG_Decoder
301 LodePNG_DecodeSettings settings;
307 void LodePNG_Decoder_init(LodePNG_Decoder* decoder);
308 void LodePNG_Decoder_cleanup(LodePNG_Decoder* decoder);
309 void LodePNG_Decoder_copy(LodePNG_Decoder* dest,
const LodePNG_Decoder* source);
313 void LodePNG_decode(LodePNG_Decoder* decoder,
unsigned char** out,
size_t* outsize,
const unsigned char* in,
size_t insize);
314 unsigned LodePNG_decode32(
unsigned char** out,
unsigned* w,
unsigned* h,
const unsigned char* in,
size_t insize);
315 #ifdef LODEPNG_COMPILE_DISK
316 unsigned LodePNG_decode32f(
unsigned char** out,
unsigned* w,
unsigned* h,
const char* filename);
318 void LodePNG_inspect(LodePNG_Decoder* decoder,
const unsigned char* in,
size_t size);
322 #ifdef LODEPNG_COMPILE_ENCODER
330 #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
332 unsigned text_compression;
352 unsigned LodePNG_encode32(
unsigned char** out,
size_t* outsize,
const unsigned char* image,
unsigned w,
unsigned h);
353 #ifdef LODEPNG_COMPILE_DISK
354 unsigned LodePNG_encode32f(
const char* filename,
const unsigned char* image,
unsigned w,
unsigned h);
359 #ifdef LODEPNG_COMPILE_DISK
362 unsigned LodePNG_loadFile(
unsigned char** out,
size_t* outsize,
const char* filename);
363 unsigned LodePNG_saveFile(
const unsigned char* buffer,
size_t buffersize,
const char* filename);