[devel] Revised contrib/visupng, gregbook, and pngminim

to demonstrate chop_16_to_8
This commit is contained in:
Glenn Randers-Pehrson 2011-06-16 09:08:53 -05:00
parent 5f0b9276ec
commit 850769f787
8 changed files with 27 additions and 5 deletions

View File

@ -217,7 +217,8 @@ Version 1.5.4beta04 [June 16, 2011]
Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c
Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms. Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms.
Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is
not enabled, png_set_strip_16() and png_do_scale_16_to_8 aren't built. not enabled, png_set_strip_16() and png_do_scale_16_to_8() aren't built.
Revised contrib/visupng, gregbook, and pngminim to demonstrate chop_16_to_8
Send comments/corrections/commendations to png-mng-implement at lists.sf.net: Send comments/corrections/commendations to png-mng-implement at lists.sf.net:
(subscription required; visit (subscription required; visit

View File

@ -3480,7 +3480,8 @@ Version 1.5.4beta04 [June 16, 2011]
Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c Added a missing "#ifdef PNG_READ_BACKGROUND_SUPPORTED/#endif" in pngrtran.c
Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms. Added PNG_TRANSFORM_CHOP_16 to the high-level read transforms.
Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is Made PNG_READ_16_TO_8_ACCURATE_SCALE configurable again. If this is
not enabled, png_set_strip_16() and png_do_scale_16_to_8 aren't built. not enabled, png_set_strip_16() and png_do_scale_16_to_8() aren't built.
Revised contrib/visupng, gregbook, and pngminim to demonstrate chop_16_to_8
Send comments/corrections/commendations to png-mng-implement at lists.sf.net Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit (subscription required; visit

View File

@ -229,8 +229,14 @@ uch *readpng_get_image(double display_exponent, int *pChannels, ulg *pRowbytes)
png_set_expand(png_ptr); png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_expand(png_ptr); png_set_expand(png_ptr);
#ifdef PNG_READ_16_TO_8_SUPPORTED
if (bit_depth == 16) if (bit_depth == 16)
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
png_set_chop_16(png_ptr);
# else
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);
# endif
#endif
if (color_type == PNG_COLOR_TYPE_GRAY || if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA) color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr); png_set_gray_to_rgb(png_ptr);

View File

@ -311,8 +311,14 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
png_set_expand(png_ptr); png_set_expand(png_ptr);
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS)) if (png_get_valid(png_ptr, info_ptr, PNG_INFO_tRNS))
png_set_expand(png_ptr); png_set_expand(png_ptr);
#ifdef PNG_READ_16_TO_8_SUPPORTED
if (bit_depth == 16) if (bit_depth == 16)
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
png_set_chop_16(png_ptr);
# else
png_set_strip_16(png_ptr); png_set_strip_16(png_ptr);
# endif
#endif
if (color_type == PNG_COLOR_TYPE_GRAY || if (color_type == PNG_COLOR_TYPE_GRAY ||
color_type == PNG_COLOR_TYPE_GRAY_ALPHA) color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
png_set_gray_to_rgb(png_ptr); png_set_gray_to_rgb(png_ptr);

View File

@ -37,3 +37,4 @@ option SETJMP on
option STDIO on option STDIO on
option READ_EXPAND on option READ_EXPAND on
option READ_16_TO_8 on option READ_16_TO_8 on
option READ_16_TO_8_ACCURATE_SCALE on

View File

@ -37,4 +37,5 @@ option READ_bKGD on
option READ_GAMMA on option READ_GAMMA on
option READ_EXPAND on option READ_EXPAND on
option READ_16_TO_8 on option READ_16_TO_8 on
option READ_CHOP_16_TO_8 on
option READ_GRAY_TO_RGB on option READ_GRAY_TO_RGB on

View File

@ -144,7 +144,7 @@ int main(int argc, char *argv[])
if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE) if (png2pnm (fp_rd, fp_wr, fp_al, raw, alpha) == FALSE)
{ {
fprintf (stderr, "PNG2PNM\n"); fprintf (stderr, "PNG2PNM\n");
fprintf (stderr, "Error: unsuccessful convertion of PNG-image\n"); fprintf (stderr, "Error: unsuccessful conversion of PNG-image\n");
exit(1); exit(1);
} }

View File

@ -175,8 +175,14 @@ BOOL PngLoadImage (PTSTR pstrFileName, png_byte **ppbImageData,
// expand images of all color-type and bit-depth to 3x8 bit RGB images // expand images of all color-type and bit-depth to 3x8 bit RGB images
// let the library process things like alpha, transparency, background // let the library process things like alpha, transparency, background
if (iBitDepth == 16) #ifdef PNG_READ_16_TO_8_SUPPORTED
png_set_strip_16(png_ptr); if (iBitDepth == 16)
# ifdef PNG_READ_CHOP_16_TO_8_SUPPORTED
png_set_chop_16(png_ptr);
# else
png_set_strip_16(png_ptr);
# endif
#endif
if (iColorType == PNG_COLOR_TYPE_PALETTE) if (iColorType == PNG_COLOR_TYPE_PALETTE)
png_set_expand(png_ptr); png_set_expand(png_ptr);
if (iBitDepth < 8) if (iBitDepth < 8)