[alpha] Implementing premultiplied alpha, work in progress

Always expand pixels to 16-bit samples when premultiplying.
  In pngconf.h, require PNG_GAMMA_SUPPORTED to be defined when defining
    PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
  Eliminated PNG_DIVIDE_BY_255 and PNG_8_BIT_PREMULTIPLY macros
    leaving only PNG_DIVIDE_BY_65535 and PNG_16_BIT_PREMULTIPLY
    because we will always work with 16 bits.
This commit is contained in:
Glenn Randers-Pehrson
2009-11-28 18:33:19 -06:00
parent 85fbf27733
commit 7aa2927db0
5 changed files with 94 additions and 48 deletions

View File

@@ -1,7 +1,7 @@
/* pngconf.h - machine configurable file for libpng
*
* libpng version 1.4.1alpha02 - November 28, 2009
* libpng version 1.4.1alpha02 - November 29, 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)
@@ -524,7 +524,7 @@
# define PNG_READ_INVERT_ALPHA_SUPPORTED
# endif
# ifndef PNG_NO_READ_PREMULTIPLY_ALPHA
# define PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
# define PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
# endif
# ifndef PNG_NO_READ_STRIP_ALPHA
# define PNG_READ_STRIP_ALPHA_SUPPORTED
@@ -861,6 +861,13 @@
# define PNG_TEXT_SUPPORTED
#endif
# /* Premultiply will not work without gamma support. */
# ifdef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
# ifndef PNG_READ_GAMMA_SUPPORTED
# undef PNG_READ_PREMULTIPLY_ALPHA_SUPPORTED
# endif
# endif
#endif /* PNG_READ_ANCILLARY_CHUNKS_SUPPORTED */
#ifndef PNG_NO_READ_UNKNOWN_CHUNKS