MCPcopy Create free account
hub / github.com/DFHack/dfhack / addChunk_IHDR

Function addChunk_IHDR

depends/lodepng/lodepng.cpp:5099–5115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5097}
5098
5099static unsigned addChunk_IHDR(ucvector* out, unsigned w, unsigned h,
5100 LodePNGColorType colortype, unsigned bitdepth, unsigned interlace_method) {
5101 unsigned char *chunk, *data;
5102 CERROR_TRY_RETURN(lodepng_chunk_init(&chunk, out, 13, "IHDR"));
5103 data = chunk + 8;
5104
5105 lodepng_set32bitInt(data + 0, w); /*width*/
5106 lodepng_set32bitInt(data + 4, h); /*height*/
5107 data[8] = (unsigned char)bitdepth; /*bit depth*/
5108 data[9] = (unsigned char)colortype; /*color type*/
5109 data[10] = 0; /*compression method*/
5110 data[11] = 0; /*filter method*/
5111 data[12] = interlace_method; /*interlace method*/
5112
5113 lodepng_chunk_generate_crc(chunk);
5114 return 0;
5115}
5116
5117/* only adds the chunk if needed (there is a key or palette with alpha) */
5118static unsigned addChunk_PLTE(ucvector* out, const LodePNGColorMode* info) {

Callers 1

lodepng_encodeFunction · 0.85

Calls 3

lodepng_chunk_initFunction · 0.85
lodepng_set32bitIntFunction · 0.85

Tested by

no test coverage detected