| 5097 | } |
| 5098 | |
| 5099 | static 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) */ |
| 5118 | static unsigned addChunk_PLTE(ucvector* out, const LodePNGColorMode* info) { |
no test coverage detected