[devel] Removed premultiplied alpha feature.
It will be replaced in the future with a function that accounts for gamma.
diff --git a/ANNOUNCE b/ANNOUNCE
index 879a435..55c0b01 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,5 +1,5 @@
-Libpng 1.4.0beta106 - November 26, 2009
+Libpng 1.4.0beta106 - November 27, 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.
@@ -714,8 +714,8 @@
Changed "/255" to "/255.0" in background calculations to make it clear
that the 255 is used as a double.
-version 1.4.0beta106 [November 26, 2009]
- Moved the PNG_DIVIDE_* and PNG_*_PREMULTIPLY macros from png.h to pngpriv.h.
+version 1.4.0beta106 [November 27, 2009]
+ Removed premultiplied alpha feature.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/CHANGES b/CHANGES
index d65dab6..be744f0 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2401,8 +2401,8 @@
Changed "/255" to "/255.0" in background calculations to make it clear
that the 255 is used as a double.
-version 1.4.0beta106 [November 26, 2009]
- Moved the PNG_DIVIDE_* and PNG_*_PREMULTIPLY macros from png.h to pngpriv.h.
+version 1.4.0beta106 [November 27, 2009]
+ Removed premultiplied alpha feature.
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
(subscription required; visit
diff --git a/libpng-1.4.0beta106.txt b/libpng-1.4.0beta106.txt
index 66913a1..b770d68 100644
--- a/libpng-1.4.0beta106.txt
+++ b/libpng-1.4.0beta106.txt
@@ -1,6 +1,6 @@
libpng.txt - A description on how to use and modify libpng
- libpng version 1.4.0beta106 - November 26, 2009
+ libpng version 1.4.0beta106 - November 27, 2009
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -11,7 +11,7 @@
Based on:
- libpng versions 0.97, January 1998, through 1.4.0beta106 - November 26, 2009
+ libpng versions 0.97, January 1998, through 1.4.0beta106 - November 27, 2009
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -938,15 +938,6 @@
png_set_invert_alpha(png_ptr);
-The PNG format only supports pixels with postmultiplied alpha.
-If you want to replace the pixels, after reading them, with pixels
-that have premultiplied color samples, you can do this with
-
- png_set_premultiply_alpha(png_ptr);
-
-If you do this, any input with a tRNS chunk will be expanded to
-have an alpha channel.
-
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
they can, resulting in, for example, 8 pixels per byte for 1 bit
files. This code expands to 1 pixel per byte without changing the
@@ -3035,9 +3026,6 @@
We added PNG_TRANSFORM_GRAY_TO_RGB to the available high-level
input transforms.
-We added the png_set_premultiply_alpha and
-png_do_read_premultiply_alpha() functions.
-
The call to png_do_chop() in pngrtran.c, which reduces 16-bit input
files to 8-bit bit depth, was relocated ahead of the building
of gamma tables. This allows us to build 8-bit tables instead
@@ -3225,7 +3213,7 @@
XIII. Y2K Compliance in libpng
-November 26, 2009
+November 27, 2009
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
diff --git a/libpng.3 b/libpng.3
index 294cd64..206fa04 100644
--- a/libpng.3
+++ b/libpng.3
@@ -1,4 +1,4 @@
-.TH LIBPNG 3 "November 26, 2009"
+.TH LIBPNG 3 "November 27, 2009"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta106
.SH SYNOPSIS
@@ -566,10 +566,6 @@
\fI\fB
-\fBvoid png_set_premultiply_alpha (png_structp \fIpng_ptr\fP\fB);\fP
-
-\fI\fB
-
\fBvoid png_set_progressive_read_fn (png_structp \fP\fIpng_ptr\fP\fB, png_voidp \fP\fIprogressive_ptr\fP\fB, png_progressive_info_ptr \fP\fIinfo_fn\fP\fB, png_progressive_row_ptr \fP\fIrow_fn\fP\fB, png_progressive_end_ptr \fIend_fn\fP\fB);\fP
\fI\fB
@@ -781,7 +777,7 @@
.SH LIBPNG.TXT
libpng.txt - A description on how to use and modify libpng
- libpng version 1.4.0beta106 - November 26, 2009
+ libpng version 1.4.0beta106 - November 27, 2009
Updated and distributed by Glenn Randers-Pehrson
<glennrp at users.sourceforge.net>
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -792,7 +788,7 @@
Based on:
- libpng versions 0.97, January 1998, through 1.4.0beta106 - November 26, 2009
+ libpng versions 0.97, January 1998, through 1.4.0beta106 - November 27, 2009
Updated and distributed by Glenn Randers-Pehrson
Copyright (c) 1998-2009 Glenn Randers-Pehrson
@@ -1719,15 +1715,6 @@
png_set_invert_alpha(png_ptr);
-The PNG format only supports pixels with postmultiplied alpha.
-If you want to replace the pixels, after reading them, with pixels
-that have premultiplied color samples, you can do this with
-
- png_set_premultiply_alpha(png_ptr);
-
-If you do this, any input with a tRNS chunk will be expanded to
-have an alpha channel.
-
PNG files pack pixels of bit depths 1, 2, and 4 into bytes as small as
they can, resulting in, for example, 8 pixels per byte for 1 bit
files. This code expands to 1 pixel per byte without changing the
@@ -3816,9 +3803,6 @@
We added PNG_TRANSFORM_GRAY_TO_RGB to the available high-level
input transforms.
-We added the png_set_premultiply_alpha and
-png_do_read_premultiply_alpha() functions.
-
The call to png_do_chop() in pngrtran.c, which reduces 16-bit input
files to 8-bit bit depth, was relocated ahead of the building
of gamma tables. This allows us to build 8-bit tables instead
@@ -4006,7 +3990,7 @@
.SH XIII. Y2K Compliance in libpng
-November 26, 2009
+November 27, 2009
Since the PNG Development group is an ad-hoc body, we can't make
an official declaration.
@@ -4238,7 +4222,7 @@
Thanks to Frank J. T. Wojcik for helping with the documentation.
-Libpng version 1.4.0beta106 - November 26, 2009:
+Libpng version 1.4.0beta106 - November 27, 2009:
Initially created in 1995 by Guy Eric Schalnat, then of Group 42, Inc.
Currently maintained by Glenn Randers-Pehrson (glennrp at users.sourceforge.net).
@@ -4261,7 +4245,7 @@
This code is released under the libpng license.
-libpng versions 1.2.6, August 15, 2004, through 1.4.0beta106, November 26, 2009, are
+libpng versions 1.2.6, August 15, 2004, through 1.4.0beta106, November 27, 2009, are
Copyright (c) 2004,2006-2007 Glenn Randers-Pehrson, and are
distributed according to the same disclaimer and license as libpng-1.2.5
with the following individual added to the list of Contributing Authors
@@ -4360,7 +4344,7 @@
Glenn Randers-Pehrson
glennrp at users.sourceforge.net
-November 26, 2009
+November 27, 2009
.\" end of man page
diff --git a/libpngpf.3 b/libpngpf.3
index acd1f84..2ef7adf 100644
--- a/libpngpf.3
+++ b/libpngpf.3
@@ -1,4 +1,4 @@
-.TH LIBPNGPF 3 "November 26, 2009"
+.TH LIBPNGPF 3 "November 27, 2009"
.SH NAME
libpng \- Portable Network Graphics (PNG) Reference Library 1.4.0beta106
(private functions)
@@ -211,10 +211,6 @@
\fI\fB
-\fBvoid png_do_read_premultiply_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
-
-\fI\fB
-
\fBvoid png_do_read_swap_alpha (png_row_infop \fP\fIrow_info\fP\fB, png_bytep \fIrow\fP\fB);\fP
\fI\fB
diff --git a/png.c b/png.c
index 06e2686..0e711f5 100644
--- a/png.c
+++ b/png.c
@@ -1,7 +1,7 @@
/* png.c - location for general purpose libpng functions
*
- * Last changed in libpng 1.4.0 [November 26, 2009]
+ * Last changed in libpng 1.4.0 [November 27, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -547,13 +547,13 @@
#else
#ifdef __STDC__
return ((png_charp) PNG_STRING_NEWLINE \
- "libpng version 1.4.0beta106 - November 26, 2009" PNG_STRING_NEWLINE \
+ "libpng version 1.4.0beta106 - November 27, 2009" PNG_STRING_NEWLINE \
"Copyright (c) 1998-2009 Glenn Randers-Pehrson" PNG_STRING_NEWLINE \
"Copyright (c) 1996-1997 Andreas Dilger" PNG_STRING_NEWLINE \
"Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc." \
PNG_STRING_NEWLINE);
#else
- return ((png_charp) "libpng version 1.4.0beta106 - November 26, 2009\
+ return ((png_charp) "libpng version 1.4.0beta106 - November 27, 2009\
Copyright (c) 1998-2009 Glenn Randers-Pehrson\
Copyright (c) 1996-1997 Andreas Dilger\
Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.");
diff --git a/png.h b/png.h
index a44c363..83051db 100644
--- a/png.h
+++ b/png.h
@@ -1,7 +1,7 @@
/* png.h - header file for PNG reference library
*
- * libpng version 1.4.0beta106 - November 26, 2009
+ * libpng version 1.4.0beta106 - November 27, 2009
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -11,7 +11,7 @@
* Authors and maintainers:
* libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
* libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger
- * libpng versions 0.97, January 1998, through 1.4.0beta106 - November 26, 2009: Glenn
+ * libpng versions 0.97, January 1998, through 1.4.0beta106 - November 27, 2009: Glenn
* See also "Contributing Authors", below.
*
* Note about libpng version numbers:
@@ -131,7 +131,7 @@
* 1.4.0beta15-36 14 10400 14.so.0.0[.0]
* 1.4.0beta37-87 14 10400 14.so.14.0[.0]
* 1.4.0rc01 14 10400 14.so.14.0[.0]
- * 1.4.0beta88-105 14 10400 14.so.14.0[.0]
+ * 1.4.0beta88-106 14 10400 14.so.14.0[.0]
*
* Henceforth the source version will match the shared-library major
* and minor numbers; the shared-library major version number will be
@@ -163,7 +163,7 @@
*
* This code is released under the libpng license.
*
- * libpng versions 1.2.6, August 15, 2004, through 1.4.0beta106, November 26, 2009, are
+ * libpng versions 1.2.6, August 15, 2004, through 1.4.0beta106, November 27, 2009, are
* Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are
* distributed according to the same disclaimer and license as libpng-1.2.5
* with the following individual added to the list of Contributing Authors:
@@ -339,7 +339,7 @@
/* Version information for png.h - this should match the version in png.c */
#define PNG_LIBPNG_VER_STRING "1.4.0beta106"
#define PNG_HEADER_VERSION_STRING \
- " libpng version 1.4.0beta106 - November 26, 2009\n"
+ " libpng version 1.4.0beta106 - November 27, 2009\n"
#define PNG_LIBPNG_VER_SONUM 14
#define PNG_LIBPNG_VER_DLLNUM 14
@@ -1523,11 +1523,6 @@
extern PNG_EXPORT(void,png_set_invert_alpha) PNGARG((png_structp png_ptr));
#endif
-#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
-extern PNG_EXPORT(void,png_set_premultiply_alpha)
- PNGARG((png_structp png_ptr));
-#endif
-
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
/* Add a filler byte to 8-bit Gray or 24-bit RGB images. */
extern PNG_EXPORT(void,png_set_filler) PNGARG((png_structp png_ptr,
diff --git a/pngconf.h b/pngconf.h
index 256030e..ca6f37a 100644
--- a/pngconf.h
+++ b/pngconf.h
@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
- * libpng version 1.4.0beta106 - November 26, 2009
+ * libpng version 1.4.0beta106 - November 27, 2009
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -523,9 +523,6 @@
# ifndef PNG_NO_READ_INVERT_ALPHA
# define PNG_READ_INVERT_ALPHA_SUPPORTED
# endif
-# ifndef PNG_NO_READ_PREMULTIPLY_ALPHA
-# define PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
-# endif
# ifndef PNG_NO_READ_STRIP_ALPHA
# define PNG_READ_STRIP_ALPHA_SUPPORTED
# endif
diff --git a/pngpriv.h b/pngpriv.h
index f120a65..d35a313 100644
--- a/pngpriv.h
+++ b/pngpriv.h
@@ -1,7 +1,7 @@
/* pngpriv.h - private declarations for use inside libpng
*
- * libpng version 1.4.0beta106 - November 26, 2009
+ * libpng version 1.4.0beta106 - November 27, 2009
* For conditions of distribution and use, see copyright notice in png.h
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
@@ -127,8 +127,7 @@
/* 0x800000L Unused */
#define PNG_ADD_ALPHA 0x1000000L /* Added to libpng-1.2.7 */
#define PNG_EXPAND_tRNS 0x2000000L /* Added to libpng-1.2.9 */
-#define PNG_PREMULTIPLY_ALPHA 0x4000000L /* Added to libpng-1.4.0 */
- /* by volker */
+ /* 0x4000000L unused */
/* 0x8000000L unused */
/* 0x10000000L unused */
/* 0x20000000L unused */
@@ -552,11 +551,6 @@
png_bytep row, png_uint_32 flags));
#endif
-#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
-PNG_EXTERN void png_do_read_premultiply_alpha
- PNGARG((png_row_infop row_info, png_bytep row));
-#endif
-
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
PNG_EXTERN void png_do_swap PNGARG((png_row_infop row_info, png_bytep row));
#endif
@@ -831,25 +825,6 @@
int color_type, int interlace_type, int compression_type,
int filter_type));
-#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
-# ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
-# define PNG_DIVIDE_BY_255(v) \
- ((png_byte)(((png_uint_16)(v) + \
- (((png_uint_16)(v) + 128) >> 8) + 128) >> 8))
-# define PNG_DIVIDE_BY_65535(v) \
- ((png_byte)(((png_uint_32)(v) + \
- (((png_uint_32)(v) + 32768L) >> 16) + 32768L) >> 16))
-# else
-# define PNG_DIVIDE_BY_255(v) (((png_uint_16)(v))/255)
-# define PNG_DIVIDE_BY_65535(v) (((png_uint_32)(v))/65535L)
-# endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */
-
-# define PNG_8_BIT_PREMULTIPLY(color,alpha) \
- PNG_DIVIDE_BY_255((color)*(alpha))
-# define PNG_16_BIT_PREMULTIPLY(color,alpha)\
- PNG_DIVIDE_BY_65535((color)*(alpha))
-#endif /* PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED */
-
/* Free all memory used by the read (old method - NOT DLL EXPORTED) */
extern void png_read_destroy PNGARG((png_structp png_ptr, png_infop info_ptr,
png_infop end_info_ptr));
diff --git a/pngread.c b/pngread.c
index 96b844f..40cdf50 100644
--- a/pngread.c
+++ b/pngread.c
@@ -1,7 +1,7 @@
/* pngread.c - read a PNG file
*
- * Last changed in libpng 1.4.0 [November 26, 2009]
+ * Last changed in libpng 1.4.0 [November 27, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -426,23 +426,6 @@
png_warning(png_ptr,
"Ignoring extra png_read_update_info() call; row buffer not reallocated");
-#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
- if (png_ptr->transformations & PNG_PREMULTIPLY_ALPHA)
- {
- /* TO DO:
- * Check for linear colorspace and if not, issue a warning.
- * If gAMA is present with gamma == 1.0, it's linear.
- * If iCCP is present, assume user knows what they are doing
- * and it's linear.
- * If gAMA is present with gamma != 1.0, it's not linear.
- * If no gAMA or iCCP, assume not linear.
- * If not linear do:
- * png_warning(png_ptr,
- * "Premultiply should only be used with gamma == 1.0");
- */
- }
-#endif
-
png_read_transform_info(png_ptr, info_ptr);
}
diff --git a/pngrtran.c b/pngrtran.c
index fd68d06..2289c23 100644
--- a/pngrtran.c
+++ b/pngrtran.c
@@ -1,7 +1,7 @@
/* pngrtran.c - transforms the data in a row for PNG readers
*
- * Last changed in libpng 1.4.0 [November 26, 2009]
+ * Last changed in libpng 1.4.0 [November 27, 2009]
* Copyright (c) 1998-2009 Glenn Randers-Pehrson
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
@@ -140,22 +140,6 @@
}
#endif
-#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
-void PNGAPI
-png_set_premultiply_alpha(png_structp png_ptr)
-{
- png_debug(1, "in png_set_premultiply_alpha");
-
- if(png_ptr == NULL)
- return;
- png_ptr->transformations |=
- (PNG_PREMULTIPLY_ALPHA | PNG_EXPAND_tRNS);
- png_ptr->transformations |=
- PNG_EXPAND; /* This shouldn't be necessary */
- png_ptr->flags &= ~PNG_FLAG_ROW_INIT;
-}
-#endif
-
#ifdef PNG_READ_DITHER_SUPPORTED
/* Dither file to 8 bit. Supply a palette, the current number
* of elements in the palette, the maximum number of elements
@@ -1508,12 +1492,6 @@
(png_uint_32)png_ptr->filler, png_ptr->flags);
#endif
-#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
- if (png_ptr->transformations & PNG_PREMULTIPLY_ALPHA)
- png_do_read_premultiply_alpha(&(png_ptr->row_info),
- png_ptr->row_buf + 1);
-#endif
-
#ifdef PNG_READ_INVERT_ALPHA_SUPPORTED
if (png_ptr->transformations & PNG_INVERT_ALPHA)
png_do_read_invert_alpha(&(png_ptr->row_info), png_ptr->row_buf + 1);
@@ -2000,84 +1978,6 @@
}
#endif
-#ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
-void /* PRIVATE */
-png_do_read_premultiply_alpha(png_row_infop row_info, png_bytep row)
-{
- png_debug(1, "in png_do_read_premultiply_alpha");
-
- {
- png_uint_32 row_width = row_info->width;
- if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
- {
- /* This premultiplies the pixels with the alpha channel in RGBA */
- if (row_info->bit_depth == 8)
- {
- png_bytep sp = row + row_info->rowbytes;
- png_bytep dp = sp;
- png_uint_16 a = 0;
- png_uint_32 i;
-
- for (i = 0; i < row_width; i++)
- {
- a = *(--sp); --dp;
- sp--; *(--dp) = PNG_8_BIT_PREMULTIPLY((*sp), a);
- sp--; *(--dp) = PNG_8_BIT_PREMULTIPLY((*sp), a);
- sp--; *(--dp) = PNG_8_BIT_PREMULTIPLY((*sp), a);
- }
- }
- /* This premultiplies the pixels with the alpha channel in RRGGBBAA */
- else
- {
- png_uint_16p sp = (png_uint_16p)(row + row_info->rowbytes);
- png_uint_16p dp = sp;
- png_uint_32 a = 0;
- png_uint_32 i;
-
- for (i = 0; i < row_width; i++)
- {
- a = *(--sp); --dp;
- sp--; *(--dp) = PNG_16_BIT_PREMULTIPLY((*sp), a);
- sp--; *(--dp) = PNG_16_BIT_PREMULTIPLY((*sp), a);
- sp--; *(--dp) = PNG_16_BIT_PREMULTIPLY((*sp), a);
- }
- }
- }
- else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
- {
- /* This premultiplies the pixels with the alpha channel in GA */
- if (row_info->bit_depth == 8)
- {
- png_bytep sp = row + row_info->rowbytes;
- png_bytep dp = sp;
- png_uint_16 a = 0;
- png_uint_32 i;
-
- for (i = 0; i < row_width; i++)
- {
- a = *(--sp); --dp;
- sp--; *(--dp) = PNG_8_BIT_PREMULTIPLY((*sp), a);
- }
- }
- /* This premultiplies the pixels with the alpha channel in GGAA */
- else
- {
- png_uint_16p sp = (png_uint_16p) (row + row_info->rowbytes);
- png_uint_16p dp = sp;
- png_uint_32 a = 0;
- png_uint_32 i;
-
- for (i = 0; i < row_width; i++)
- {
- a = *(--sp); --dp;
- sp--; *(--dp) = PNG_16_BIT_PREMULTIPLY((*sp), a);
- }
- }
- }
- }
-}
-#endif
-
#ifdef PNG_READ_FILLER_SUPPORTED
/* Add filler channel if we have RGB color */
void /* PRIVATE */