1-
21/* png.h - header file for PNG reference library
32 *
4- * libpng version 1.6.38 - September 14, 2022
3+ * libpng version 1.6.47
54 *
6- * Copyright (c) 2018-2022 Cosmin Truta
5+ * Copyright (c) 2018-2025 Cosmin Truta
76 * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson
87 * Copyright (c) 1996-1997 Andreas Dilger
98 * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
1514 * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
1615 * libpng versions 0.97, January 1998, through 1.6.35, July 2018:
1716 * Glenn Randers-Pehrson
18- * libpng versions 1.6.36, December 2018, through 1.6.38, September 2022 :
17+ * libpng versions 1.6.36, December 2018, through 1.6.47, February 2025 :
1918 * Cosmin Truta
2019 * See also "Contributing Authors", below.
2120 */
2726 * PNG Reference Library License version 2
2827 * ---------------------------------------
2928 *
30- * * Copyright (c) 1995-2022 The PNG Reference Library Authors.
31- * * Copyright (c) 2018-2022 Cosmin Truta.
29+ * * Copyright (c) 1995-2025 The PNG Reference Library Authors.
30+ * * Copyright (c) 2018-2025 Cosmin Truta.
3231 * * Copyright (c) 2000-2002, 2004, 2006-2018 Glenn Randers-Pehrson.
3332 * * Copyright (c) 1996-1997 Andreas Dilger.
3433 * * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
239238 * ...
240239 * 1.5.30 15 10530 15.so.15.30[.0]
241240 * ...
242- * 1.6.38 16 10638 16.so.16.38 [.0]
241+ * 1.6.47 16 10647 16.so.16.47 [.0]
243242 *
244243 * Henceforth the source version will match the shared-library major and
245244 * minor numbers; the shared-library major version number will be used for
255254 * to the info_ptr or png_ptr members through png.h, and the compiled
256255 * application is loaded with a different version of the library.
257256 *
258- * DLLNUM will change each time there are forward or backward changes
259- * in binary compatibility (e.g., when a new feature is added).
260- *
261257 * See libpng.txt or libpng.3 for more information. The PNG specification
262258 * is available as a W3C Recommendation and as an ISO/IEC Standard; see
263259 * <https://www.w3.org/TR/2003/REC-PNG-20031110/>
278274 */
279275
280276/* Version information for png.h - this should match the version in png.c */
281- #define PNG_LIBPNG_VER_STRING "1.6.38 "
282- #define PNG_HEADER_VERSION_STRING " libpng version 1.6.38 - September 14, 2022 \n"
277+ #define PNG_LIBPNG_VER_STRING "1.6.47 "
278+ #define PNG_HEADER_VERSION_STRING " libpng version " PNG_LIBPNG_VER_STRING " \n"
283279
284- #define PNG_LIBPNG_VER_SONUM 16
285- #define PNG_LIBPNG_VER_DLLNUM 16
280+ /* The versions of shared library builds should stay in sync, going forward */
281+ #define PNG_LIBPNG_VER_SHAREDLIB 16
282+ #define PNG_LIBPNG_VER_SONUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
283+ #define PNG_LIBPNG_VER_DLLNUM PNG_LIBPNG_VER_SHAREDLIB /* [Deprecated] */
286284
287285/* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
288286#define PNG_LIBPNG_VER_MAJOR 1
289287#define PNG_LIBPNG_VER_MINOR 6
290- #define PNG_LIBPNG_VER_RELEASE 38
288+ #define PNG_LIBPNG_VER_RELEASE 47
291289
292290/* This should be zero for a public release, or non-zero for a
293- * development version. [Deprecated]
291+ * development version.
294292 */
295- #define PNG_LIBPNG_VER_BUILD 0
293+ #define PNG_LIBPNG_VER_BUILD 0
296294
297295/* Release Status */
298- #define PNG_LIBPNG_BUILD_ALPHA 1
299- #define PNG_LIBPNG_BUILD_BETA 2
300- #define PNG_LIBPNG_BUILD_RC 3
301- #define PNG_LIBPNG_BUILD_STABLE 4
296+ #define PNG_LIBPNG_BUILD_ALPHA 1
297+ #define PNG_LIBPNG_BUILD_BETA 2
298+ #define PNG_LIBPNG_BUILD_RC 3
299+ #define PNG_LIBPNG_BUILD_STABLE 4
302300#define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
303301
304302/* Release-Specific Flags */
318316 * From version 1.0.1 it is:
319317 * XXYYZZ, where XX=major, YY=minor, ZZ=release
320318 */
321- #define PNG_LIBPNG_VER 10638 /* 1.6.38 */
319+ #define PNG_LIBPNG_VER 10647 /* 1.6.47 */
322320
323321/* Library configuration: these options cannot be changed after
324322 * the library has been built.
@@ -428,7 +426,7 @@ extern "C" {
428426/* This triggers a compiler error in png.c, if png.c and png.h
429427 * do not agree upon the version number.
430428 */
431- typedef char * png_libpng_version_1_6_38 ;
429+ typedef char * png_libpng_version_1_6_47 ;
432430
433431/* Basic control structions. Read libpng-manual.txt or libpng.3 for more info.
434432 *
@@ -746,6 +744,21 @@ typedef png_unknown_chunk * * png_unknown_chunkpp;
746744#define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */
747745#define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */
748746#define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
747+ #define PNG_INFO_cICP 0x20000U /* PNGv3: 1.6.45 */
748+ #define PNG_INFO_cLLI 0x40000U /* PNGv3: 1.6.45 */
749+ #define PNG_INFO_mDCV 0x80000U /* PNGv3: 1.6.45 */
750+ /* APNG: these chunks are stored as unknown, these flags are never set
751+ * however they are provided as a convenience for implementors of APNG and
752+ * avoids any merge conflicts.
753+ *
754+ * Private chunks: these chunk names violate the chunk name recommendations
755+ * because the chunk definitions have no signature and because the private
756+ * chunks with these names have been reserved. Private definitions should
757+ * avoid them.
758+ */
759+ #define PNG_INFO_acTL 0x100000U /* PNGv3: 1.6.45: unknown */
760+ #define PNG_INFO_fcTL 0x200000U /* PNGv3: 1.6.45: unknown */
761+ #define PNG_INFO_fdAT 0x400000U /* PNGv3: 1.6.45: unknown */
749762
750763/* This is used for the transformation routines, as some of them
751764 * change these values for the row. It also should enable using
@@ -825,7 +838,7 @@ typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp,
825838 * your compiler. This may be very difficult - try using a different compiler
826839 * to build the library!
827840 */
828- PNG_FUNCTION (void , (PNGCAPI * png_longjmp_ptr ), PNGARG (( jmp_buf , int ) ), typedef );
841+ PNG_FUNCTION (void , (PNGCAPI * png_longjmp_ptr ), ( jmp_buf , int ), typedef );
829842#endif
830843
831844/* Transform masks for the high-level interface */
@@ -849,7 +862,7 @@ PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef);
849862#define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */
850863/* Added to libpng-1.5.4 */
851864#define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */
852- #if INT_MAX >= 0x8000 /* else this might break */
865+ #if ~ 0U > 0xffffU /* or else this might break on a 16-bit machine */
853866#define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */
854867#endif
855868
@@ -908,15 +921,15 @@ PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes));
908921/* Check sig[start] through sig[start + num_to_check - 1] to see if it's a
909922 * PNG file. Returns zero if the supplied bytes match the 8-byte PNG
910923 * signature, and non-zero otherwise. Having num_to_check == 0 or
911- * start > 7 will always fail (ie return non-zero).
924+ * start > 7 will always fail (i.e. return non-zero).
912925 */
913926PNG_EXPORT (3 , int , png_sig_cmp , (png_const_bytep sig , size_t start ,
914927 size_t num_to_check ));
915928
916929/* Simple signature checking function. This is the same as calling
917- * png_check_sig(sig, n) := ! png_sig_cmp(sig, 0, n).
930+ * png_check_sig(sig, n) := ( png_sig_cmp(sig, 0, n) == 0 ).
918931 */
919- #define png_check_sig (sig , n ) ! png_sig_cmp((sig), 0, (n))
932+ #define png_check_sig (sig , n ) ( png_sig_cmp((sig), 0, (n)) == 0) /* DEPRECATED */
920933
921934/* Allocate and initialize png_ptr struct for reading, and any other memory. */
922935PNG_EXPORTA (4 , png_structp , png_create_read_struct ,
@@ -1730,12 +1743,9 @@ PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr));
17301743PNG_EXPORT (98 , void , png_free_data , (png_const_structrp png_ptr ,
17311744 png_inforp info_ptr , png_uint_32 free_me , int num ));
17321745
1733- /* Reassign responsibility for freeing existing data, whether allocated
1746+ /* Reassign the responsibility for freeing existing data, whether allocated
17341747 * by libpng or by the application; this works on the png_info structure passed
1735- * in, it does not change the state for other png_info structures.
1736- *
1737- * It is unlikely that this function works correctly as of 1.6.0 and using it
1738- * may result either in memory leaks or double free of allocated data.
1748+ * in, without changing the state for other png_info structures.
17391749 */
17401750PNG_EXPORT (99 , void , png_data_freer , (png_const_structrp png_ptr ,
17411751 png_inforp info_ptr , int freer , png_uint_32 mask ));
@@ -1978,6 +1988,46 @@ PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
19781988 png_fixed_point int_blue_Z ))
19791989#endif
19801990
1991+ #ifdef PNG_cICP_SUPPORTED
1992+ PNG_EXPORT (250 , png_uint_32 , png_get_cICP , (png_const_structrp png_ptr ,
1993+ png_const_inforp info_ptr , png_bytep colour_primaries ,
1994+ png_bytep transfer_function , png_bytep matrix_coefficients ,
1995+ png_bytep video_full_range_flag ));
1996+ #endif
1997+
1998+ #ifdef PNG_cICP_SUPPORTED
1999+ PNG_EXPORT (251 , void , png_set_cICP , (png_const_structrp png_ptr ,
2000+ png_inforp info_ptr , png_byte colour_primaries ,
2001+ png_byte transfer_function , png_byte matrix_coefficients ,
2002+ png_byte video_full_range_flag ));
2003+ #endif
2004+
2005+ #ifdef PNG_cLLI_SUPPORTED
2006+ PNG_FP_EXPORT (252 , png_uint_32 , png_get_cLLI , (png_const_structrp png_ptr ,
2007+ png_const_inforp info_ptr , double * maximum_content_light_level ,
2008+ double * maximum_frame_average_light_level ))
2009+ PNG_FIXED_EXPORT (253 , png_uint_32 , png_get_cLLI_fixed ,
2010+ (png_const_structrp png_ptr , png_const_inforp info_ptr ,
2011+ /* The values below are in cd/m2 (nits) and are scaled by 10,000; not
2012+ * 100,000 as in the case of png_fixed_point.
2013+ */
2014+ png_uint_32p maximum_content_light_level_scaled_by_10000 ,
2015+ png_uint_32p maximum_frame_average_light_level_scaled_by_10000 ))
2016+ #endif
2017+
2018+ #ifdef PNG_cLLI_SUPPORTED
2019+ PNG_FP_EXPORT (254 , void , png_set_cLLI , (png_const_structrp png_ptr ,
2020+ png_inforp info_ptr , double maximum_content_light_level ,
2021+ double maximum_frame_average_light_level ))
2022+ PNG_FIXED_EXPORT (255 , void , png_set_cLLI_fixed , (png_const_structrp png_ptr ,
2023+ png_inforp info_ptr ,
2024+ /* The values below are in cd/m2 (nits) and are scaled by 10,000; not
2025+ * 100,000 as in the case of png_fixed_point.
2026+ */
2027+ png_uint_32 maximum_content_light_level_scaled_by_10000 ,
2028+ png_uint_32 maximum_frame_average_light_level_scaled_by_10000 ))
2029+ #endif
2030+
19812031#ifdef PNG_eXIf_SUPPORTED
19822032PNG_EXPORT (246 , png_uint_32 , png_get_eXIf , (png_const_structrp png_ptr ,
19832033 png_inforp info_ptr , png_bytep * exif ));
@@ -2022,6 +2072,60 @@ PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr,
20222072 int color_type , int interlace_method , int compression_method ,
20232073 int filter_method ));
20242074
2075+ #ifdef PNG_mDCV_SUPPORTED
2076+ PNG_FP_EXPORT (256 , png_uint_32 , png_get_mDCV , (png_const_structrp png_ptr ,
2077+ png_const_inforp info_ptr ,
2078+ /* The chromaticities of the mastering display. As cHRM, but independent of
2079+ * the encoding endpoints in cHRM, or cICP, or iCCP. These values will
2080+ * always be in the range 0 to 1.3107.
2081+ */
2082+ double * white_x , double * white_y , double * red_x , double * red_y ,
2083+ double * green_x , double * green_y , double * blue_x , double * blue_y ,
2084+ /* Mastering display luminance in cd/m2 (nits). */
2085+ double * mastering_display_maximum_luminance ,
2086+ double * mastering_display_minimum_luminance ))
2087+
2088+ PNG_FIXED_EXPORT (257 , png_uint_32 , png_get_mDCV_fixed ,
2089+ (png_const_structrp png_ptr , png_const_inforp info_ptr ,
2090+ png_fixed_point * int_white_x , png_fixed_point * int_white_y ,
2091+ png_fixed_point * int_red_x , png_fixed_point * int_red_y ,
2092+ png_fixed_point * int_green_x , png_fixed_point * int_green_y ,
2093+ png_fixed_point * int_blue_x , png_fixed_point * int_blue_y ,
2094+ /* Mastering display luminance in cd/m2 (nits) multiplied (scaled) by
2095+ * 10,000.
2096+ */
2097+ png_uint_32p mastering_display_maximum_luminance_scaled_by_10000 ,
2098+ png_uint_32p mastering_display_minimum_luminance_scaled_by_10000 ))
2099+ #endif
2100+
2101+ #ifdef PNG_mDCV_SUPPORTED
2102+ PNG_FP_EXPORT (258 , void , png_set_mDCV , (png_const_structrp png_ptr ,
2103+ png_inforp info_ptr ,
2104+ /* The chromaticities of the mastering display. As cHRM, but independent of
2105+ * the encoding endpoints in cHRM, or cICP, or iCCP.
2106+ */
2107+ double white_x , double white_y , double red_x , double red_y , double green_x ,
2108+ double green_y , double blue_x , double blue_y ,
2109+ /* Mastering display luminance in cd/m2 (nits). */
2110+ double mastering_display_maximum_luminance ,
2111+ double mastering_display_minimum_luminance ))
2112+
2113+ PNG_FIXED_EXPORT (259 , void , png_set_mDCV_fixed , (png_const_structrp png_ptr ,
2114+ png_inforp info_ptr ,
2115+ /* The admissible range of these values is not the full range of a PNG
2116+ * fixed point value. Negative values cannot be encoded and the maximum
2117+ * value is about 1.3 */
2118+ png_fixed_point int_white_x , png_fixed_point int_white_y ,
2119+ png_fixed_point int_red_x , png_fixed_point int_red_y ,
2120+ png_fixed_point int_green_x , png_fixed_point int_green_y ,
2121+ png_fixed_point int_blue_x , png_fixed_point int_blue_y ,
2122+ /* These are PNG unsigned 4 byte values: 31-bit unsigned values. The MSB
2123+ * must be zero.
2124+ */
2125+ png_uint_32 mastering_display_maximum_luminance_scaled_by_10000 ,
2126+ png_uint_32 mastering_display_minimum_luminance_scaled_by_10000 ))
2127+ #endif
2128+
20252129#ifdef PNG_oFFs_SUPPORTED
20262130PNG_EXPORT (145 , png_uint_32 , png_get_oFFs , (png_const_structrp png_ptr ,
20272131 png_const_inforp info_ptr , png_int_32 * offset_x , png_int_32 * offset_y ,
@@ -3207,11 +3311,18 @@ PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory,
32073311#ifdef PNG_MIPS_MSA_API_SUPPORTED
32083312# define PNG_MIPS_MSA 6 /* HARDWARE: MIPS Msa SIMD instructions supported */
32093313#endif
3210- #define PNG_IGNORE_ADLER32 8
3314+ #ifdef PNG_DISABLE_ADLER32_CHECK_SUPPORTED
3315+ # define PNG_IGNORE_ADLER32 8 /* SOFTWARE: disable Adler32 check on IDAT */
3316+ #endif
32113317#ifdef PNG_POWERPC_VSX_API_SUPPORTED
3212- # define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions supported */
3318+ # define PNG_POWERPC_VSX 10 /* HARDWARE: PowerPC VSX SIMD instructions
3319+ * supported */
3320+ #endif
3321+ #ifdef PNG_MIPS_MMI_API_SUPPORTED
3322+ # define PNG_MIPS_MMI 12 /* HARDWARE: MIPS MMI SIMD instructions supported */
32133323#endif
3214- #define PNG_OPTION_NEXT 12 /* Next option - numbers must be even */
3324+
3325+ #define PNG_OPTION_NEXT 14 /* Next option - numbers must be even */
32153326
32163327/* Return values: NOTE: there are four values and 'off' is *not* zero */
32173328#define PNG_OPTION_UNSET 0 /* Unset - defaults to off */
@@ -3235,7 +3346,7 @@ PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
32353346 * one to use is one more than this.)
32363347 */
32373348#ifdef PNG_EXPORT_LAST_ORDINAL
3238- PNG_EXPORT_LAST_ORDINAL (249 );
3349+ PNG_EXPORT_LAST_ORDINAL (259 );
32393350#endif
32403351
32413352#ifdef __cplusplus
0 commit comments