Lines Matching full:palette
2495 case 3: if(!(bd == 1 || bd == 2 || bd == 4 || bd == 8 )) return 37; break; /*palette*/
2509 case 3: return 1; /*palette*/
2530 info->palette = 0;
2544 if(source->palette)
2546 dest->palette = (unsigned char*)lodepng_malloc(1024);
2547 if(!dest->palette && source->palettesize) return 83; /*alloc fail*/
2548 for(i = 0; i < source->palettesize * 4; i++) dest->palette[i] = source->palette[i];
2568 if(a->palette[i] != b->palette[i]) return 0;
2575 if(info->palette) lodepng_free(info->palette);
2576 info->palette = 0;
2584 /*the same resize technique as C++ std::vectors is used, and here it's made so that for a palette with
2586 if(!info->palette) /*allocate palette if empty*/
2589 data = (unsigned char*)lodepng_realloc(info->palette, 1024);
2591 else info->palette = data;
2593 info->palette[4 * info->palettesize + 0] = r;
2594 info->palette[4 * info->palettesize + 1] = g;
2595 info->palette[4 * info->palettesize + 2] = b;
2596 info->palette[4 * info->palettesize + 3] = a;
2632 if(info->palette[i * 4 + 3] < 255) return 1;
2912 This is the data structure used to count the number of unique colors and to get a palette
2983 const LodePNGColorMode* mode, ColorTree* tree /*for palette*/,
3016 if(index < 0) return 82; /*color not in palette*/
3162 if(!fix_png) return (mode->bitdepth == 8 ? 46 : 47); /*index out of palette*/
3168 *r = mode->palette[index * 4 + 0];
3169 *g = mode->palette[index * 4 + 1];
3170 *b = mode->palette[index * 4 + 2];
3171 *a = mode->palette[index * 4 + 3];
3289 if(!fix_png) return (mode->bitdepth == 8 ? 46 : 47); /*index out of palette*/
3295 buffer[0] = mode->palette[index * 4 + 0];
3296 buffer[1] = mode->palette[index * 4 + 1];
3297 buffer[2] = mode->palette[index * 4 + 2];
3298 if(has_alpha) buffer[3] = mode->palette[index * 4 + 3];
3416 unsigned char* p = &mode_out->palette[i * 4];
3475 unsigned char alpha; /*alpha channel, or alpha palette, required*/
3480 unsigned char* palette; /*size 1024. Remember up to the first 256 RGBA colors*/
3503 profile->palette = (unsigned char*)lodepng_malloc(1024);
3519 lodepng_free(profile->palette);
3580 profile->numcolors_done = 1; /*counting colors no longer useful, palette doesn't support 16-bit*/
3637 unsigned char* p = profile->palette;
3715 unsigned char* p = profile->palette;
3808 /*don't add palette overhead if image hasn't got a lot of pixels*/
3824 /*fill in the palette*/
3826 unsigned char* p = profile.palette;
3827 /*remove potential earlier palette*/
3859 /*In this case keep the palette order of the input, so that the user can choose an optimal one*/
3863 mode_out->palette[i] = mode_in->palette[i];
3869 /*palette can keep its small amount of colors, as long as no indices use it*/
4257 if(color->palette) lodepng_free(color->palette);
4259 color->palette = (unsigned char*)lodepng_malloc(4 * color->palettesize);
4260 if(!color->palette && color->palettesize)
4265 if(color->palettesize > 256) return 38; /*error: palette too big*/
4269 color->palette[4 * i + 0] = data[pos++]; /*R*/
4270 color->palette[4 * i + 1] = data[pos++]; /*G*/
4271 color->palette[4 * i + 2] = data[pos++]; /*B*/
4272 palette[4 * i + 3] = 255; /*alpha*/
4283 /*error: more alpha values given than there are palette entries*/
4286 for(i = 0; i < chunkLength; i++) color->palette[4 * i + 3] = data[i];
4624 /*palette chunk (PLTE)*/
4633 /*palette transparency chunk (tRNS)*/
4932 if(i % 4 != 3) ucvector_push_back(&PLTE, info->palette[i]);
4949 /*the tail of palette values that all have 255 as alpha, does not have to be encoded*/
4952 if(info->palette[4 * (i - 1) + 3] == 255) amount--;
4956 for(i = 0; i < amount; i++) ucvector_push_back(&tRNS, info->palette[4 * i + 3]);
5114 ucvector_push_back(&bKGD, (unsigned char)(info->background_r % 256)); /*palette index*/
5252 * If the image type is Palette, or the bit depth is smaller than 8, then do not filter the image (i.e.
5623 palette must have 4 * palettesize bytes allocated, and given in format RGBARGBARGBARGBA...
5624 returns 0 if the palette is opaque,
5625 returns 1 if the palette has a single color with alpha 0 ==> color key
5626 returns 2 if the palette is semi-translucent.
5628 static unsigned getPaletteTranslucency(const unsigned char* palette, size_t palettesize)
5634 if(!key && palette[4 * i + 3] == 0)
5636 r = palette[4 * i + 0]; g = palette[4 * i + 1]; b = palette[4 * i + 2];
5640 else if(palette[4 * i + 3] != 255) return 2;
5642 else if(key && r == palette[i * 4 + 0] && g == palette[i * 4 + 1] && b == palette[i * 4 + 2]) return 2;
5681 state->error = 68; /*invalid palette size, it is only allowed to be 1-256*/
5750 if(info.color.colortype == LCT_PALETTE && getPaletteTranslucency(info.color.palette, info.color.palettesize) != 0)
5964 case 38: return "the palette is too big"; /*more than 256 colors*/
5965 case 39: return "more palette alpha values given in tRNS chunk than there are colors in the palette";
5969 case 43: return "bKGD chunk has wrong size for palette image";
5972 /*Is the palette too small?*/
5973 case 46: return "a value in indexed image is larger than the palette size (bitdepth = 8)";
5974 /*Is the palette too small?*/
5975 case 47: return "a value in indexed image is larger than the palette size (bitdepth < 8)";
6001 case 68: return "tried to encode a PLTE chunk with a palette that has less than 1 or more than 256 colors";
6015 case 82: return "color conversion to palette requested while a color isn't in palette";