30# error Duplicate inclusion of pngpriv.h; please check the libpng source files
33#if defined(PNG_H) || defined(PNGCONF_H) || defined(PNGLCONF_H)
34# error This file must not be included by applications; please include <png.h>
50# define _POSIX_SOURCE 1
53#ifndef PNG_VERSION_INFO_ONLY
70#if defined(HAVE_CONFIG_H) && !defined(PNG_NO_CONFIG_H)
73# define PNG_RESTRICT restrict
84#if defined(PNG_PREFIX) && !defined(PNGPREFIX_H)
85# include "pngprefix.h"
91# ifndef PNG_USER_PRIVATEBUILD
92# define PNG_USER_PRIVATEBUILD "Custom libpng build"
94# ifndef PNG_USER_DLLFNAME_POSTFIX
95# define PNG_USER_DLLFNAME_POSTFIX "Cb"
118#ifndef PNG_ARM_NEON_OPT
138# if (defined(__ARM_NEON__) || defined(__ARM_NEON)) && \
139 defined(PNG_ALIGNED_MEMORY_SUPPORTED)
140# define PNG_ARM_NEON_OPT 2
142# define PNG_ARM_NEON_OPT 0
146#ifndef PNG_RISCV_RVV_OPT
157# define PNG_RISCV_RVV_OPT 0
160#if PNG_ARM_NEON_OPT > 0
164# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_neon
165# ifndef PNG_ARM_NEON_IMPLEMENTATION
167# define PNG_ARM_NEON_IMPLEMENTATION 1
170# define PNG_ARM_NEON_IMPLEMENTATION 0
173#ifndef PNG_MIPS_MSA_OPT
174# if defined(__mips_msa) && (__mips_isa_rev >= 5) && \
175 defined(PNG_ALIGNED_MEMORY_SUPPORTED)
176# define PNG_MIPS_MSA_OPT 2
178# define PNG_MIPS_MSA_OPT 0
182#ifndef PNG_MIPS_MMI_OPT
184# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64) && \
185 defined(PNG_ALIGNED_MEMORY_SUPPORTED)
186# define PNG_MIPS_MMI_OPT 1
188# define PNG_MIPS_MMI_OPT 0
191# define PNG_MIPS_MMI_OPT 0
195#ifndef PNG_POWERPC_VSX_OPT
196# if defined(__PPC64__) && defined(__ALTIVEC__) && defined(__VSX__)
197# define PNG_POWERPC_VSX_OPT 2
199# define PNG_POWERPC_VSX_OPT 0
203#ifndef PNG_LOONGARCH_LSX_OPT
204# if defined(__loongarch_sx)
205# define PNG_LOONGARCH_LSX_OPT 1
207# define PNG_LOONGARCH_LSX_OPT 0
211#ifndef PNG_INTEL_SSE_OPT
217# if defined(__SSE4_1__) || defined(__AVX__) || defined(__SSSE3__) || \
218 defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
219 (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
220# define PNG_INTEL_SSE_OPT 1
222# define PNG_INTEL_SSE_OPT 0
225# define PNG_INTEL_SSE_OPT 0
229#if PNG_INTEL_SSE_OPT > 0
230# ifndef PNG_INTEL_SSE_IMPLEMENTATION
231# if defined(__SSE4_1__) || defined(__AVX__)
235# define PNG_INTEL_SSE_IMPLEMENTATION 3
236# elif defined(__SSSE3__)
237# define PNG_INTEL_SSE_IMPLEMENTATION 2
238# elif defined(__SSE2__) || defined(_M_X64) || defined(_M_AMD64) || \
239 (defined(_M_IX86_FP) && _M_IX86_FP >= 2)
240# define PNG_INTEL_SSE_IMPLEMENTATION 1
242# define PNG_INTEL_SSE_IMPLEMENTATION 0
246# if PNG_INTEL_SSE_IMPLEMENTATION > 0
247# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_sse2
250# define PNG_INTEL_SSE_IMPLEMENTATION 0
253#if PNG_MIPS_MSA_OPT > 0
254# ifndef PNG_MIPS_MSA_IMPLEMENTATION
255# if defined(__mips_msa)
256# if defined(__clang__)
257# elif defined(__GNUC__)
258# if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7)
259# define PNG_MIPS_MSA_IMPLEMENTATION 2
263# define PNG_MIPS_MSA_IMPLEMENTATION 2
267# ifndef PNG_MIPS_MSA_IMPLEMENTATION
268# define PNG_MIPS_MSA_IMPLEMENTATION 1
269# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
272# define PNG_MIPS_MSA_IMPLEMENTATION 0
275#if PNG_MIPS_MMI_OPT > 0
276# ifndef PNG_MIPS_MMI_IMPLEMENTATION
277# if defined(__mips_loongson_mmi) && (_MIPS_SIM == _ABI64)
278# define PNG_MIPS_MMI_IMPLEMENTATION 2
280# define PNG_MIPS_MMI_IMPLEMENTATION 0
284# if PNG_MIPS_MMI_IMPLEMENTATION > 0
285# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_mips
288# define PNG_MIPS_MMI_IMPLEMENTATION 0
291#if PNG_POWERPC_VSX_OPT > 0
292# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_vsx
293# define PNG_POWERPC_VSX_IMPLEMENTATION 1
295# define PNG_POWERPC_VSX_IMPLEMENTATION 0
298#if PNG_LOONGARCH_LSX_OPT > 0
299# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_lsx
300# define PNG_LOONGARCH_LSX_IMPLEMENTATION 1
302# define PNG_LOONGARCH_LSX_IMPLEMENTATION 0
305#if PNG_RISCV_RVV_OPT > 0 && __riscv_v >= 1000000
306# define PNG_FILTER_OPTIMIZATIONS png_init_filter_functions_rvv
307# ifndef PNG_RISCV_RVV_IMPLEMENTATION
309# define PNG_RISCV_RVV_IMPLEMENTATION 1
312# define PNG_RISCV_RVV_IMPLEMENTATION 0
329# define PNG_BUILD_DLL
338# define PNG_BUILD_DLL
344# define PNG_BUILD_DLL
362# define PNG_IMPEXP PNG_DLL_EXPORT
372#ifndef PNG_DEPRECATED
373# define PNG_DEPRECATED
384#ifndef PNG_INTERNAL_DATA
385# define PNG_INTERNAL_DATA(type, name, array) PNG_LINKAGE_DATA type name array
388#ifndef PNG_INTERNAL_FUNCTION
389# define PNG_INTERNAL_FUNCTION(type, name, args, attributes)\
390 PNG_LINKAGE_FUNCTION PNG_FUNCTION(type, name, args, PNG_EMPTY attributes)
393#ifndef PNG_INTERNAL_CALLBACK
394# define PNG_INTERNAL_CALLBACK(type, name, args, attributes)\
395 PNG_LINKAGE_CALLBACK PNG_FUNCTION(type, (PNGCBAPI name), args,\
396 PNG_EMPTY attributes)
409# ifndef PNG_FLOATING_POINT_SUPPORTED
410# define PNG_FP_EXPORT(ordinal, type, name, args)\
411 PNG_INTERNAL_FUNCTION(type, name, args, PNG_EMPTY);
412# ifndef PNG_VERSION_INFO_ONLY
420#ifndef PNG_FIXED_EXPORT
421# ifndef PNG_FIXED_POINT_SUPPORTED
422# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
423 PNG_INTERNAL_FUNCTION(type, name, args, PNG_EMPTY);
430#ifndef PNG_DLL_EXPORT
431# define PNG_DLL_EXPORT
446#ifndef PNG_RELEASE_BUILD
447# define PNG_RELEASE_BUILD (PNG_LIBPNG_BUILD_BASE_TYPE >= PNG_LIBPNG_BUILD_RC)
468#if defined(MAXSEG_64K) && !defined(PNG_MAX_MALLOC_64K)
469# define PNG_MAX_MALLOC_64K
479# define PNG_UNUSED(param) (void)param;
485#if (PNG_ZBUF_SIZE > 65536L) && defined(PNG_MAX_MALLOC_64K)
487# define PNG_ZBUF_SIZE 65536L
494#ifdef PNG_WARNINGS_SUPPORTED
495# define PNG_WARNING_PARAMETERS(p) png_warning_parameters p;
497# define png_warning_parameter(p,number,string) ((void)0)
498# define png_warning_parameter_unsigned(p,number,format,value) ((void)0)
499# define png_warning_parameter_signed(p,number,format,value) ((void)0)
500# define png_formatted_warning(pp,p,message) ((void)(pp))
501# define PNG_WARNING_PARAMETERS(p)
503#ifndef PNG_ERROR_TEXT_SUPPORTED
504# define png_fixed_error(s1,s2) png_err(s1)
511#ifdef PNG_FIXED_POINT_SUPPORTED
512# define PNGFAPI PNGAPI
517#ifndef PNG_VERSION_INFO_ONLY
528# define png_voidcast(type, value) static_cast<type>(value)
529# define png_constcast(type, value) const_cast<type>(value)
530# define png_aligncast(type, value) \
531 static_cast<type>(static_cast<void*>(value))
532# define png_aligncastconst(type, value) \
533 static_cast<type>(static_cast<const void*>(value))
535# define png_voidcast(type, value) (value)
536# define png_constcast(type, value) ((type)(void*)(const void*)(value))
537# define png_aligncast(type, value) ((void*)(value))
538# define png_aligncastconst(type, value) ((const void*)(value))
541#if defined(PNG_FLOATING_POINT_SUPPORTED) ||\
542 defined(PNG_FLOATING_ARITHMETIC_SUPPORTED)
554# if defined(_AMIGA) && defined(__SASC) && defined(_M68881)
563#if defined(__TURBOC__) && defined(__MSDOS__)
568#if defined(_WIN32) || defined(__WIN32__) || defined(__NT__)
580# define PNG_ABORT() abort()
584#define PNG_ALIGN_NONE 0
585#define PNG_ALIGN_ALWAYS 1
587# define PNG_ALIGN_OFFSET 2
589# define PNG_ALIGN_OFFSET -1
591#define PNG_ALIGN_SIZE 3
593#ifndef PNG_ALIGN_TYPE
598# define PNG_ALIGN_TYPE PNG_ALIGN_SIZE
601#if PNG_ALIGN_TYPE == PNG_ALIGN_SIZE
608# define png_alignof(type) (sizeof(type))
610# if PNG_ALIGN_TYPE == PNG_ALIGN_OFFSET
611# define png_alignof(type) offsetof(struct{char c; type t;}, t)
613# if PNG_ALIGN_TYPE == PNG_ALIGN_ALWAYS
614# define png_alignof(type) 1
622# define png_isaligned(ptr, type) \
623 (((type)(size_t)((const void*)(ptr)) & (type)(png_alignof(type)-1)) == 0)
625# define png_isaligned(ptr, type) 0
642#define PNG_HAVE_IDAT 0x04U
644#define PNG_HAVE_IEND 0x10U
648#define PNG_HAVE_CHUNK_HEADER 0x100U
649#define PNG_WROTE_tIME 0x200U
650#define PNG_WROTE_INFO_BEFORE_PLTE 0x400U
651#define PNG_BACKGROUND_IS_GRAY 0x800U
652#define PNG_HAVE_PNG_SIGNATURE 0x1000U
653#define PNG_HAVE_CHUNK_AFTER_IDAT 0x2000U
654#define PNG_WROTE_eXIf 0x4000U
655#define PNG_IS_READ_STRUCT 0x8000U
658#define PNG_BGR 0x0001U
659#define PNG_INTERLACE 0x0002U
660#define PNG_PACK 0x0004U
661#define PNG_SHIFT 0x0008U
662#define PNG_SWAP_BYTES 0x0010U
663#define PNG_INVERT_MONO 0x0020U
664#define PNG_QUANTIZE 0x0040U
665#define PNG_COMPOSE 0x0080U
666#define PNG_BACKGROUND_EXPAND 0x0100U
667#define PNG_EXPAND_16 0x0200U
668#define PNG_16_TO_8 0x0400U
669#define PNG_RGBA 0x0800U
670#define PNG_EXPAND 0x1000U
671#define PNG_GAMMA 0x2000U
672#define PNG_GRAY_TO_RGB 0x4000U
673#define PNG_FILLER 0x8000U
674#define PNG_PACKSWAP 0x10000U
675#define PNG_SWAP_ALPHA 0x20000U
676#define PNG_STRIP_ALPHA 0x40000U
677#define PNG_INVERT_ALPHA 0x80000U
678#define PNG_USER_TRANSFORM 0x100000U
679#define PNG_RGB_TO_GRAY_ERR 0x200000U
680#define PNG_RGB_TO_GRAY_WARN 0x400000U
681#define PNG_RGB_TO_GRAY 0x600000U
682#define PNG_ENCODE_ALPHA 0x800000U
683#define PNG_ADD_ALPHA 0x1000000U
684#define PNG_EXPAND_tRNS 0x2000000U
685#define PNG_SCALE_16_TO_8 0x4000000U
691#define PNG_STRUCT_PNG 0x0001U
692#define PNG_STRUCT_INFO 0x0002U
695#define PNG_FLAG_ZLIB_CUSTOM_STRATEGY 0x0001U
696#define PNG_FLAG_ZSTREAM_INITIALIZED 0x0002U
698#define PNG_FLAG_ZSTREAM_ENDED 0x0008U
701#define PNG_FLAG_ROW_INIT 0x0040U
702#define PNG_FLAG_FILLER_AFTER 0x0080U
703#define PNG_FLAG_CRC_ANCILLARY_USE 0x0100U
704#define PNG_FLAG_CRC_ANCILLARY_NOWARN 0x0200U
705#define PNG_FLAG_CRC_CRITICAL_USE 0x0400U
706#define PNG_FLAG_CRC_CRITICAL_IGNORE 0x0800U
708#define PNG_FLAG_OPTIMIZE_ALPHA 0x2000U
709#define PNG_FLAG_DETECT_UNINITIALIZED 0x4000U
712#define PNG_FLAG_LIBRARY_MISMATCH 0x20000U
714#define PNG_FLAG_STRIP_ERROR_TEXT 0x80000U
715#define PNG_FLAG_BENIGN_ERRORS_WARN 0x100000U
716#define PNG_FLAG_APP_WARNINGS_WARN 0x200000U
717#define PNG_FLAG_APP_ERRORS_WARN 0x400000U
727#define PNG_FLAG_CRC_ANCILLARY_MASK (PNG_FLAG_CRC_ANCILLARY_USE | \
728 PNG_FLAG_CRC_ANCILLARY_NOWARN)
730#define PNG_FLAG_CRC_CRITICAL_MASK (PNG_FLAG_CRC_CRITICAL_USE | \
731 PNG_FLAG_CRC_CRITICAL_IGNORE)
733#define PNG_FLAG_CRC_MASK (PNG_FLAG_CRC_ANCILLARY_MASK | \
734 PNG_FLAG_CRC_CRITICAL_MASK)
738#define PNG_COLOR_DIST(c1, c2) (abs((int)((c1).red) - (int)((c2).red)) + \
739 abs((int)((c1).green) - (int)((c2).green)) + \
740 abs((int)((c1).blue) - (int)((c2).blue)))
750#define PNG_DIV65535(v24) (((v24) + 32895) >> 16)
751#define PNG_DIV257(v16) PNG_DIV65535((png_uint_32)(v16) * 255)
754#define PNG_ROWBYTES(pixel_bits, width) \
755 ((pixel_bits) >= 8 ? \
756 ((size_t)(width) * (((size_t)(pixel_bits)) >> 3)) : \
757 (( ((size_t)(width) * ((size_t)(pixel_bits))) + 7) >> 3) )
771#define PNG_TRAILBITS(pixel_bits, width) \
772 (((pixel_bits) * ((width) % (png_uint_32)8)) % 8)
774#define PNG_PADBITS(pixel_bits, width) \
775 ((8 - PNG_TRAILBITS(pixel_bits, width)) % 8)
782#define PNG_OUT_OF_RANGE(value, ideal, delta) \
783 ( (value) < (ideal)-(delta) || (value) > (ideal)+(delta) )
789#ifdef PNG_FLOATING_POINT_SUPPORTED
797#define png_float(png_ptr, fixed, s) (.00001 * (fixed))
815#ifdef PNG_FIXED_POINT_MACRO_SUPPORTED
816#define png_fixed(png_ptr, fp, s) ((fp) <= 21474 && (fp) >= -21474 ?\
817 ((png_fixed_point)(100000 * (fp))) : (png_fixed_error(png_ptr, s),0))
818#define png_fixed_ITU(png_ptr, fp, s) ((fp) <= 214748 && (fp) >= 0 ?\
819 ((png_uint_32)(10000 * (fp))) : (png_fixed_error(png_ptr, s),0))
843#define PNG_32b(b,s) (((0xFFFFFFFFU)&(b)) << (s))
844#define PNG_U32(b1,b2,b3,b4) \
845 (PNG_32b(b1,24) | PNG_32b(b2,16) | PNG_32b(b3,8) | PNG_32b(b4,0))
854#define PNG_32to8(cn,s) (((cn) >> (s)) & 0xffU)
855#define PNG_CN_VALID_UPPER(b) ((b) >= 65 && (b) <= 90)
856#define PNG_CN_VALID_ASCII(b) PNG_CN_VALID_UPPER((b) & ~32U)
857#define PNG_CHUNK_NAME_VALID(cn) (\
858 PNG_CN_VALID_ASCII(PNG_32to8(cn,24)) && \
859 PNG_CN_VALID_ASCII(PNG_32to8(cn,16)) && \
860 PNG_CN_VALID_UPPER(PNG_32to8(cn, 8)) && \
861 PNG_CN_VALID_ASCII(PNG_32to8(cn, 0)) )
886#define png_IDAT PNG_U32( 73, 68, 65, 84)
887#define png_IEND PNG_U32( 73, 69, 78, 68)
888#define png_IHDR PNG_U32( 73, 72, 68, 82)
889#define png_PLTE PNG_U32( 80, 76, 84, 69)
890#define png_acTL PNG_U32( 97, 99, 84, 76)
891#define png_bKGD PNG_U32( 98, 75, 71, 68)
892#define png_cHRM PNG_U32( 99, 72, 82, 77)
893#define png_cICP PNG_U32( 99, 73, 67, 80)
894#define png_cLLI PNG_U32( 99, 76, 76, 73)
895#define png_eXIf PNG_U32(101, 88, 73, 102)
896#define png_fcTL PNG_U32(102, 99, 84, 76)
897#define png_fdAT PNG_U32(102, 100, 65, 84)
898#define png_fRAc PNG_U32(102, 82, 65, 99)
899#define png_gAMA PNG_U32(103, 65, 77, 65)
900#define png_gIFg PNG_U32(103, 73, 70, 103)
901#define png_gIFt PNG_U32(103, 73, 70, 116)
902#define png_gIFx PNG_U32(103, 73, 70, 120)
903#define png_hIST PNG_U32(104, 73, 83, 84)
904#define png_iCCP PNG_U32(105, 67, 67, 80)
905#define png_iTXt PNG_U32(105, 84, 88, 116)
906#define png_mDCV PNG_U32(109, 68, 67, 86)
907#define png_oFFs PNG_U32(111, 70, 70, 115)
908#define png_pCAL PNG_U32(112, 67, 65, 76)
909#define png_pHYs PNG_U32(112, 72, 89, 115)
910#define png_sBIT PNG_U32(115, 66, 73, 84)
911#define png_sCAL PNG_U32(115, 67, 65, 76)
912#define png_sPLT PNG_U32(115, 80, 76, 84)
913#define png_sRGB PNG_U32(115, 82, 71, 66)
914#define png_sTER PNG_U32(115, 84, 69, 82)
915#define png_tEXt PNG_U32(116, 69, 88, 116)
916#define png_tIME PNG_U32(116, 73, 77, 69)
917#define png_tRNS PNG_U32(116, 82, 78, 83)
918#define png_zTXt PNG_U32(122, 84, 88, 116)
923#define PNG_CHUNK_FROM_STRING(s)\
924 PNG_U32(0xff & (s)[0], 0xff & (s)[1], 0xff & (s)[2], 0xff & (s)[3])
930#define PNG_STRING_FROM_CHUNK(s,c)\
931 (void)(((char*)(s))[0]=(char)(((c)>>24) & 0xff), \
932 ((char*)(s))[1]=(char)(((c)>>16) & 0xff),\
933 ((char*)(s))[2]=(char)(((c)>>8) & 0xff), \
934 ((char*)(s))[3]=(char)((c & 0xff)))
937#define PNG_CSTRING_FROM_CHUNK(s,c)\
938 (void)(PNG_STRING_FROM_CHUNK(s,c), ((char*)(s))[4] = 0)
941#define PNG_CHUNK_ANCILLARY(c) (1 & ((c) >> 29))
942#define PNG_CHUNK_CRITICAL(c) (!PNG_CHUNK_ANCILLARY(c))
943#define PNG_CHUNK_PRIVATE(c) (1 & ((c) >> 21))
944#define PNG_CHUNK_RESERVED(c) (1 & ((c) >> 13))
945#define PNG_CHUNK_SAFE_TO_COPY(c) (1 & ((c) >> 5))
967#define PNG_KNOWN_CHUNKS\
998#define PNG_GAMMA_MAC_OLD 151724
999#define PNG_GAMMA_MAC_INVERSE 65909
1000#define PNG_GAMMA_sRGB_INVERSE 45455
1012#define PNG_LIB_GAMMA_MIN 1000
1013#define PNG_LIB_GAMMA_MAX 10000000
1018#ifndef PNG_VERSION_INFO_ONLY
1026#if PNG_ZLIB_VERNUM != 0 && PNG_ZLIB_VERNUM != ZLIB_VERNUM
1027# error The include path of <zlib.h> is incorrect
1045#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
1046 defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
1047#ifdef PNG_SIMPLIFIED_READ_SUPPORTED
1057#define PNG_sRGB_FROM_LINEAR(linear) \
1058 ((png_byte)(0xff & ((png_sRGB_base[(linear)>>15] \
1059 + ((((linear) & 0x7fff)*png_sRGB_delta[(linear)>>15])>>12)) >> 8)))
1077#define PNG_UNEXPECTED_ZLIB_RETURN (-7)
1085#ifdef PNG_WRITE_SUPPORTED
1092#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
1093 !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
1094 (defined(PNG_gAMA_SUPPORTED) || defined(PNG_cHRM_SUPPORTED) || \
1095 defined(PNG_sCAL_SUPPORTED) || defined(PNG_READ_BACKGROUND_SUPPORTED) || \
1096 defined(PNG_mDCV_SUPPORTED) || \
1097 defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)) || \
1098 (defined(PNG_sCAL_SUPPORTED) && \
1099 defined(PNG_FLOATING_ARITHMETIC_SUPPORTED))
1105#if defined(PNG_FLOATING_POINT_SUPPORTED) && \
1106 !defined(PNG_FIXED_POINT_MACRO_SUPPORTED) && \
1107 (defined(PNG_cLLI_SUPPORTED) || defined(PNG_mDCV_SUPPORTED))
1120#ifdef PNG_READ_SUPPORTED
1125#ifdef PNG_SET_USER_LIMITS_SUPPORTED
1126# define png_chunk_max(png_ptr) ((png_ptr)->user_chunk_malloc_max)
1128#elif PNG_USER_CHUNK_MALLOC_MAX > 0
1129# define png_chunk_max(png_ptr) ((void)png_ptr, PNG_USER_CHUNK_MALLOC_MAX)
1131#elif (defined PNG_MAX_MALLOC_64K)
1132# define png_chunk_max(png_ptr) ((void)png_ptr, 65536U)
1135# define png_chunk_max(png_ptr) ((void)png_ptr, PNG_SIZE_MAX)
1147#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
1148 defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
1175 png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn,
1176 png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
1208#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
1218#ifdef PNG_WRITE_FLUSH_SUPPORTED
1219# ifdef PNG_STDIO_SUPPORTED
1269#ifdef PNG_WRITE_FLUSH_SUPPORTED
1283 int compression_method,
int filter_method,
int interlace_method),
1300#ifdef PNG_WRITE_gAMA_SUPPORTED
1306#ifdef PNG_WRITE_sBIT_SUPPORTED
1312#ifdef PNG_WRITE_cHRM_SUPPORTED
1319#ifdef PNG_WRITE_cICP_SUPPORTED
1322 png_byte colour_primaries, png_byte transfer_function,
1323 png_byte matrix_coefficients, png_byte video_full_range_flag),
1327#ifdef PNG_WRITE_cLLI_SUPPORTED
1333#ifdef PNG_WRITE_mDCV_SUPPORTED
1336 png_uint_16 red_x, png_uint_16 red_y,
1337 png_uint_16 green_x, png_uint_16 green_y,
1338 png_uint_16 blue_x, png_uint_16 blue_y,
1339 png_uint_16 white_x, png_uint_16 white_y,
1344#ifdef PNG_WRITE_sRGB_SUPPORTED
1350#ifdef PNG_WRITE_eXIf_SUPPORTED
1356#ifdef PNG_WRITE_iCCP_SUPPORTED
1366#ifdef PNG_WRITE_sPLT_SUPPORTED
1372#ifdef PNG_WRITE_tRNS_SUPPORTED
1380#ifdef PNG_WRITE_bKGD_SUPPORTED
1386#ifdef PNG_WRITE_hIST_SUPPORTED
1393#ifdef PNG_WRITE_tEXt_SUPPORTED
1400#ifdef PNG_WRITE_zTXt_SUPPORTED
1407#ifdef PNG_WRITE_iTXt_SUPPORTED
1415#ifdef PNG_TEXT_SUPPORTED
1422#ifdef PNG_WRITE_oFFs_SUPPORTED
1425 png_int_32 x_offset, png_int_32 y_offset,
int unit_type),
1429#ifdef PNG_WRITE_pCAL_SUPPORTED
1432 png_charp purpose, png_int_32 X0, png_int_32 X1,
1437#ifdef PNG_WRITE_pHYs_SUPPORTED
1445#ifdef PNG_WRITE_tIME_SUPPORTED
1451#ifdef PNG_WRITE_sCAL_SUPPORTED
1491#ifndef PNG_USE_COMPILE_TIME_MASKS
1492# define PNG_USE_COMPILE_TIME_MASKS 1
1498#ifdef PNG_READ_INTERLACING_SUPPORTED
1513#ifdef PNG_WRITE_INTERLACING_SUPPORTED
1528#if PNG_ARM_NEON_OPT > 0
1552#if PNG_MIPS_MSA_IMPLEMENTATION == 1
1576#if PNG_MIPS_MMI_IMPLEMENTATION > 0
1600#if PNG_POWERPC_VSX_OPT > 0
1624#if PNG_INTEL_SSE_IMPLEMENTATION > 0
1645#if PNG_LOONGARCH_LSX_IMPLEMENTATION == 1
1669#if PNG_RISCV_RVV_IMPLEMENTATION == 1
1698#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1725#if ZLIB_VERNUM >= 0x1240
1729# define PNG_INFLATE(pp, flush) png_zlib_inflate(pp, flush)
1731# define PNG_INFLATE(pp, flush) inflate(&(pp)->zstream, flush)
1734#ifdef PNG_READ_TRANSFORMS_SUPPORTED
1742#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
1743 defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
1749#ifdef PNG_16BIT_SUPPORTED
1750#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
1757#if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
1758 defined(PNG_WRITE_PACKSWAP_SUPPORTED)
1764#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
1770#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
1810#if defined(PNG_READ_UNKNOWN_CHUNKS_SUPPORTED) ||\
1811 defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
1821#ifdef PNG_READ_TRANSFORMS_SUPPORTED
1826#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
1832#ifdef PNG_READ_TRANSFORMS_SUPPORTED
1838#ifdef PNG_PROGRESSIVE_READ_SUPPORTED
1883#ifdef PNG_iCCP_SUPPORTED
1885#ifdef PNG_READ_iCCP_SUPPORTED
1903#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
1914 int interlace_type,
int compression_type,
int filter_type),
1918#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
1919 defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
1925#if defined(PNG_FLOATING_POINT_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
1942#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_TIME_RFC1123_SUPPORTED)
1953#define PNG_FORMAT_NUMBER(buffer,format,number) \
1954 png_format_number(buffer, buffer + (sizeof buffer), format, number)
1957#define PNG_NUMBER_BUFFER_SIZE 24
1962#define PNG_NUMBER_FORMAT_u 1
1963#define PNG_NUMBER_FORMAT_02u 2
1964#define PNG_NUMBER_FORMAT_d 1
1965#define PNG_NUMBER_FORMAT_02d 2
1966#define PNG_NUMBER_FORMAT_x 3
1967#define PNG_NUMBER_FORMAT_02x 4
1968#define PNG_NUMBER_FORMAT_fixed 5
1971#ifdef PNG_WARNINGS_SUPPORTED
1973# define PNG_WARNING_PARAMETER_SIZE 32
1974# define PNG_WARNING_PARAMETER_COUNT 8
1979typedef char png_warning_parameters[PNG_WARNING_PARAMETER_COUNT][
1980 PNG_WARNING_PARAMETER_SIZE];
2008#ifdef PNG_BENIGN_ERRORS_SUPPORTED
2037# define png_app_warning(pp,s) png_warning(pp,s)
2038# define png_app_error(pp,s) png_error(pp,s)
2053#define PNG_CHUNK_WARNING 0
2054#define PNG_CHUNK_WRITE_ERROR 1
2055#define PNG_CHUNK_ERROR 2
2060#if defined(PNG_sCAL_SUPPORTED)
2066#define PNG_sCAL_MAX_DIGITS (PNG_sCAL_PRECISION+1+1+10)
2068#ifdef PNG_FLOATING_POINT_SUPPORTED
2075#ifdef PNG_FIXED_POINT_SUPPORTED
2083#if defined(PNG_sCAL_SUPPORTED) || defined(PNG_pCAL_SUPPORTED)
2114#define PNG_FP_INTEGER 0
2115#define PNG_FP_FRACTION 1
2116#define PNG_FP_EXPONENT 2
2117#define PNG_FP_STATE 3
2118#define PNG_FP_SAW_SIGN 4
2119#define PNG_FP_SAW_DIGIT 8
2120#define PNG_FP_SAW_DOT 16
2121#define PNG_FP_SAW_E 32
2122#define PNG_FP_SAW_ANY 60
2126#define PNG_FP_WAS_VALID 64
2127#define PNG_FP_NEGATIVE 128
2128#define PNG_FP_NONZERO 256
2129#define PNG_FP_STICKY 448
2134#define PNG_FP_INVALID 512
2139#define PNG_FP_MAYBE 0
2147#define PNG_FP_NZ_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NEGATIVE | PNG_FP_NONZERO)
2149#define PNG_FP_Z_MASK (PNG_FP_SAW_DIGIT | PNG_FP_NONZERO)
2152#define PNG_FP_IS_ZERO(state) (((state) & PNG_FP_Z_MASK) == PNG_FP_SAW_DIGIT)
2153#define PNG_FP_IS_POSITIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_Z_MASK)
2154#define PNG_FP_IS_NEGATIVE(state) (((state) & PNG_FP_NZ_MASK) == PNG_FP_NZ_MASK)
2186#if defined(PNG_READ_GAMMA_SUPPORTED) ||\
2187 defined(PNG_COLORSPACE_SUPPORTED) ||\
2188 defined(PNG_INCH_CONVERSIONS_SUPPORTED) ||\
2189 defined(PNG_READ_pHYs_SUPPORTED)
2198 png_int_32 multiplied_by, png_int_32 divided_by),
2210#ifdef PNG_READ_GAMMA_SUPPORTED
2260#ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
2267#if defined(PNG_cHRM_SUPPORTED) || defined(PNG_READ_RGB_TO_GRAY_SUPPORTED)
2273#ifdef PNG_COLORSPACE_SUPPORTED
2280#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
2281 defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
2283typedef struct png_control
2292 unsigned int for_write :1;
2293 unsigned int owned_file :1;
2300# define png_control_jmp_buf(pc) (((jmp_buf*)((pc)->error_buf))[0])
2302# define png_control_jmp_buf(pc) ((pc)->error_buf)
2313#ifdef PNG_WARNINGS_SUPPORTED
2318# define png_safe_warning 0
2332#ifndef PNG_SIMPLIFIED_READ_SUPPORTED
2346#ifdef PNG_FILTER_OPTIMIZATIONS
2356# if PNG_ARM_NEON_OPT > 0
2362#if PNG_MIPS_MSA_IMPLEMENTATION == 1
2368# if PNG_MIPS_MMI_IMPLEMENTATION > 0
2374# if PNG_INTEL_SSE_IMPLEMENTATION > 0
2381#if PNG_LOONGARCH_LSX_OPT > 0
2387# if PNG_RISCV_RVV_IMPLEMENTATION == 1
2397#if PNG_ARM_NEON_IMPLEMENTATION == 1
2399 png_riffle_palette_neon,
2403 png_do_expand_palette_rgba8_neon,
2411 png_do_expand_palette_rgb8_neon,
_In_ fcb _In_ chunk _In_ uint64_t _In_ uint64_t _In_ bool _In_opt_ void _In_opt_ PIRP _In_ LIST_ENTRY _In_ uint8_t compression
size_t const element_size
void error_message(HWND hwnd, const char *msg)
static HCRYPTKEY new_key(HCRYPTPROV hProv, ALG_ID aiAlgid, DWORD dwFlags, CRYPTKEY **ppCryptKey)
struct png_info_def *typedef unsigned char **typedef struct png_info_def *typedef struct png_info_def *typedef struct png_info_def *typedef unsigned char ** row
GLuint GLuint GLsizei GLenum type
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLint GLint GLsizei GLsizei height
GLint GLint GLsizei width
GLboolean GLboolean GLboolean b
GLenum const GLfloat * params
GLenum GLuint GLenum GLsizei const GLchar * buf
GLboolean GLenum GLenum GLvoid * values
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
GLuint GLsizei GLsizei * length
GLenum GLuint GLsizei bufsize
GLenum GLint GLint * precision
GLboolean GLboolean GLboolean GLboolean a
static unsigned int number
static char memory[1024 *256]
png_const_structrp png_const_inforp int * unit
const png_struct *PNG_RESTRICT png_const_structrp
png_info *PNG_RESTRICT png_inforp
png_struct *PNG_RESTRICT png_structrp
png_const_structrp png_const_inforp info_ptr
png_int_32 png_fixed_point
const png_byte * png_const_bytep
const png_uint_16 * png_const_uint_16p
png_uint_16 * png_uint_16p
png_fixed_point * png_fixed_point_p
const char * png_const_charp
#define png_fixed_error(s1, s2)
#define png_warning_parameter_unsigned(p, number, format, value)
#define png_app_error(pp, s)
#define png_app_warning(pp, s)
#define png_warning_parameter_signed(p, number, format, value)
png_double ** png_doublepp
#define PNG_INTERNAL_DATA(type, name, array)
const png_uint_16p * png_const_uint_16pp
#define PNG_INTERNAL_CALLBACK(type, name, args, attributes)
struct png_incomplete png_double
#define PNG_INTERNAL_FUNCTION(type, name, args, attributes)
#define png_warning_parameter(p, number, string)
#define png_formatted_warning(pp, p, message)
const png_double * png_const_doublep
static const WCHAR lang[]