| 6917 | } |
| 6918 | |
| 6919 | unsigned lodepng_encode_memory(unsigned char** out, size_t* outsize, const unsigned char* image, |
| 6920 | unsigned w, unsigned h, LodePNGColorType colortype, unsigned bitdepth) { |
| 6921 | unsigned error; |
| 6922 | LodePNGState state; |
| 6923 | lodepng_state_init(&state); |
| 6924 | state.info_raw.colortype = colortype; |
| 6925 | state.info_raw.bitdepth = bitdepth; |
| 6926 | state.info_png.color.colortype = colortype; |
| 6927 | state.info_png.color.bitdepth = bitdepth; |
| 6928 | lodepng_encode(out, outsize, image, w, h, &state); |
| 6929 | error = state.error; |
| 6930 | lodepng_state_cleanup(&state); |
| 6931 | return error; |
| 6932 | } |
| 6933 | |
| 6934 | unsigned lodepng_encode32(unsigned char** out, size_t* outsize, const unsigned char* image, unsigned w, unsigned h) { |
| 6935 | return lodepng_encode_memory(out, outsize, image, w, h, LCT_RGBA, 8); |