Lines Matching refs:mode
3662 const LodePNGColorMode * mode, ColorTree * tree /*for palette*/, in rgba8ToPixel() argument
3665 if(mode->colortype == LCT_GREY) { in rgba8ToPixel()
3667 if(mode->bitdepth == 8) out[i] = gray; in rgba8ToPixel()
3668 else if(mode->bitdepth == 16) out[i * 2 + 0] = out[i * 2 + 1] = gray; in rgba8ToPixel()
3671 gray = ((unsigned)gray >> (8u - mode->bitdepth)) & ((1u << mode->bitdepth) - 1u); in rgba8ToPixel()
3672 addColorBits(out, i, mode->bitdepth, gray); in rgba8ToPixel()
3675 else if(mode->colortype == LCT_RGB) { in rgba8ToPixel()
3676 if(mode->bitdepth == 8) { in rgba8ToPixel()
3687 else if(mode->colortype == LCT_PALETTE) { in rgba8ToPixel()
3690 if(mode->bitdepth == 8) out[i] = index; in rgba8ToPixel()
3691 else addColorBits(out, i, mode->bitdepth, (unsigned)index); in rgba8ToPixel()
3693 else if(mode->colortype == LCT_GREY_ALPHA) { in rgba8ToPixel()
3695 if(mode->bitdepth == 8) { in rgba8ToPixel()
3699 else if(mode->bitdepth == 16) { in rgba8ToPixel()
3704 else if(mode->colortype == LCT_RGBA) { in rgba8ToPixel()
3705 if(mode->bitdepth == 8) { in rgba8ToPixel()
3724 const LodePNGColorMode * mode, in rgba16ToPixel() argument
3727 if(mode->colortype == LCT_GREY) { in rgba16ToPixel()
3732 else if(mode->colortype == LCT_RGB) { in rgba16ToPixel()
3740 else if(mode->colortype == LCT_GREY_ALPHA) { in rgba16ToPixel()
3747 else if(mode->colortype == LCT_RGBA) { in rgba16ToPixel()
3763 const LodePNGColorMode * mode) in getPixelColorRGBA8() argument
3765 if(mode->colortype == LCT_GREY) { in getPixelColorRGBA8()
3766 if(mode->bitdepth == 8) { in getPixelColorRGBA8()
3768 if(mode->key_defined && *r == mode->key_r) *a = 0; in getPixelColorRGBA8()
3771 else if(mode->bitdepth == 16) { in getPixelColorRGBA8()
3773 if(mode->key_defined && 256U * in[i * 2 + 0] + in[i * 2 + 1] == mode->key_r) *a = 0; in getPixelColorRGBA8()
3777 … unsigned highest = ((1U << mode->bitdepth) - 1U); /*highest possible value for this bit depth*/ in getPixelColorRGBA8()
3778 size_t j = i * mode->bitdepth; in getPixelColorRGBA8()
3779 unsigned value = readBitsFromReversedStream(&j, in, mode->bitdepth); in getPixelColorRGBA8()
3781 if(mode->key_defined && value == mode->key_r) *a = 0; in getPixelColorRGBA8()
3785 else if(mode->colortype == LCT_RGB) { in getPixelColorRGBA8()
3786 if(mode->bitdepth == 8) { in getPixelColorRGBA8()
3790 … if(mode->key_defined && *r == mode->key_r && *g == mode->key_g && *b == mode->key_b) *a = 0; in getPixelColorRGBA8()
3797 if(mode->key_defined && 256U * in[i * 6 + 0] + in[i * 6 + 1] == mode->key_r in getPixelColorRGBA8()
3798 && 256U * in[i * 6 + 2] + in[i * 6 + 3] == mode->key_g in getPixelColorRGBA8()
3799 && 256U * in[i * 6 + 4] + in[i * 6 + 5] == mode->key_b) *a = 0; in getPixelColorRGBA8()
3803 else if(mode->colortype == LCT_PALETTE) { in getPixelColorRGBA8()
3805 if(mode->bitdepth == 8) index = in[i]; in getPixelColorRGBA8()
3807 size_t j = i * mode->bitdepth; in getPixelColorRGBA8()
3808 index = readBitsFromReversedStream(&j, in, mode->bitdepth); in getPixelColorRGBA8()
3811 *r = mode->palette[index * 4 + 0]; in getPixelColorRGBA8()
3812 *g = mode->palette[index * 4 + 1]; in getPixelColorRGBA8()
3813 *b = mode->palette[index * 4 + 2]; in getPixelColorRGBA8()
3814 *a = mode->palette[index * 4 + 3]; in getPixelColorRGBA8()
3816 else if(mode->colortype == LCT_GREY_ALPHA) { in getPixelColorRGBA8()
3817 if(mode->bitdepth == 8) { in getPixelColorRGBA8()
3826 else if(mode->colortype == LCT_RGBA) { in getPixelColorRGBA8()
3827 if(mode->bitdepth == 8) { in getPixelColorRGBA8()
3848 const LodePNGColorMode * mode) in getPixelColorsRGBA8() argument
3852 if(mode->colortype == LCT_GREY) { in getPixelColorsRGBA8()
3853 if(mode->bitdepth == 8) { in getPixelColorsRGBA8()
3858 if(mode->key_defined) { in getPixelColorsRGBA8()
3861 if(buffer[0] == mode->key_r) buffer[3] = 0; in getPixelColorsRGBA8()
3865 else if(mode->bitdepth == 16) { in getPixelColorsRGBA8()
3868 … buffer[3] = mode->key_defined && 256U * in[i * 2 + 0] + in[i * 2 + 1] == mode->key_r ? 0 : 255; in getPixelColorsRGBA8()
3872 … unsigned highest = ((1U << mode->bitdepth) - 1U); /*highest possible value for this bit depth*/ in getPixelColorsRGBA8()
3875 unsigned value = readBitsFromReversedStream(&j, in, mode->bitdepth); in getPixelColorsRGBA8()
3877 buffer[3] = mode->key_defined && value == mode->key_r ? 0 : 255; in getPixelColorsRGBA8()
3881 else if(mode->colortype == LCT_RGB) { in getPixelColorsRGBA8()
3882 if(mode->bitdepth == 8) { in getPixelColorsRGBA8()
3887 if(mode->key_defined) { in getPixelColorsRGBA8()
3890 …if(buffer[0] == mode->key_r && buffer[1] == mode->key_g && buffer[2] == mode->key_b) buffer[3] = 0; in getPixelColorsRGBA8()
3899 buffer[3] = mode->key_defined in getPixelColorsRGBA8()
3900 && 256U * in[i * 6 + 0] + in[i * 6 + 1] == mode->key_r in getPixelColorsRGBA8()
3901 && 256U * in[i * 6 + 2] + in[i * 6 + 3] == mode->key_g in getPixelColorsRGBA8()
3902 && 256U * in[i * 6 + 4] + in[i * 6 + 5] == mode->key_b ? 0 : 255; in getPixelColorsRGBA8()
3906 else if(mode->colortype == LCT_PALETTE) { in getPixelColorsRGBA8()
3907 if(mode->bitdepth == 8) { in getPixelColorsRGBA8()
3911 lodepng_memcpy(buffer, &mode->palette[index * 4], 4); in getPixelColorsRGBA8()
3917 unsigned index = readBitsFromReversedStream(&j, in, mode->bitdepth); in getPixelColorsRGBA8()
3919 lodepng_memcpy(buffer, &mode->palette[index * 4], 4); in getPixelColorsRGBA8()
3923 else if(mode->colortype == LCT_GREY_ALPHA) { in getPixelColorsRGBA8()
3924 if(mode->bitdepth == 8) { in getPixelColorsRGBA8()
3937 else if(mode->colortype == LCT_RGBA) { in getPixelColorsRGBA8()
3938 if(mode->bitdepth == 8) { in getPixelColorsRGBA8()
3955 const LodePNGColorMode * mode) in getPixelColorsRGB8() argument
3959 if(mode->colortype == LCT_GREY) { in getPixelColorsRGB8()
3960 if(mode->bitdepth == 8) { in getPixelColorsRGB8()
3965 else if(mode->bitdepth == 16) { in getPixelColorsRGB8()
3971 … unsigned highest = ((1U << mode->bitdepth) - 1U); /*highest possible value for this bit depth*/ in getPixelColorsRGB8()
3974 unsigned value = readBitsFromReversedStream(&j, in, mode->bitdepth); in getPixelColorsRGB8()
3979 else if(mode->colortype == LCT_RGB) { in getPixelColorsRGB8()
3980 if(mode->bitdepth == 8) { in getPixelColorsRGB8()
3991 else if(mode->colortype == LCT_PALETTE) { in getPixelColorsRGB8()
3992 if(mode->bitdepth == 8) { in getPixelColorsRGB8()
3996 lodepng_memcpy(buffer, &mode->palette[index * 4], 3); in getPixelColorsRGB8()
4002 unsigned index = readBitsFromReversedStream(&j, in, mode->bitdepth); in getPixelColorsRGB8()
4004 lodepng_memcpy(buffer, &mode->palette[index * 4], 3); in getPixelColorsRGB8()
4008 else if(mode->colortype == LCT_GREY_ALPHA) { in getPixelColorsRGB8()
4009 if(mode->bitdepth == 8) { in getPixelColorsRGB8()
4020 else if(mode->colortype == LCT_RGBA) { in getPixelColorsRGB8()
4021 if(mode->bitdepth == 8) { in getPixelColorsRGB8()
4039 const unsigned char * in, size_t i, const LodePNGColorMode * mode) in getPixelColorRGBA16() argument
4041 if(mode->colortype == LCT_GREY) { in getPixelColorRGBA16()
4043 if(mode->key_defined && 256U * in[i * 2 + 0] + in[i * 2 + 1] == mode->key_r) *a = 0; in getPixelColorRGBA16()
4046 else if(mode->colortype == LCT_RGB) { in getPixelColorRGBA16()
4050 if(mode->key_defined in getPixelColorRGBA16()
4051 && 256u * in[i * 6 + 0] + in[i * 6 + 1] == mode->key_r in getPixelColorRGBA16()
4052 && 256u * in[i * 6 + 2] + in[i * 6 + 3] == mode->key_g in getPixelColorRGBA16()
4053 && 256u * in[i * 6 + 4] + in[i * 6 + 5] == mode->key_b) *a = 0; in getPixelColorRGBA16()
4056 else if(mode->colortype == LCT_GREY_ALPHA) { in getPixelColorRGBA16()
4060 else if(mode->colortype == LCT_RGBA) { in getPixelColorRGBA16()
4447 LodePNGColorMode mode; in lodepng_color_stats_add() local
4448 lodepng_color_mode_init(&mode); in lodepng_color_stats_add()
4457 mode.bitdepth = 16; in lodepng_color_stats_add()
4458 mode.colortype = LCT_RGBA; in lodepng_color_stats_add()
4459 error = lodepng_compute_color_stats(stats, image, 1, 1, &mode); in lodepng_color_stats_add()
4460 lodepng_color_mode_cleanup(&mode); in lodepng_color_stats_add()