[devel] Moved the PNG_DIVIDE_* and PNG_*_PREMULTIPLY macros

from png.h to pngpriv.h.
This commit is contained in:
Glenn Randers-Pehrson
2009-11-26 11:48:15 -06:00
parent 5a2015e146
commit b2154ccb2b
4 changed files with 22 additions and 20 deletions

View File

@@ -831,6 +831,25 @@ PNG_EXTERN void png_check_IHDR PNGARG((png_structp png_ptr,
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));