lodepng.h

Defines

LODEPNG_COMPILE_ZLIB
LODEPNG_COMPILE_PNG
LODEPNG_COMPILE_DECODER
LODEPNG_COMPILE_ENCODER
LODEPNG_COMPILE_DISK
LODEPNG_COMPILE_ANCILLARY_CHUNKS
LODEPNG_COMPILE_ERROR_TEXT
LODEPNG_COMPILE_ALLOCATORS
LODEPNG_COMPILE_CRC

Typedefs

typedef enum LodePNGColorType LodePNGColorType
typedef struct LodePNGDecompressSettings LodePNGDecompressSettings
typedef struct LodePNGCompressSettings LodePNGCompressSettings
typedef struct LodePNGColorMode LodePNGColorMode
typedef struct LodePNGTime LodePNGTime
typedef struct LodePNGInfo LodePNGInfo
typedef struct LodePNGDecoderSettings LodePNGDecoderSettings
typedef enum LodePNGFilterStrategy LodePNGFilterStrategy
typedef struct LodePNGColorStats LodePNGColorStats
typedef struct LodePNGEncoderSettings LodePNGEncoderSettings
typedef struct LodePNGState LodePNGState

Enums

enum LodePNGColorType

Values:

enumerator LCT_GREY
enumerator LCT_RGB
enumerator LCT_PALETTE
enumerator LCT_GREY_ALPHA
enumerator LCT_RGBA
enumerator LCT_MAX_OCTET_VALUE
enum LodePNGFilterStrategy

Values:

enumerator LFS_ZERO
enumerator LFS_ONE
enumerator LFS_TWO
enumerator LFS_THREE
enumerator LFS_FOUR
enumerator LFS_MINSUM
enumerator LFS_ENTROPY
enumerator LFS_BRUTE_FORCE
enumerator LFS_PREDEFINED

Functions

unsigned lodepng_decode_memory(unsigned char **out, unsigned *w, unsigned *h, const unsigned char *in, size_t insize, LodePNGColorType colortype, unsigned bitdepth)
unsigned lodepng_decode32(unsigned char **out, unsigned *w, unsigned *h, const unsigned char *in, size_t insize)
unsigned lodepng_decode24(unsigned char **out, unsigned *w, unsigned *h, const unsigned char *in, size_t insize)
unsigned lodepng_decode_file(unsigned char **out, unsigned *w, unsigned *h, const char *filename, LodePNGColorType colortype, unsigned bitdepth)
unsigned lodepng_decode32_file(unsigned char **out, unsigned *w, unsigned *h, const char *filename)
unsigned lodepng_decode24_file(unsigned char **out, unsigned *w, unsigned *h, const char *filename)
unsigned lodepng_encode_memory(unsigned char **out, size_t *outsize, const unsigned char *image, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth)
unsigned lodepng_encode32(unsigned char **out, size_t *outsize, const unsigned char *image, unsigned w, unsigned h)
unsigned lodepng_encode24(unsigned char **out, size_t *outsize, const unsigned char *image, unsigned w, unsigned h)
unsigned lodepng_encode_file(const char *filename, const unsigned char *image, unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth)
unsigned lodepng_encode32_file(const char *filename, const unsigned char *image, unsigned w, unsigned h)
unsigned lodepng_encode24_file(const char *filename, const unsigned char *image, unsigned w, unsigned h)
const char *lodepng_error_text(unsigned code)
void lodepng_decompress_settings_init(LodePNGDecompressSettings *settings)
void lodepng_compress_settings_init(LodePNGCompressSettings *settings)
void lodepng_color_mode_init(LodePNGColorMode *info)
void lodepng_color_mode_cleanup(LodePNGColorMode *info)
unsigned lodepng_color_mode_copy(LodePNGColorMode *dest, const LodePNGColorMode *source)
LodePNGColorMode lodepng_color_mode_make(LodePNGColorType colortype, unsigned bitdepth)
void lodepng_palette_clear(LodePNGColorMode *info)
unsigned lodepng_palette_add(LodePNGColorMode *info, unsigned char r, unsigned char g, unsigned char b, unsigned char a)
unsigned lodepng_get_bpp(const LodePNGColorMode *info)
unsigned lodepng_get_channels(const LodePNGColorMode *info)
unsigned lodepng_is_greyscale_type(const LodePNGColorMode *info)
unsigned lodepng_is_alpha_type(const LodePNGColorMode *info)
unsigned lodepng_is_palette_type(const LodePNGColorMode *info)
unsigned lodepng_has_palette_alpha(const LodePNGColorMode *info)
unsigned lodepng_can_have_alpha(const LodePNGColorMode *info)
size_t lodepng_get_raw_size(unsigned w, unsigned h, const LodePNGColorMode *color)
void lodepng_info_init(LodePNGInfo *info)
void lodepng_info_cleanup(LodePNGInfo *info)
unsigned lodepng_info_copy(LodePNGInfo *dest, const LodePNGInfo *source)
unsigned lodepng_add_text(LodePNGInfo *info, const char *key, const char *str)
void lodepng_clear_text(LodePNGInfo *info)
unsigned lodepng_add_itext(LodePNGInfo *info, const char *key, const char *langtag, const char *transkey, const char *str)
void lodepng_clear_itext(LodePNGInfo *info)
unsigned lodepng_set_icc(LodePNGInfo *info, const char *name, const unsigned char *profile, unsigned profile_size)
void lodepng_clear_icc(LodePNGInfo *info)
unsigned lodepng_convert(unsigned char *out, const unsigned char *in, const LodePNGColorMode *mode_out, const LodePNGColorMode *mode_in, unsigned w, unsigned h)
void lodepng_decoder_settings_init(LodePNGDecoderSettings *settings)
void lodepng_color_stats_init(LodePNGColorStats *stats)
unsigned lodepng_compute_color_stats(LodePNGColorStats *stats, const unsigned char *image, unsigned w, unsigned h, const LodePNGColorMode *mode_in)
void lodepng_encoder_settings_init(LodePNGEncoderSettings *settings)
void lodepng_state_init(LodePNGState *state)
void lodepng_state_cleanup(LodePNGState *state)
void lodepng_state_copy(LodePNGState *dest, const LodePNGState *source)
unsigned lodepng_decode(unsigned char **out, unsigned *w, unsigned *h, LodePNGState *state, const unsigned char *in, size_t insize)
unsigned lodepng_inspect(unsigned *w, unsigned *h, LodePNGState *state, const unsigned char *in, size_t insize)
unsigned lodepng_inspect_chunk(LodePNGState *state, size_t pos, const unsigned char *in, size_t insize)
unsigned lodepng_encode(unsigned char **out, size_t *outsize, const unsigned char *image, unsigned w, unsigned h, LodePNGState *state)
unsigned lodepng_chunk_length(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 char lodepng_chunk_ancillary(const unsigned char *chunk)
unsigned char lodepng_chunk_private(const unsigned char *chunk)
unsigned char lodepng_chunk_safetocopy(const unsigned char *chunk)
unsigned char *lodepng_chunk_data(unsigned char *chunk)
const unsigned char *lodepng_chunk_data_const(const unsigned char *chunk)
unsigned lodepng_chunk_check_crc(const unsigned char *chunk)
void lodepng_chunk_generate_crc(unsigned char *chunk)
unsigned char *lodepng_chunk_next(unsigned char *chunk, unsigned char *end)
const unsigned char *lodepng_chunk_next_const(const unsigned char *chunk, const unsigned char *end)
unsigned char *lodepng_chunk_find(unsigned char *chunk, unsigned char *end, const char type[5])
const unsigned char *lodepng_chunk_find_const(const unsigned char *chunk, const unsigned char *end, const char type[5])
unsigned lodepng_chunk_append(unsigned char **out, size_t *outsize, const unsigned char *chunk)
unsigned lodepng_chunk_create(unsigned char **out, size_t *outsize, size_t length, const char *type, const unsigned char *data)
unsigned lodepng_crc32(const unsigned char *buf, size_t len)
unsigned lodepng_inflate(unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGDecompressSettings *settings)
unsigned lodepng_zlib_decompress(unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGDecompressSettings *settings)
unsigned lodepng_zlib_compress(unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGCompressSettings *settings)
unsigned lodepng_huffman_code_lengths(unsigned *lengths, const unsigned *frequencies, size_t numcodes, unsigned maxbitlen)
unsigned lodepng_deflate(unsigned char **out, size_t *outsize, const unsigned char *in, size_t insize, const LodePNGCompressSettings *settings)
unsigned lodepng_load_file(unsigned char **out, size_t *outsize, const char *filename)
unsigned lodepng_save_file(const unsigned char *buffer, size_t buffersize, const char *filename)

Variables

const char *LODEPNG_VERSION_STRING
const LodePNGDecompressSettings lodepng_default_decompress_settings
const LodePNGCompressSettings lodepng_default_compress_settings
struct LodePNGDecompressSettings

Public Members

unsigned ignore_adler32
unsigned ignore_nlen
size_t max_output_size
unsigned (*custom_zlib)(unsigned char**, size_t*, const unsigned char*, size_t, const LodePNGDecompressSettings*)
unsigned (*custom_inflate)(unsigned char**, size_t*, const unsigned char*, size_t, const LodePNGDecompressSettings*)
const void *custom_context
struct LodePNGCompressSettings

Public Members

unsigned btype
unsigned use_lz77
unsigned windowsize
unsigned minmatch
unsigned nicematch
unsigned lazymatching
unsigned (*custom_zlib)(unsigned char**, size_t*, const unsigned char*, size_t, const LodePNGCompressSettings*)
unsigned (*custom_deflate)(unsigned char**, size_t*, const unsigned char*, size_t, const LodePNGCompressSettings*)
const void *custom_context
struct LodePNGColorMode

Public Members

LodePNGColorType colortype
unsigned bitdepth
unsigned char *palette
size_t palettesize
unsigned key_defined
unsigned key_r
unsigned key_g
unsigned key_b
struct LodePNGTime

Public Members

unsigned year
unsigned month
unsigned day
unsigned hour
unsigned minute
unsigned second
struct LodePNGInfo

Public Members

unsigned compression_method
unsigned filter_method
unsigned interlace_method
LodePNGColorMode color
unsigned background_defined
unsigned background_r
unsigned background_g
unsigned background_b
size_t text_num
char **text_keys
char **text_strings
size_t itext_num
char **itext_keys
char **itext_langtags
char **itext_transkeys
char **itext_strings
unsigned time_defined
LodePNGTime time
unsigned phys_defined
unsigned phys_x
unsigned phys_y
unsigned phys_unit
unsigned gama_defined
unsigned gama_gamma
unsigned chrm_defined
unsigned chrm_white_x
unsigned chrm_white_y
unsigned chrm_red_x
unsigned chrm_red_y
unsigned chrm_green_x
unsigned chrm_green_y
unsigned chrm_blue_x
unsigned chrm_blue_y
unsigned srgb_defined
unsigned srgb_intent
unsigned iccp_defined
char *iccp_name
unsigned char *iccp_profile
unsigned iccp_profile_size
unsigned sbit_defined
unsigned sbit_r
unsigned sbit_g
unsigned sbit_b
unsigned sbit_a
unsigned char *unknown_chunks_data[3]
size_t unknown_chunks_size[3]
struct LodePNGDecoderSettings

Public Members

LodePNGDecompressSettings zlibsettings
unsigned ignore_crc
unsigned ignore_critical
unsigned ignore_end
unsigned color_convert
unsigned read_text_chunks
unsigned remember_unknown_chunks
size_t max_text_size
size_t max_icc_size
struct LodePNGColorStats

Public Members

unsigned colored
unsigned key
unsigned short key_r
unsigned short key_g
unsigned short key_b
unsigned alpha
unsigned numcolors
unsigned char palette[1024]
unsigned bits
size_t numpixels
unsigned allow_palette
unsigned allow_greyscale
struct LodePNGEncoderSettings

Public Members

LodePNGCompressSettings zlibsettings
unsigned auto_convert
unsigned filter_palette_zero
LodePNGFilterStrategy filter_strategy
const unsigned char *predefined_filters
unsigned force_palette
unsigned add_id
unsigned text_compression
struct LodePNGState

Public Members

LodePNGDecoderSettings decoder
LodePNGEncoderSettings encoder
LodePNGColorMode info_raw
LodePNGInfo info_png
unsigned error