diff options
author | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2010-04-16 07:24:52 -0500 |
---|---|---|
committer | Glenn Randers-Pehrson <glennrp at users.sourceforge.net> | 2010-04-16 07:24:52 -0500 |
commit | 8dc3729522881e1a8f67dd7e8faa86fa184443aa (patch) | |
tree | 6d9df668a7704b15c458be4b9e86b19d640dfe5e /example.c | |
parent | 7aad4e7fb4536840389bbb6e69e63b7091df64f1 (diff) | |
download | libpng-8dc3729522881e1a8f67dd7e8faa86fa184443aa.tar.gz |
[master] Reenabled png_set_dither() but renamed it to png_set_quantize() to
reflect more accurately what it actually does. At the same time, renamed
the PNG_DITHER_[RED,GREEN_BLUE]_BITS macros to
PNG_QUANTIZE_[RED,GREEN,BLUE]_BITS.
Diffstat (limited to 'example.c')
-rw-r--r-- | example.c | 15 |
1 files changed, 8 insertions, 7 deletions
@@ -160,7 +160,7 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */ * If you have enough memory to read in the entire image at once, * and you need to specify only transforms that can be controlled * with one of the PNG_TRANSFORM_* bits (this presently excludes - * dithering, filling, setting background, and doing gamma + * quantizing, filling, setting background, and doing gamma * adjustment), then you can read the entire image (including * pixels) into the info structure with this call: */ @@ -271,8 +271,8 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */ png_set_gamma(png_ptr, screen_gamma, 0.45455); } -#ifdef PNG_READ_DITHER_SUPPORTED - /* Dither RGB files down to 8 bit palette or reduce palettes +#ifdef PNG_READ_QUANTIZE_SUPPORTED + /* Quantize RGB files down to 8 bit palette or reduce palettes * to the number of colors available on your screen. */ if (color_type & PNG_COLOR_MASK_COLOR) @@ -283,10 +283,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */ /* This reduces the image to the application supplied palette */ if (/* We have our own palette */) { - /* An array of colors to which the image should be dithered */ + /* An array of colors to which the image should be quantized */ png_color std_color_cube[MAX_SCREEN_COLORS]; - png_set_dither(png_ptr, std_color_cube, MAX_SCREEN_COLORS, + /* Prior to libpng-1.4.2, this was png_set_dither(). */ + png_set_quantize(png_ptr, std_color_cube, MAX_SCREEN_COLORS, MAX_SCREEN_COLORS, NULL, 0); } /* This reduces the image to the palette supplied in the file */ @@ -296,11 +297,11 @@ void read_png(FILE *fp, unsigned int sig_read) /* File is already open */ png_get_hIST(png_ptr, info_ptr, &histogram); - png_set_dither(png_ptr, palette, num_palette, + png_set_quantize(png_ptr, palette, num_palette, max_screen_colors, histogram, 0); } } -#endif /* PNG_READ_DITHER_SUPPORTED */ +#endif /* PNG_READ_QUANTIZE_SUPPORTED */ /* Invert monochrome files to have 0 as white and 1 as black */ png_set_invert_mono(png_ptr); |