Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/lvandeve/lodepng.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLode <lvandeve@gmail.com>2019-10-21 03:25:19 +0300
committerLode <lvandeve@gmail.com>2019-10-21 03:30:01 +0300
commitc43c976ac9f27cfa2119f50e86971d50bdcb6649 (patch)
treeba211b2b98afe1013fc06341c0506f98d0c5949f /lodepng.h
parent95d22bea9ebd79bcabdb139b4185fe96ac8bc501 (diff)
More palette error checking
Do empty input palette check in lodepng_convert for users of this function. Move the missing PLTE chunk error check to decodeGeneric so it triggers even if color_convert is not requested. Add error for trying to add too many colors to a palette.
Diffstat (limited to 'lodepng.h')
-rw-r--r--lodepng.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/lodepng.h b/lodepng.h
index bc67718..26ebe04 100644
--- a/lodepng.h
+++ b/lodepng.h
@@ -335,9 +335,11 @@ typedef struct LodePNGColorMode {
palette (PLTE and tRNS)
Dynamically allocated with the colors of the palette, including alpha.
- When encoding a PNG, to store your colors in the palette of the LodePNGColorMode, first use
- lodepng_palette_clear, then for each color use lodepng_palette_add.
- If you encode an image without alpha with palette, don't forget to put value 255 in each A byte of the palette.
+ This field may not be allocated directly, use lodepng_color_mode_init first,
+ then lodepng_palette_add per color to correctly initialize it (to ensure size
+ of exactly 1024 bytes).
+
+ The alpha channels must be set as well, set them to 255 for opaque images.
When decoding, by default you can ignore this palette, since LodePNG already
fills the palette colors in the pixels of the raw RGBA output.