summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2009-05-13 07:33:22 -0500
committerGlenn Randers-Pehrson <glennrp at users.sourceforge.net>2009-05-13 07:33:22 -0500
commit640b7d514d229f75d647272597b4da2113390bb9 (patch)
tree906113a64acbcc2574b5e678e4907fdb23c39c41
parentd603c893973700d4116ef7784eaa933f0098d28f (diff)
downloadlibpng-640b7d514d229f75d647272597b4da2113390bb9.tar.gz
Merged example.c with libpng-1.2.37beta01
(from the git master branch)
-rw-r--r--ANNOUNCE5
-rw-r--r--CHANGES3
-rw-r--r--example.c17
3 files changed, 15 insertions, 10 deletions
diff --git a/ANNOUNCE b/ANNOUNCE
index 06722cafa..74d98d763 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
-Libpng 1.4.0beta58 - May 3, 2009
+Libpng 1.4.0beta58 - May 13, 2009
This is not intended to be a public release. It will be replaced
within a few weeks by a public version or by another test version.
@@ -442,9 +442,10 @@ version 1.4.0beta57 [May 2, 2009]
Rebuilt configure scripts with autoconf-2.63 instead of 2.62
Removed pngprefs.h and MMX from makefiles
-version 1.4.0beta58 [May 3, 2009]
+version 1.4.0beta58 [May 13, 2009]
Changed pngw32.def to pngwin.def in makefile.mingw (typo was intruduced
in beta57).
+ Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
version 1.4.0betaN [future]
Build shared libraries with -lz and sometimes -lm.
diff --git a/CHANGES b/CHANGES
index 0617664c9..49cccb171 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2119,9 +2119,10 @@ version 1.4.0beta57 [May 2, 2009]
Rebuilt configure scripts with autoconf-2.63 instead of 2.62
Removed pngprefs.h and MMX from makefiles
-version 1.4.0beta58 [May 3, 2009]
+version 1.4.0beta58 [May 13, 2009]
Changed pngw32.def to pngwin.def in makefile.mingw (typo was intruduced
in beta57).
+ Clarified usage of sig_bit versus sig_bit_p in example.c (Vincent Torri)
version 1.4.0betaN [future]
Build shared libraries with -lz and sometimes -lm.
diff --git a/example.c b/example.c
index bd3a9740a..b15ab2728 100644
--- a/example.c
+++ b/example.c
@@ -2,7 +2,7 @@
#if 0 /* in case someone actually tries to compile this */
/* example.c - an example of using libpng
- * Last changed in libpng 1.4.0 [May 3, 2009]
+ * Last changed in libpng 1.4.0 [May 13, 2009]
* This file has been placed in the public domain by the authors.
* Maintained 1998-2009 Glenn Randers-Pehrson
* Maintained 1996, 1997 Andreas Dilger)
@@ -306,10 +306,10 @@ void read_png(FILE *fp, unsigned int sig_read) /* file is already open */
*/
if (png_get_valid(png_ptr, info_ptr, PNG_INFO_sBIT))
{
- png_color_8p sig_bit;
+ png_color_8p sig_bit_p;
- png_get_sBIT(png_ptr, info_ptr, &sig_bit);
- png_set_shift(png_ptr, sig_bit);
+ png_get_sBIT(png_ptr, info_ptr, &sig_bit_p);
+ png_set_shift(png_ptr, sig_bit_p);
}
/* flip the RGB pixels to BGR (or RGBA to BGRA) */
@@ -647,6 +647,7 @@ void write_png(char *file_name /* , ... other image information ... */)
the png structure. */
/* optional significant bit chunk */
+ png_color_8 sig_bit;
/* if we are dealing with a grayscale image then */
sig_bit.gray = true_bit_depth;
/* otherwise, if we are dealing with a color image then */
@@ -655,7 +656,7 @@ void write_png(char *file_name /* , ... other image information ... */)
sig_bit.blue = true_blue_bit_depth;
/* if the image has an alpha channel then */
sig_bit.alpha = true_alpha_bit_depth;
- png_set_sBIT(png_ptr, info_ptr, sig_bit);
+ png_set_sBIT(png_ptr, info_ptr, &sig_bit);
/* Optional gamma chunk is strongly suggested if you have any guess
@@ -680,9 +681,11 @@ void write_png(char *file_name /* , ... other image information ... */)
#endif
png_set_text(png_ptr, info_ptr, text_ptr, 3);
- /* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs, */
+ /* other optional chunks like cHRM, bKGD, tRNS, tIME, oFFs, pHYs */
+
/* note that if sRGB is present the gAMA and cHRM chunks must be ignored
- * on read and should be written in accordance with the sRGB profile */
+ * on read and, if your application chooses to write them, they must
+ * be written in accordance with the sRGB profile */
/* Write the file header information. REQUIRED */
png_write_info(png_ptr, info_ptr);