mirror of
https://git.code.sf.net/p/libpng/code.git
synced 2025-07-10 18:04:09 +02:00
[devel] Moved the PNG_DIVIDE_* and PNG_*_PREMULTIPLY macros
from png.h to pngpriv.h.
This commit is contained in:
19
pngpriv.h
19
pngpriv.h
@@ -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));
|
||||
|
||||
Reference in New Issue
Block a user