45 #ifndef LODEPNG_NO_COMPILE_ZLIB
46 #define LODEPNG_COMPILE_ZLIB
49 #ifndef LODEPNG_NO_COMPILE_PNG
50 #define LODEPNG_COMPILE_PNG
53 #ifndef LODEPNG_NO_COMPILE_DECODER
54 #define LODEPNG_COMPILE_DECODER
57 #ifndef LODEPNG_NO_COMPILE_ENCODER
58 #define LODEPNG_COMPILE_ENCODER
61 #ifndef LODEPNG_NO_COMPILE_DISK
62 #define LODEPNG_COMPILE_DISK
65 #ifndef LODEPNG_NO_COMPILE_ANCILLARY_CHUNKS
66 #define LODEPNG_COMPILE_ANCILLARY_CHUNKS
69 #ifndef LODEPNG_NO_COMPILE_ERROR_TEXT
70 #define LODEPNG_COMPILE_ERROR_TEXT
75 #ifndef LODEPNG_NO_COMPILE_ALLOCATORS
76 #define LODEPNG_COMPILE_ALLOCATORS
80 #ifndef LODEPNG_NO_COMPILE_CPP
81 #define LODEPNG_COMPILE_CPP
85 #ifdef LODEPNG_COMPILE_PNG
87 typedef enum LodePNGColorType
96 #ifdef LODEPNG_COMPILE_DECODER
112 unsigned lodepng_decode_memory(
unsigned char** out,
unsigned* w,
unsigned* h,
113 const unsigned char* in,
size_t insize,
114 LodePNGColorType colortype,
unsigned bitdepth);
117 unsigned lodepng_decode32(
unsigned char** out,
unsigned* w,
unsigned* h,
118 const unsigned char* in,
size_t insize);
121 unsigned lodepng_decode24(
unsigned char** out,
unsigned* w,
unsigned* h,
122 const unsigned char* in,
size_t insize);
124 #ifdef LODEPNG_COMPILE_DISK
129 unsigned lodepng_decode_file(
unsigned char** out,
unsigned* w,
unsigned* h,
130 const char* filename,
131 LodePNGColorType colortype,
unsigned bitdepth);
134 unsigned lodepng_decode32_file(
unsigned char** out,
unsigned* w,
unsigned* h,
135 const char* filename);
138 unsigned lodepng_decode24_file(
unsigned char** out,
unsigned* w,
unsigned* h,
139 const char* filename);
144 #ifdef LODEPNG_COMPILE_ENCODER
161 unsigned lodepng_encode_memory(
unsigned char** out,
size_t* outsize,
162 const unsigned char* image,
unsigned w,
unsigned h,
163 LodePNGColorType colortype,
unsigned bitdepth);
166 unsigned lodepng_encode32(
unsigned char** out,
size_t* outsize,
167 const unsigned char* image,
unsigned w,
unsigned h);
170 unsigned lodepng_encode24(
unsigned char** out,
size_t* outsize,
171 const unsigned char* image,
unsigned w,
unsigned h);
173 #ifdef LODEPNG_COMPILE_DISK
179 unsigned lodepng_encode_file(
const char* filename,
180 const unsigned char* image,
unsigned w,
unsigned h,
181 LodePNGColorType colortype,
unsigned bitdepth);
184 unsigned lodepng_encode32_file(
const char* filename,
185 const unsigned char* image,
unsigned w,
unsigned h);
188 unsigned lodepng_encode24_file(
const char* filename,
189 const unsigned char* image,
unsigned w,
unsigned h);
194 #ifdef LODEPNG_COMPILE_CPP
197 #ifdef LODEPNG_COMPILE_DECODER
199 unsigned decode(std::vector<unsigned char>& out,
unsigned& w,
unsigned& h,
200 const unsigned char* in,
size_t insize,
201 LodePNGColorType colortype = LCT_RGBA,
unsigned bitdepth = 8);
202 unsigned decode(std::vector<unsigned char>& out,
unsigned& w,
unsigned& h,
203 const std::vector<unsigned char>& in,
204 LodePNGColorType colortype = LCT_RGBA,
unsigned bitdepth = 8);
205 #ifdef LODEPNG_COMPILE_DISK
210 unsigned decode(std::vector<unsigned char>& out,
unsigned& w,
unsigned& h,
211 const std::string& filename,
212 LodePNGColorType colortype = LCT_RGBA,
unsigned bitdepth = 8);
213 #endif //LODEPNG_COMPILE_DISK
214 #endif //LODEPNG_COMPILE_DECODER
216 #ifdef LODEPNG_COMPILE_ENCODER
218 unsigned encode(std::vector<unsigned char>& out,
219 const unsigned char* in,
unsigned w,
unsigned h,
220 LodePNGColorType colortype = LCT_RGBA,
unsigned bitdepth = 8);
221 unsigned encode(std::vector<unsigned char>& out,
222 const std::vector<unsigned char>& in,
unsigned w,
unsigned h,
223 LodePNGColorType colortype = LCT_RGBA,
unsigned bitdepth = 8);
224 #ifdef LODEPNG_COMPILE_DISK
230 unsigned encode(
const std::string& filename,
231 const unsigned char* in,
unsigned w,
unsigned h,
232 LodePNGColorType colortype = LCT_RGBA,
unsigned bitdepth = 8);
233 unsigned encode(
const std::string& filename,
234 const std::vector<unsigned char>& in,
unsigned w,
unsigned h,
235 LodePNGColorType colortype = LCT_RGBA,
unsigned bitdepth = 8);
236 #endif //LODEPNG_COMPILE_DISK
237 #endif //LODEPNG_COMPILE_ENCODER
242 #ifdef LODEPNG_COMPILE_ERROR_TEXT
244 const char* lodepng_error_text(
unsigned code);
247 #ifdef LODEPNG_COMPILE_DECODER
252 unsigned ignore_adler32;
255 unsigned (*custom_zlib)(
unsigned char**,
size_t*,
256 const unsigned char*, size_t,
261 unsigned (*custom_inflate)(
unsigned char**,
size_t*,
262 const unsigned char*, size_t,
265 void* custom_context;
272 #ifdef LODEPNG_COMPILE_ENCODER
286 unsigned lazymatching;
289 unsigned (*custom_zlib)(
unsigned char**,
size_t*,
290 const unsigned char*, size_t,
295 unsigned (*custom_deflate)(
unsigned char**,
size_t*,
296 const unsigned char*, size_t,
299 void* custom_context;
306 #ifdef LODEPNG_COMPILE_PNG
315 LodePNGColorType colortype;
331 unsigned char* palette;
345 unsigned key_defined;
360 unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a);
385 size_t lodepng_get_raw_size(
unsigned w,
unsigned h,
const LodePNGColorMode* color);
387 #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
404 unsigned compression_method;
405 unsigned filter_method;
406 unsigned interlace_method;
409 #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
421 unsigned background_defined;
422 unsigned background_r;
423 unsigned background_g;
424 unsigned background_b;
450 char** itext_langtags;
451 char** itext_transkeys;
452 char** itext_strings;
455 unsigned time_defined;
459 unsigned phys_defined;
473 unsigned char* unknown_chunks_data[3];
474 size_t unknown_chunks_size[3];
484 #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
486 unsigned lodepng_add_text(
LodePNGInfo* info,
const char* key,
const char* str);
489 unsigned lodepng_add_itext(
LodePNGInfo* info,
const char* key,
const char* langtag,
490 const char* transkey,
const char* str);
503 unsigned lodepng_convert(
unsigned char* out,
const unsigned char* in,
505 unsigned w,
unsigned h,
unsigned fix_png);
508 #ifdef LODEPNG_COMPILE_DECODER
528 unsigned color_convert;
530 #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
531 unsigned read_text_chunks;
533 unsigned remember_unknown_chunks;
540 #ifdef LODEPNG_COMPILE_ENCODER
542 typedef enum LodePNGFilterStrategy
558 } LodePNGFilterStrategy;
561 typedef enum LodePNGAutoConvert
579 LAC_AUTO_NO_NIBBLES_NO_PALETTE
580 } LodePNGAutoConvert;
588 LodePNGAutoConvert auto_convert;
594 unsigned filter_palette_zero;
597 LodePNGFilterStrategy filter_strategy;
602 unsigned char* predefined_filters;
606 unsigned force_palette;
607 #ifdef LODEPNG_COMPILE_ANCILLARY_CHUNKS
611 unsigned text_compression;
619 #if defined(LODEPNG_COMPILE_DECODER) || defined(LODEPNG_COMPILE_ENCODER)
623 #ifdef LODEPNG_COMPILE_DECODER
626 #ifdef LODEPNG_COMPILE_ENCODER
632 #ifdef LODEPNG_COMPILE_CPP
644 #ifdef LODEPNG_COMPILE_DECODER
649 unsigned lodepng_decode(
unsigned char** out,
unsigned* w,
unsigned* h,
651 const unsigned char* in,
size_t insize);
658 unsigned lodepng_inspect(
unsigned* w,
unsigned* h,
660 const unsigned char* in,
size_t insize);
664 #ifdef LODEPNG_COMPILE_ENCODER
666 unsigned lodepng_encode(
unsigned char** out,
size_t* outsize,
667 const unsigned char* image,
unsigned w,
unsigned h,
684 unsigned lodepng_chunk_length(
const unsigned char* chunk);
687 void lodepng_chunk_type(
char type[5],
const unsigned char* chunk);
690 unsigned char lodepng_chunk_type_equals(
const unsigned char* chunk,
const char* type);
693 unsigned char lodepng_chunk_ancillary(
const unsigned char* chunk);
696 unsigned char lodepng_chunk_private(
const unsigned char* chunk);
699 unsigned char lodepng_chunk_safetocopy(
const unsigned char* chunk);
702 unsigned char* lodepng_chunk_data(
unsigned char* chunk);
703 const unsigned char* lodepng_chunk_data_const(
const unsigned char* chunk);
706 unsigned lodepng_chunk_check_crc(
const unsigned char* chunk);
709 void lodepng_chunk_generate_crc(
unsigned char* chunk);
712 unsigned char* lodepng_chunk_next(
unsigned char* chunk);
713 const unsigned char* lodepng_chunk_next_const(
const unsigned char* chunk);
720 unsigned lodepng_chunk_append(
unsigned char** out,
size_t* outlength,
const unsigned char* chunk);
728 unsigned lodepng_chunk_create(
unsigned char** out,
size_t* outlength,
unsigned length,
729 const char* type,
const unsigned char* data);
733 unsigned lodepng_crc32(
const unsigned char* buf,
size_t len);
737 #ifdef LODEPNG_COMPILE_ZLIB
744 #ifdef LODEPNG_COMPILE_DECODER
746 unsigned lodepng_inflate(
unsigned char** out,
size_t* outsize,
747 const unsigned char* in,
size_t insize,
756 unsigned lodepng_zlib_decompress(
unsigned char** out,
size_t* outsize,
757 const unsigned char* in,
size_t insize,
761 #ifdef LODEPNG_COMPILE_ENCODER
769 unsigned lodepng_zlib_compress(
unsigned char** out,
size_t* outsize,
770 const unsigned char* in,
size_t insize,
777 unsigned lodepng_huffman_code_lengths(
unsigned* lengths,
const unsigned* frequencies,
778 size_t numcodes,
unsigned maxbitlen);
781 unsigned lodepng_deflate(
unsigned char** out,
size_t* outsize,
782 const unsigned char* in,
size_t insize,
788 #ifdef LODEPNG_COMPILE_DISK
797 unsigned lodepng_load_file(
unsigned char** out,
size_t* outsize,
const char* filename);
807 unsigned lodepng_save_file(
const unsigned char* buffer,
size_t buffersize,
const char* filename);
810 #ifdef LODEPNG_COMPILE_CPP
814 #ifdef LODEPNG_COMPILE_PNG
819 State(
const State& other);
821 State& operator=(
const State& other);
824 #ifdef LODEPNG_COMPILE_DECODER
826 unsigned decode(std::vector<unsigned char>& out,
unsigned& w,
unsigned& h,
828 const unsigned char* in,
size_t insize);
829 unsigned decode(std::vector<unsigned char>& out,
unsigned& w,
unsigned& h,
831 const std::vector<unsigned char>& in);
834 #ifdef LODEPNG_COMPILE_ENCODER
836 unsigned encode(std::vector<unsigned char>& out,
837 const unsigned char* in,
unsigned w,
unsigned h,
839 unsigned encode(std::vector<unsigned char>& out,
840 const std::vector<unsigned char>& in,
unsigned w,
unsigned h,
844 #ifdef LODEPNG_COMPILE_DISK
849 void load_file(std::vector<unsigned char>& buffer,
const std::string& filename);
855 void save_file(
const std::vector<unsigned char>& buffer,
const std::string& filename);
856 #endif //LODEPNG_COMPILE_DISK
857 #endif //LODEPNG_COMPILE_PNG
859 #ifdef LODEPNG_COMPILE_ZLIB
860 #ifdef LODEPNG_COMPILE_DECODER
862 unsigned decompress(std::vector<unsigned char>& out,
const unsigned char* in,
size_t insize,
866 unsigned decompress(std::vector<unsigned char>& out,
const std::vector<unsigned char>& in,
868 #endif //LODEPNG_COMPILE_DECODER
870 #ifdef LODEPNG_COMPILE_ENCODER
872 unsigned compress(std::vector<unsigned char>& out,
const unsigned char* in,
size_t insize,
876 unsigned compress(std::vector<unsigned char>& out,
const std::vector<unsigned char>& in,
878 #endif //LODEPNG_COMPILE_ENCODER
879 #endif //LODEPNG_COMPILE_ZLIB
Definition: lodepng.h:621
Definition: lodepng.h:312
Definition: lodepng.h:250
Definition: lodepng.h:278
Definition: lodepng.h:389
Definition: lodepng.h:584
Definition: lodepng.h:513
Definition: lodepng.h:401