280 #define PNG_LIBPNG_VER_STRING "1.6.36"
281 #define PNG_HEADER_VERSION_STRING " libpng version 1.6.36 - December 1, 2018\n"
283 #define PNG_LIBPNG_VER_SONUM 16
284 #define PNG_LIBPNG_VER_DLLNUM 16
287 #define PNG_LIBPNG_VER_MAJOR 1
288 #define PNG_LIBPNG_VER_MINOR 6
289 #define PNG_LIBPNG_VER_RELEASE 36
295 #define PNG_LIBPNG_VER_BUILD 0
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
302 #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
305 #define PNG_LIBPNG_BUILD_PATCH 8
307 #define PNG_LIBPNG_BUILD_PRIVATE 16
309 #define PNG_LIBPNG_BUILD_SPECIAL 32
312 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
321 #define PNG_LIBPNG_VER 10636
333 #ifndef PNG_VERSION_INFO_ONLY
352 #ifdef PNG_USER_PRIVATEBUILD
353 # define PNG_LIBPNG_BUILD_TYPE \
354 (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE)
356 # ifdef PNG_LIBPNG_SPECIALBUILD
357 # define PNG_LIBPNG_BUILD_TYPE \
358 (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL)
360 # define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE)
364 #ifndef PNG_VERSION_INFO_ONLY
374 #define png_libpng_ver png_get_header_ver(NULL)
544 #ifdef PNG_TEXT_SUPPORTED
586 #define PNG_TEXT_COMPRESSION_NONE_WR -3
587 #define PNG_TEXT_COMPRESSION_zTXt_WR -2
588 #define PNG_TEXT_COMPRESSION_NONE -1
589 #define PNG_TEXT_COMPRESSION_zTXt 0
590 #define PNG_ITXT_COMPRESSION_NONE 1
591 #define PNG_ITXT_COMPRESSION_zTXt 2
592 #define PNG_TEXT_COMPRESSION_LAST 3
613 #if defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED) ||\
614 defined(PNG_USER_CHUNKS_SUPPORTED)
644 #define PNG_HAVE_IHDR 0x01
645 #define PNG_HAVE_PLTE 0x02
646 #define PNG_AFTER_IDAT 0x08
649 #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL)
650 #define PNG_UINT_32_MAX ((png_uint_32)(-1))
651 #define PNG_SIZE_MAX ((size_t)(-1))
656 #define PNG_FP_1 100000
657 #define PNG_FP_HALF 50000
658 #define PNG_FP_MAX ((png_fixed_point)0x7fffffffL)
659 #define PNG_FP_MIN (-PNG_FP_MAX)
663 #define PNG_COLOR_MASK_PALETTE 1
664 #define PNG_COLOR_MASK_COLOR 2
665 #define PNG_COLOR_MASK_ALPHA 4
668 #define PNG_COLOR_TYPE_GRAY 0
669 #define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE)
670 #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR)
671 #define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA)
672 #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA)
674 #define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA
675 #define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA
678 #define PNG_COMPRESSION_TYPE_BASE 0
679 #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE
682 #define PNG_FILTER_TYPE_BASE 0
683 #define PNG_INTRAPIXEL_DIFFERENCING 64
684 #define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE
687 #define PNG_INTERLACE_NONE 0
688 #define PNG_INTERLACE_ADAM7 1
689 #define PNG_INTERLACE_LAST 2
692 #define PNG_OFFSET_PIXEL 0
693 #define PNG_OFFSET_MICROMETER 1
694 #define PNG_OFFSET_LAST 2
697 #define PNG_EQUATION_LINEAR 0
698 #define PNG_EQUATION_BASE_E 1
699 #define PNG_EQUATION_ARBITRARY 2
700 #define PNG_EQUATION_HYPERBOLIC 3
701 #define PNG_EQUATION_LAST 4
704 #define PNG_SCALE_UNKNOWN 0
705 #define PNG_SCALE_METER 1
706 #define PNG_SCALE_RADIAN 2
707 #define PNG_SCALE_LAST 3
710 #define PNG_RESOLUTION_UNKNOWN 0
711 #define PNG_RESOLUTION_METER 1
712 #define PNG_RESOLUTION_LAST 2
715 #define PNG_sRGB_INTENT_PERCEPTUAL 0
716 #define PNG_sRGB_INTENT_RELATIVE 1
717 #define PNG_sRGB_INTENT_SATURATION 2
718 #define PNG_sRGB_INTENT_ABSOLUTE 3
719 #define PNG_sRGB_INTENT_LAST 4
722 #define PNG_KEYWORD_MAX_LENGTH 79
725 #define PNG_MAX_PALETTE_LENGTH 256
732 #define PNG_INFO_gAMA 0x0001U
733 #define PNG_INFO_sBIT 0x0002U
734 #define PNG_INFO_cHRM 0x0004U
735 #define PNG_INFO_PLTE 0x0008U
736 #define PNG_INFO_tRNS 0x0010U
737 #define PNG_INFO_bKGD 0x0020U
738 #define PNG_INFO_hIST 0x0040U
739 #define PNG_INFO_pHYs 0x0080U
740 #define PNG_INFO_oFFs 0x0100U
741 #define PNG_INFO_tIME 0x0200U
742 #define PNG_INFO_pCAL 0x0400U
743 #define PNG_INFO_sRGB 0x0800U
744 #define PNG_INFO_iCCP 0x1000U
745 #define PNG_INFO_sPLT 0x2000U
746 #define PNG_INFO_sCAL 0x4000U
747 #define PNG_INFO_IDAT 0x8000U
748 #define PNG_INFO_eXIf 0x10000U
777 typedef PNG_CALLBACK(
void, *png_flush_ptr, (png_structp));
783 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
784 typedef PNG_CALLBACK(
void, *png_progressive_info_ptr, (png_structp, png_infop));
785 typedef PNG_CALLBACK(
void, *png_progressive_end_ptr, (png_structp, png_infop));
801 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
802 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
803 typedef PNG_CALLBACK(
void, *png_user_transform_ptr, (png_structp, png_row_infop,
807 #ifdef PNG_USER_CHUNKS_SUPPORTED
808 typedef PNG_CALLBACK(
int, *png_user_chunk_ptr, (png_structp,
809 png_unknown_chunkp));
811 #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
816 #ifdef PNG_SETJMP_SUPPORTED
832 #define PNG_TRANSFORM_IDENTITY 0x0000
833 #define PNG_TRANSFORM_STRIP_16 0x0001
834 #define PNG_TRANSFORM_STRIP_ALPHA 0x0002
835 #define PNG_TRANSFORM_PACKING 0x0004
836 #define PNG_TRANSFORM_PACKSWAP 0x0008
837 #define PNG_TRANSFORM_EXPAND 0x0010
838 #define PNG_TRANSFORM_INVERT_MONO 0x0020
839 #define PNG_TRANSFORM_SHIFT 0x0040
840 #define PNG_TRANSFORM_BGR 0x0080
841 #define PNG_TRANSFORM_SWAP_ALPHA 0x0100
842 #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200
843 #define PNG_TRANSFORM_INVERT_ALPHA 0x0400
844 #define PNG_TRANSFORM_STRIP_FILLER 0x0800
846 #define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER
847 #define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000
849 #define PNG_TRANSFORM_GRAY_TO_RGB 0x2000
851 #define PNG_TRANSFORM_EXPAND_16 0x4000
852 #if INT_MAX >= 0x8000
853 #define PNG_TRANSFORM_SCALE_16 0x8000
857 #define PNG_FLAG_MNG_EMPTY_PLTE 0x01
858 #define PNG_FLAG_MNG_FILTER_64 0x04
859 #define PNG_ALL_MNG_FEATURES 0x05
914 size_t num_to_check));
919 #define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n))
922 PNG_EXPORTA(4, png_structp, png_create_read_struct,
924 png_error_ptr error_fn, png_error_ptr warn_fn),
928 PNG_EXPORTA(5, png_structp, png_create_write_struct,
930 png_error_ptr warn_fn),
933 PNG_EXPORT(6,
size_t, png_get_compression_buffer_size,
942 #ifdef PNG_SETJMP_SUPPORTED
951 png_longjmp_ptr longjmp_fn,
size_t jmp_buf_size));
952 # define png_jmpbuf(png_ptr) \
953 (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf))))
955 # define png_jmpbuf(png_ptr) \
956 (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP)
966 #ifdef PNG_READ_SUPPORTED
972 #ifdef PNG_USER_MEM_SUPPORTED
973 PNG_EXPORTA(11, png_structp, png_create_read_struct_2,
975 png_error_ptr warn_fn,
976 png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
978 PNG_EXPORTA(12, png_structp, png_create_write_struct_2,
980 png_error_ptr warn_fn,
981 png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn),
1015 PNG_EXPORT(20,
void, png_write_info_before_PLTE,
1020 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1026 #ifdef PNG_TIME_RFC1123_SUPPORTED
1031 #if PNG_LIBPNG_VER < 10700
1036 PNG_EXPORT(241,
int, png_convert_to_rfc1123_buffer, (
char out[29],
1037 png_const_timep ptime));
1040 #ifdef PNG_CONVERT_tIME_SUPPORTED
1042 PNG_EXPORT(24,
void, png_convert_from_struct_tm, (png_timep ptime,
1043 const struct tm * ttime));
1046 PNG_EXPORT(25,
void, png_convert_from_time_t, (png_timep ptime, time_t ttime));
1049 #ifdef PNG_READ_EXPAND_SUPPORTED
1057 #ifdef PNG_READ_EXPAND_16_SUPPORTED
1064 #if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
1069 #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED
1074 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED
1076 #define PNG_ERROR_ACTION_NONE 1
1077 #define PNG_ERROR_ACTION_WARN 2
1078 #define PNG_ERROR_ACTION_ERROR 3
1079 #define PNG_RGB_TO_GRAY_DEFAULT (-1)
1086 PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp
1090 #ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
1091 PNG_EXPORT(35,
void, png_build_grayscale_palette, (
int bit_depth,
1092 png_colorp palette));
1095 #ifdef PNG_READ_ALPHA_MODE_SUPPORTED
1130 #define PNG_ALPHA_PNG 0
1131 #define PNG_ALPHA_STANDARD 1
1132 #define PNG_ALPHA_ASSOCIATED 1
1133 #define PNG_ALPHA_PREMULTIPLIED 1
1134 #define PNG_ALPHA_OPTIMIZED 2
1135 #define PNG_ALPHA_BROKEN 3
1138 double output_gamma))
1143 #if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED)
1147 #define PNG_DEFAULT_sRGB -1
1148 #define PNG_GAMMA_MAC_18 -2
1149 #define PNG_GAMMA_sRGB 220000
1150 #define PNG_GAMMA_LINEAR PNG_FP_1
1229 #ifdef PNG_READ_STRIP_ALPHA_SUPPORTED
1230 PNG_EXPORT(36,
void, png_set_strip_alpha, (png_structrp png_ptr));
1233 #if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
1234 defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
1235 PNG_EXPORT(37,
void, png_set_swap_alpha, (png_structrp png_ptr));
1238 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
1239 defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
1240 PNG_EXPORT(38,
void, png_set_invert_alpha, (png_structrp png_ptr));
1243 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
1248 # define PNG_FILLER_BEFORE 0
1249 # define PNG_FILLER_AFTER 1
1251 PNG_EXPORT(40,
void, png_set_add_alpha, (png_structrp png_ptr,
1255 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
1257 PNG_EXPORT(41,
void, png_set_swap, (png_structrp png_ptr));
1260 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
1262 PNG_EXPORT(42,
void, png_set_packing, (png_structrp png_ptr));
1265 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \
1266 defined(PNG_WRITE_PACKSWAP_SUPPORTED)
1268 PNG_EXPORT(43,
void, png_set_packswap, (png_structrp png_ptr));
1271 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
1273 PNG_EXPORT(44,
void, png_set_shift, (png_structrp png_ptr, png_const_color_8p
1277 #if defined(PNG_READ_INTERLACING_SUPPORTED) || \
1278 defined(PNG_WRITE_INTERLACING_SUPPORTED)
1285 PNG_EXPORT(45,
int, png_set_interlace_handling, (png_structrp png_ptr));
1288 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
1290 PNG_EXPORT(46,
void, png_set_invert_mono, (png_structrp png_ptr));
1293 #ifdef PNG_READ_BACKGROUND_SUPPORTED
1299 PNG_FP_EXPORT(47,
void, png_set_background, (png_structrp png_ptr,
1303 png_const_color_16p background_color,
int background_gamma_code,
1306 #ifdef PNG_READ_BACKGROUND_SUPPORTED
1307 # define PNG_BACKGROUND_GAMMA_UNKNOWN 0
1308 # define PNG_BACKGROUND_GAMMA_SCREEN 1
1309 # define PNG_BACKGROUND_GAMMA_FILE 2
1310 # define PNG_BACKGROUND_GAMMA_UNIQUE 3
1313 #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED
1315 PNG_EXPORT(229,
void, png_set_scale_16, (png_structrp png_ptr));
1318 #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED
1319 #define PNG_READ_16_TO_8_SUPPORTED
1321 PNG_EXPORT(48,
void, png_set_strip_16, (png_structrp png_ptr));
1324 #ifdef PNG_READ_QUANTIZE_SUPPORTED
1328 PNG_EXPORT(49,
void, png_set_quantize, (png_structrp png_ptr,
1329 png_colorp palette,
int num_palette,
int maximum_colors,
1333 #ifdef PNG_READ_GAMMA_SUPPORTED
1337 #define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED*.00001)
1350 PNG_FP_EXPORT(50,
void, png_set_gamma, (png_structrp png_ptr,
1356 #ifdef PNG_WRITE_FLUSH_SUPPORTED
1358 PNG_EXPORT(51,
void, png_set_flush, (png_structrp png_ptr,
int nrows));
1360 PNG_EXPORT(52,
void, png_write_flush, (png_structrp png_ptr));
1364 PNG_EXPORT(53,
void, png_start_read_image, (png_structrp png_ptr));
1367 PNG_EXPORT(54,
void, png_read_update_info, (png_structrp png_ptr,
1370 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1376 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1382 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1388 PNG_EXPORT(58,
void, png_write_row, (png_structrp png_ptr,
1403 PNG_EXPORT(61,
void, png_write_end, (png_structrp png_ptr,
1406 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
1412 PNG_EXPORT(63,
void, png_destroy_info_struct, (png_const_structrp png_ptr,
1413 png_infopp info_ptr_ptr));
1416 PNG_EXPORT(64,
void, png_destroy_read_struct, (png_structpp png_ptr_ptr,
1417 png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr));
1420 PNG_EXPORT(65,
void, png_destroy_write_struct, (png_structpp png_ptr_ptr,
1421 png_infopp info_ptr_ptr));
1424 PNG_EXPORT(66,
void, png_set_crc_action, (png_structrp png_ptr,
int crit_action,
1436 #define PNG_CRC_DEFAULT 0
1437 #define PNG_CRC_ERROR_QUIT 1
1438 #define PNG_CRC_WARN_DISCARD 2
1439 #define PNG_CRC_WARN_USE 3
1440 #define PNG_CRC_QUIET_USE 4
1441 #define PNG_CRC_NO_CHANGE 5
1443 #ifdef PNG_WRITE_SUPPORTED
1455 PNG_EXPORT(67,
void, png_set_filter, (png_structrp png_ptr,
int method,
1464 #define PNG_NO_FILTERS 0x00
1465 #define PNG_FILTER_NONE 0x08
1466 #define PNG_FILTER_SUB 0x10
1467 #define PNG_FILTER_UP 0x20
1468 #define PNG_FILTER_AVG 0x40
1469 #define PNG_FILTER_PAETH 0x80
1470 #define PNG_FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP)
1471 #define PNG_ALL_FILTERS (PNG_FAST_FILTERS | PNG_FILTER_AVG | PNG_FILTER_PAETH)
1476 #define PNG_FILTER_VALUE_NONE 0
1477 #define PNG_FILTER_VALUE_SUB 1
1478 #define PNG_FILTER_VALUE_UP 2
1479 #define PNG_FILTER_VALUE_AVG 3
1480 #define PNG_FILTER_VALUE_PAETH 4
1481 #define PNG_FILTER_VALUE_LAST 5
1483 #ifdef PNG_WRITE_SUPPORTED
1484 #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
1485 PNG_FP_EXPORT(68,
void, png_set_filter_heuristics, (png_structrp png_ptr,
1487 png_const_doublep filter_costs))
1489 (png_structrp png_ptr,
int heuristic_method,
int num_weights,
1495 #define PNG_FILTER_HEURISTIC_DEFAULT 0
1496 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1
1497 #define PNG_FILTER_HEURISTIC_WEIGHTED 2
1498 #define PNG_FILTER_HEURISTIC_LAST 3
1507 #ifdef PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
1508 PNG_EXPORT(69,
void, png_set_compression_level, (png_structrp png_ptr,
1511 PNG_EXPORT(70,
void, png_set_compression_mem_level, (png_structrp png_ptr,
1514 PNG_EXPORT(71,
void, png_set_compression_strategy, (png_structrp png_ptr,
1520 PNG_EXPORT(72,
void, png_set_compression_window_bits, (png_structrp png_ptr,
1523 PNG_EXPORT(73,
void, png_set_compression_method, (png_structrp png_ptr,
1527 #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
1529 PNG_EXPORT(222,
void, png_set_text_compression_level, (png_structrp png_ptr,
1532 PNG_EXPORT(223,
void, png_set_text_compression_mem_level, (png_structrp png_ptr,
1535 PNG_EXPORT(224,
void, png_set_text_compression_strategy, (png_structrp png_ptr,
1541 PNG_EXPORT(225,
void, png_set_text_compression_window_bits,
1542 (png_structrp png_ptr,
int window_bits));
1544 PNG_EXPORT(226,
void, png_set_text_compression_method, (png_structrp png_ptr,
1558 #ifdef PNG_STDIO_SUPPORTED
1560 PNG_EXPORT(74,
void, png_init_io, (png_structrp png_ptr, png_FILE_p fp));
1571 PNG_EXPORT(75,
void, png_set_error_fn, (png_structrp png_ptr,
1572 png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn));
1588 png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn));
1592 png_rw_ptr read_data_fn));
1597 PNG_EXPORT(80,
void, png_set_read_status_fn, (png_structrp png_ptr,
1598 png_read_status_ptr read_row_fn));
1600 PNG_EXPORT(81,
void, png_set_write_status_fn, (png_structrp png_ptr,
1601 png_write_status_ptr write_row_fn));
1603 #ifdef PNG_USER_MEM_SUPPORTED
1606 png_malloc_ptr malloc_fn, png_free_ptr free_fn));
1611 #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
1612 PNG_EXPORT(84,
void, png_set_read_user_transform_fn, (png_structrp png_ptr,
1613 png_user_transform_ptr read_user_transform_fn));
1616 #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
1617 PNG_EXPORT(85,
void, png_set_write_user_transform_fn, (png_structrp png_ptr,
1618 png_user_transform_ptr write_user_transform_fn));
1621 #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
1622 PNG_EXPORT(86,
void, png_set_user_transform_info, (png_structrp png_ptr,
1623 png_voidp user_transform_ptr,
int user_transform_depth,
1624 int user_transform_channels));
1627 (png_const_structrp png_ptr));
1630 #ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
1643 PNG_EXPORT(218, png_byte, png_get_current_pass_number, (png_const_structrp));
1646 #ifdef PNG_READ_USER_CHUNKS_SUPPORTED
1666 PNG_EXPORT(88,
void, png_set_read_user_chunk_fn, (png_structrp png_ptr,
1667 png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn));
1670 #ifdef PNG_USER_CHUNKS_SUPPORTED
1674 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED
1678 PNG_EXPORT(90,
void, png_set_progressive_read_fn, (png_structrp png_ptr,
1679 png_voidp progressive_ptr, png_progressive_info_ptr info_fn,
1680 png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn));
1684 (png_const_structrp png_ptr));
1687 PNG_EXPORT(92,
void, png_process_data, (png_structrp png_ptr,
1697 PNG_EXPORT(219,
size_t, png_process_data_pause, (png_structrp,
int save));
1712 PNG_EXPORT(93,
void, png_progressive_combine_row, (png_const_structrp png_ptr,
1730 PNG_EXPORT(98,
void, png_free_data, (png_const_structrp png_ptr,
1740 PNG_EXPORT(99,
void, png_data_freer, (png_const_structrp png_ptr,
1744 #define PNG_DESTROY_WILL_FREE_DATA 1
1745 #define PNG_SET_WILL_FREE_DATA 1
1746 #define PNG_USER_WILL_FREE_DATA 2
1748 #define PNG_FREE_HIST 0x0008U
1749 #define PNG_FREE_ICCP 0x0010U
1750 #define PNG_FREE_SPLT 0x0020U
1751 #define PNG_FREE_ROWS 0x0040U
1752 #define PNG_FREE_PCAL 0x0080U
1753 #define PNG_FREE_SCAL 0x0100U
1754 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
1755 # define PNG_FREE_UNKN 0x0200U
1758 #define PNG_FREE_PLTE 0x1000U
1759 #define PNG_FREE_TRNS 0x2000U
1760 #define PNG_FREE_TEXT 0x4000U
1761 #define PNG_FREE_EXIF 0x8000U
1762 #define PNG_FREE_ALL 0xffffU
1763 #define PNG_FREE_MUL 0x4220U
1765 #ifdef PNG_USER_MEM_SUPPORTED
1768 PNG_EXPORTA(101,
void, png_free_default, (png_const_structrp png_ptr,
1772 #ifdef PNG_ERROR_TEXT_SUPPORTED
1774 PNG_EXPORTA(102,
void, png_error, (png_const_structrp png_ptr,
1778 PNG_EXPORTA(103,
void, png_chunk_error, (png_const_structrp png_ptr,
1784 # define png_error(s1,s2) png_err(s1)
1785 # define png_chunk_error(s1,s2) png_err(s1)
1788 #ifdef PNG_WARNINGS_SUPPORTED
1790 PNG_EXPORT(105,
void, png_warning, (png_const_structrp png_ptr,
1794 PNG_EXPORT(106,
void, png_chunk_warning, (png_const_structrp png_ptr,
1797 # define png_warning(s1,s2) ((void)(s1))
1798 # define png_chunk_warning(s1,s2) ((void)(s1))
1801 #ifdef PNG_BENIGN_ERRORS_SUPPORTED
1804 PNG_EXPORT(107,
void, png_benign_error, (png_const_structrp png_ptr,
1807 #ifdef PNG_READ_SUPPORTED
1809 PNG_EXPORT(108,
void, png_chunk_benign_error, (png_const_structrp png_ptr,
1814 (png_structrp png_ptr,
int allowed));
1816 # ifdef PNG_ALLOW_BENIGN_ERRORS
1817 # define png_benign_error png_warning
1818 # define png_chunk_benign_error png_chunk_warning
1820 # define png_benign_error png_error
1821 # define png_chunk_benign_error png_chunk_error
1842 PNG_EXPORT(111,
size_t, png_get_rowbytes, (png_const_structrp png_ptr,
1845 #ifdef PNG_INFO_IMAGE_SUPPORTED
1855 PNG_EXPORT(113,
void, png_set_rows, (png_const_structrp png_ptr,
1860 PNG_EXPORT(114, png_byte, png_get_channels, (png_const_structrp png_ptr,
1863 #ifdef PNG_EASY_ACCESS_SUPPORTED
1873 PNG_EXPORT(117, png_byte, png_get_bit_depth, (png_const_structrp png_ptr,
1877 PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structrp png_ptr,
1881 PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structrp png_ptr,
1885 PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structrp png_ptr,
1889 PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structrp png_ptr,
1894 (png_const_structrp png_ptr, png_const_inforp
info_ptr));
1896 (png_const_structrp png_ptr, png_const_inforp
info_ptr));
1898 (png_const_structrp png_ptr, png_const_inforp
info_ptr));
1902 (png_const_structrp png_ptr, png_const_inforp
info_ptr))
1904 (png_const_structrp png_ptr, png_const_inforp info_ptr))
1907 PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels,
1908 (png_const_structrp png_ptr, png_const_inforp info_ptr));
1909 PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels,
1910 (png_const_structrp png_ptr, png_const_inforp info_ptr));
1911 PNG_EXPORT(128, png_int_32, png_get_x_offset_microns,
1912 (png_const_structrp png_ptr, png_const_inforp info_ptr));
1913 PNG_EXPORT(129, png_int_32, png_get_y_offset_microns,
1914 (png_const_structrp png_ptr, png_const_inforp info_ptr));
1918 #ifdef PNG_READ_SUPPORTED
1921 png_const_inforp info_ptr));
1924 #ifdef PNG_bKGD_SUPPORTED
1926 png_inforp info_ptr, png_color_16p *background));
1929 #ifdef PNG_bKGD_SUPPORTED
1930 PNG_EXPORT(132,
void, png_set_bKGD, (png_const_structrp png_ptr,
1931 png_inforp info_ptr, png_const_color_16p background));
1934 #ifdef PNG_cHRM_SUPPORTED
1936 png_const_inforp info_ptr,
double *white_x,
double *white_y,
double *red_x,
1937 double *red_y,
double *green_x,
double *green_y,
double *blue_x,
1940 png_const_inforp info_ptr,
double *
red_X,
double *
red_Y,
double *
red_Z,
1942 double *
blue_Y,
double *blue_Z))
1944 (png_const_structrp png_ptr, png_const_inforp info_ptr,
1950 (png_const_structrp png_ptr, png_const_inforp info_ptr,
1958 #ifdef PNG_cHRM_SUPPORTED
1959 PNG_FP_EXPORT(135,
void, png_set_cHRM, (png_const_structrp png_ptr,
1960 png_inforp info_ptr,
1961 double white_x,
double white_y,
double red_x,
double red_y,
double green_x,
1962 double green_y,
double blue_x,
double blue_y))
1964 png_inforp info_ptr,
double red_X,
double red_Y,
double red_Z,
1965 double green_X,
double green_Y,
double green_Z,
double blue_X,
1966 double blue_Y,
double blue_Z))
1967 PNG_FIXED_EXPORT(136,
void, png_set_cHRM_fixed, (png_const_structrp png_ptr,
1981 #ifdef PNG_eXIf_SUPPORTED
1982 PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
1984 PNG_EXPORT(247,
void, png_set_eXIf, (png_const_structrp png_ptr,
1987 PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr,
1988 png_const_inforp info_ptr, png_uint_32 *num_exif,
png_bytep *exif));
1989 PNG_EXPORT(249,
void, png_set_eXIf_1, (png_const_structrp png_ptr,
1990 png_inforp info_ptr, png_uint_32 num_exif,
png_bytep exif));
1993 #ifdef PNG_gAMA_SUPPORTED
1994 PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
1995 png_const_inforp info_ptr,
double *file_gamma))
1997 (png_const_structrp png_ptr, png_const_inforp info_ptr,
2001 #ifdef PNG_gAMA_SUPPORTED
2002 PNG_FP_EXPORT(139,
void, png_set_gAMA, (png_const_structrp png_ptr,
2003 png_inforp info_ptr,
double file_gamma))
2008 #ifdef PNG_hIST_SUPPORTED
2009 PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
2011 PNG_EXPORT(142,
void, png_set_hIST, (png_const_structrp png_ptr,
2015 PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_const_structrp png_ptr,
2016 png_const_inforp info_ptr, png_uint_32 *
width, png_uint_32 *
height,
2017 int *bit_depth,
int *color_type,
int *interlace_method,
2018 int *compression_method,
int *filter_method));
2020 PNG_EXPORT(144,
void, png_set_IHDR, (png_const_structrp png_ptr,
2021 png_inforp info_ptr, png_uint_32
width, png_uint_32
height,
int bit_depth,
2022 int color_type,
int interlace_method,
int compression_method,
2023 int filter_method));
2025 #ifdef PNG_oFFs_SUPPORTED
2026 PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr,
2027 png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
2031 #ifdef PNG_oFFs_SUPPORTED
2032 PNG_EXPORT(146,
void, png_set_oFFs, (png_const_structrp png_ptr,
2033 png_inforp info_ptr, png_int_32 offset_x, png_int_32 offset_y,
2037 #ifdef PNG_pCAL_SUPPORTED
2038 PNG_EXPORT(147, png_uint_32, png_get_pCAL, (png_const_structrp png_ptr,
2039 png_inforp info_ptr,
png_charp *purpose, png_int_32 *X0,
2044 #ifdef PNG_pCAL_SUPPORTED
2045 PNG_EXPORT(148,
void, png_set_pCAL, (png_const_structrp png_ptr,
2046 png_inforp info_ptr,
png_const_charp purpose, png_int_32 X0, png_int_32 X1,
2050 #ifdef PNG_pHYs_SUPPORTED
2051 PNG_EXPORT(149, png_uint_32, png_get_pHYs, (png_const_structrp png_ptr,
2052 png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
2056 #ifdef PNG_pHYs_SUPPORTED
2057 PNG_EXPORT(150,
void, png_set_pHYs, (png_const_structrp png_ptr,
2058 png_inforp info_ptr, png_uint_32 res_x, png_uint_32 res_y,
int unit_type));
2061 PNG_EXPORT(151, png_uint_32, png_get_PLTE, (png_const_structrp png_ptr,
2062 png_inforp info_ptr, png_colorp *palette,
int *num_palette));
2064 PNG_EXPORT(152,
void, png_set_PLTE, (png_structrp png_ptr,
2065 png_inforp info_ptr, png_const_colorp palette,
int num_palette));
2067 #ifdef PNG_sBIT_SUPPORTED
2068 PNG_EXPORT(153, png_uint_32, png_get_sBIT, (png_const_structrp png_ptr,
2069 png_inforp info_ptr, png_color_8p *sig_bit));
2072 #ifdef PNG_sBIT_SUPPORTED
2073 PNG_EXPORT(154,
void, png_set_sBIT, (png_const_structrp png_ptr,
2074 png_inforp info_ptr, png_const_color_8p sig_bit));
2077 #ifdef PNG_sRGB_SUPPORTED
2078 PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structrp png_ptr,
2079 png_const_inforp info_ptr,
int *file_srgb_intent));
2082 #ifdef PNG_sRGB_SUPPORTED
2083 PNG_EXPORT(156,
void, png_set_sRGB, (png_const_structrp png_ptr,
2084 png_inforp info_ptr,
int srgb_intent));
2085 PNG_EXPORT(157,
void, png_set_sRGB_gAMA_and_cHRM, (png_const_structrp png_ptr,
2086 png_inforp info_ptr,
int srgb_intent));
2089 #ifdef PNG_iCCP_SUPPORTED
2090 PNG_EXPORT(158, png_uint_32, png_get_iCCP, (png_const_structrp png_ptr,
2095 #ifdef PNG_iCCP_SUPPORTED
2096 PNG_EXPORT(159,
void, png_set_iCCP, (png_const_structrp png_ptr,
2101 #ifdef PNG_sPLT_SUPPORTED
2102 PNG_EXPORT(160,
int, png_get_sPLT, (png_const_structrp png_ptr,
2103 png_inforp info_ptr, png_sPLT_tpp entries));
2106 #ifdef PNG_sPLT_SUPPORTED
2107 PNG_EXPORT(161,
void, png_set_sPLT, (png_const_structrp png_ptr,
2108 png_inforp info_ptr, png_const_sPLT_tp entries,
int nentries));
2111 #ifdef PNG_TEXT_SUPPORTED
2113 PNG_EXPORT(162,
int, png_get_text, (png_const_structrp png_ptr,
2114 png_inforp info_ptr, png_textp *text_ptr,
int *num_text));
2124 #ifdef PNG_TEXT_SUPPORTED
2125 PNG_EXPORT(163,
void, png_set_text, (png_const_structrp png_ptr,
2126 png_inforp info_ptr, png_const_textp text_ptr,
int num_text));
2129 #ifdef PNG_tIME_SUPPORTED
2130 PNG_EXPORT(164, png_uint_32, png_get_tIME, (png_const_structrp png_ptr,
2131 png_inforp info_ptr, png_timep *mod_time));
2134 #ifdef PNG_tIME_SUPPORTED
2135 PNG_EXPORT(165,
void, png_set_tIME, (png_const_structrp png_ptr,
2136 png_inforp info_ptr, png_const_timep mod_time));
2139 #ifdef PNG_tRNS_SUPPORTED
2140 PNG_EXPORT(166, png_uint_32, png_get_tRNS, (png_const_structrp png_ptr,
2141 png_inforp info_ptr,
png_bytep *trans_alpha,
int *num_trans,
2142 png_color_16p *trans_color));
2145 #ifdef PNG_tRNS_SUPPORTED
2146 PNG_EXPORT(167,
void, png_set_tRNS, (png_structrp png_ptr,
2148 png_const_color_16p trans_color));
2151 #ifdef PNG_sCAL_SUPPORTED
2152 PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr,
2154 #if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \
2155 defined(PNG_FLOATING_POINT_SUPPORTED)
2162 (png_const_structrp png_ptr, png_const_inforp info_ptr,
int *unit,
2166 (png_const_structrp png_ptr, png_const_inforp info_ptr,
int *unit,
2169 PNG_FP_EXPORT(170,
void, png_set_sCAL, (png_const_structrp png_ptr,
2170 png_inforp info_ptr,
int unit,
double width,
double height))
2174 PNG_EXPORT(171,
void, png_set_sCAL_s, (png_const_structrp png_ptr,
2175 png_inforp info_ptr,
int unit,
2179 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
2278 #ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
2279 PNG_EXPORT(172,
void, png_set_keep_unknown_chunks, (png_structrp png_ptr,
2287 PNG_EXPORT(173,
int, png_handle_as_unknown, (png_const_structrp png_ptr,
2291 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
2292 PNG_EXPORT(174,
void, png_set_unknown_chunks, (png_const_structrp png_ptr,
2293 png_inforp info_ptr, png_const_unknown_chunkp unknowns,
2304 PNG_EXPORT(175,
void, png_set_unknown_chunk_location,
2305 (png_const_structrp png_ptr, png_inforp info_ptr,
int chunk,
int location));
2307 PNG_EXPORT(176,
int, png_get_unknown_chunks, (png_const_structrp png_ptr,
2308 png_inforp info_ptr, png_unknown_chunkpp entries));
2315 PNG_EXPORT(177,
void, png_set_invalid, (png_const_structrp png_ptr,
2316 png_inforp info_ptr,
int mask));
2318 #ifdef PNG_INFO_IMAGE_SUPPORTED
2320 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED
2321 PNG_EXPORT(178,
void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr,
2324 #ifdef PNG_WRITE_SUPPORTED
2325 PNG_EXPORT(179,
void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr,
2331 (png_const_structrp png_ptr));
2333 (png_const_structrp png_ptr));
2335 (png_const_structrp png_ptr));
2337 (png_const_structrp png_ptr));
2339 #ifdef PNG_MNG_FEATURES_SUPPORTED
2340 PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structrp png_ptr,
2341 png_uint_32 mng_features_permitted));
2345 #define PNG_HANDLE_CHUNK_AS_DEFAULT 0
2346 #define PNG_HANDLE_CHUNK_NEVER 1
2347 #define PNG_HANDLE_CHUNK_IF_SAFE 2
2348 #define PNG_HANDLE_CHUNK_ALWAYS 3
2349 #define PNG_HANDLE_CHUNK_LAST 4
2354 #ifdef PNG_ERROR_NUMBERS_SUPPORTED
2355 PNG_EXPORT(185,
void, png_set_strip_error_numbers, (png_structrp png_ptr,
2356 png_uint_32 strip_mode));
2360 #ifdef PNG_SET_USER_LIMITS_SUPPORTED
2361 PNG_EXPORT(186,
void, png_set_user_limits, (png_structrp png_ptr,
2362 png_uint_32 user_width_max, png_uint_32 user_height_max));
2363 PNG_EXPORT(187, png_uint_32, png_get_user_width_max,
2364 (png_const_structrp png_ptr));
2365 PNG_EXPORT(188, png_uint_32, png_get_user_height_max,
2366 (png_const_structrp png_ptr));
2368 PNG_EXPORT(189,
void, png_set_chunk_cache_max, (png_structrp png_ptr,
2369 png_uint_32 user_chunk_cache_max));
2370 PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max,
2371 (png_const_structrp png_ptr));
2373 PNG_EXPORT(191,
void, png_set_chunk_malloc_max, (png_structrp png_ptr,
2376 (png_const_structrp png_ptr));
2379 #if defined(PNG_INCH_CONVERSIONS_SUPPORTED)
2380 PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch,
2381 (png_const_structrp png_ptr, png_const_inforp info_ptr));
2383 PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch,
2384 (png_const_structrp png_ptr, png_const_inforp info_ptr));
2386 PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch,
2387 (png_const_structrp png_ptr, png_const_inforp info_ptr));
2390 (png_const_structrp png_ptr, png_const_inforp info_ptr))
2391 #ifdef PNG_FIXED_POINT_SUPPORTED
2393 (png_const_structrp png_ptr, png_const_inforp info_ptr))
2396 PNG_FP_EXPORT(197,
float, png_get_y_offset_inches, (png_const_structrp png_ptr,
2397 png_const_inforp info_ptr))
2398 #ifdef PNG_FIXED_POINT_SUPPORTED
2400 (png_const_structrp png_ptr, png_const_inforp info_ptr))
2403 # ifdef PNG_pHYs_SUPPORTED
2404 PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr,
2405 png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y,
2411 #ifdef PNG_IO_STATE_SUPPORTED
2412 PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_const_structrp png_ptr));
2419 (png_const_structrp png_ptr));
2422 # define PNG_IO_NONE 0x0000
2423 # define PNG_IO_READING 0x0001
2424 # define PNG_IO_WRITING 0x0002
2425 # define PNG_IO_SIGNATURE 0x0010
2426 # define PNG_IO_CHUNK_HDR 0x0020
2427 # define PNG_IO_CHUNK_DATA 0x0040
2428 # define PNG_IO_CHUNK_CRC 0x0080
2429 # define PNG_IO_MASK_OP 0x000f
2430 # define PNG_IO_MASK_LOC 0x00f0
2437 #define PNG_INTERLACE_ADAM7_PASSES 7
2443 #define PNG_PASS_START_ROW(pass) (((1&~(pass))<<(3-((pass)>>1)))&7)
2444 #define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7)
2451 #define PNG_PASS_ROW_OFFSET(pass) ((pass)>2?(8>>(((pass)-1)>>1)):8)
2452 #define PNG_PASS_COL_OFFSET(pass) (1<<((7-(pass))>>1))
2458 #define PNG_PASS_ROW_SHIFT(pass) ((pass)>2?(8-(pass))>>1:3)
2459 #define PNG_PASS_COL_SHIFT(pass) ((pass)>1?(7-(pass))>>1:3)
2466 #define PNG_PASS_ROWS(height, pass) (((height)+(((1<<PNG_PASS_ROW_SHIFT(pass))\
2467 -1)-PNG_PASS_START_ROW(pass)))>>PNG_PASS_ROW_SHIFT(pass))
2468 #define PNG_PASS_COLS(width, pass) (((width)+(((1<<PNG_PASS_COL_SHIFT(pass))\
2469 -1)-PNG_PASS_START_COL(pass)))>>PNG_PASS_COL_SHIFT(pass))
2475 #define PNG_ROW_FROM_PASS_ROW(y_in, pass) \
2476 (((y_in)<<PNG_PASS_ROW_SHIFT(pass))+PNG_PASS_START_ROW(pass))
2477 #define PNG_COL_FROM_PASS_COL(x_in, pass) \
2478 (((x_in)<<PNG_PASS_COL_SHIFT(pass))+PNG_PASS_START_COL(pass))
2486 #define PNG_PASS_MASK(pass,off) ( \
2487 ((0x110145AF>>(((7-(off))-(pass))<<2)) & 0xF) | \
2488 ((0x01145AF0>>(((7-(off))-(pass))<<2)) & 0xF0))
2490 #define PNG_ROW_IN_INTERLACE_PASS(y, pass) \
2491 ((PNG_PASS_MASK(pass,0) >> ((y)&7)) & 1)
2492 #define PNG_COL_IN_INTERLACE_PASS(x, pass) \
2493 ((PNG_PASS_MASK(pass,1) >> ((x)&7)) & 1)
2495 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED
2510 # define png_composite(composite, fg, alpha, bg) \
2512 png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \
2513 * (png_uint_16)(alpha) \
2514 + (png_uint_16)(bg)*(png_uint_16)(255 \
2515 - (png_uint_16)(alpha)) + 128); \
2516 (composite) = (png_byte)(((temp + (temp >> 8)) >> 8) & 0xff); \
2519 # define png_composite_16(composite, fg, alpha, bg) \
2521 png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \
2522 * (png_uint_32)(alpha) \
2523 + (png_uint_32)(bg)*(65535 \
2524 - (png_uint_32)(alpha)) + 32768); \
2525 (composite) = (png_uint_16)(0xffff & ((temp + (temp >> 16)) >> 16)); \
2530 # define png_composite(composite, fg, alpha, bg) \
2532 (png_byte)(0xff & (((png_uint_16)(fg) * (png_uint_16)(alpha) + \
2533 (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \
2536 # define png_composite_16(composite, fg, alpha, bg) \
2538 (png_uint_16)(0xffff & (((png_uint_32)(fg) * (png_uint_32)(alpha) + \
2539 (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \
2543 #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED
2549 PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_const_structrp png_ptr,
2554 #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
2557 #ifdef PNG_SAVE_INT_32_SUPPORTED
2565 #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED
2570 #ifdef PNG_USE_READ_MACROS
2575 # define PNG_get_uint_32(buf) \
2576 (((png_uint_32)(*(buf)) << 24) + \
2577 ((png_uint_32)(*((buf) + 1)) << 16) + \
2578 ((png_uint_32)(*((buf) + 2)) << 8) + \
2579 ((png_uint_32)(*((buf) + 3))))
2584 # define PNG_get_uint_16(buf) \
2586 (((unsigned int)(*(buf)) << 8) + \
2587 ((unsigned int)(*((buf) + 1)))))
2589 # define PNG_get_int_32(buf) \
2590 ((png_int_32)((*(buf) & 0x80) \
2591 ? -((png_int_32)(((png_get_uint_32(buf)^0xffffffffU)+1U)&0x7fffffffU)) \
2592 : (png_int_32)png_get_uint_32(buf)))
2598 # define png_get_uint_32(buf) PNG_get_uint_32(buf)
2599 # define png_get_uint_16(buf) PNG_get_uint_16(buf)
2600 # define png_get_int_32(buf) PNG_get_int_32(buf)
2605 # define PNG_get_uint_32 (png_get_uint_32)
2606 # define PNG_get_uint_16 (png_get_uint_16)
2607 # define PNG_get_int_32 (png_get_int_32)
2611 #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
2612 PNG_EXPORT(242,
void, png_set_check_for_invalid_index,
2613 (png_structrp png_ptr,
int allowed));
2614 # ifdef PNG_GET_PALETTE_MAX_SUPPORTED
2615 PNG_EXPORT(243,
int, png_get_palette_max, (png_const_structp png_ptr,
2616 png_const_infop info_ptr));
2666 #if defined(PNG_SIMPLIFIED_READ_SUPPORTED) || \
2667 defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
2669 #define PNG_IMAGE_VERSION 1
2692 # define PNG_IMAGE_WARNING 1
2693 # define PNG_IMAGE_ERROR 2
2703 # define PNG_IMAGE_FAILED(png_cntrl) ((((png_cntrl).warning_or_error)&0x03)>1)
2778 #define PNG_FORMAT_FLAG_ALPHA 0x01U
2779 #define PNG_FORMAT_FLAG_COLOR 0x02U
2780 #define PNG_FORMAT_FLAG_LINEAR 0x04U
2781 #define PNG_FORMAT_FLAG_COLORMAP 0x08U
2783 #ifdef PNG_FORMAT_BGR_SUPPORTED
2784 # define PNG_FORMAT_FLAG_BGR 0x10U
2787 #ifdef PNG_FORMAT_AFIRST_SUPPORTED
2788 # define PNG_FORMAT_FLAG_AFIRST 0x20U
2791 #define PNG_FORMAT_FLAG_ASSOCIATED_ALPHA 0x40U
2797 #define PNG_FORMAT_GRAY 0
2798 #define PNG_FORMAT_GA PNG_FORMAT_FLAG_ALPHA
2799 #define PNG_FORMAT_AG (PNG_FORMAT_GA|PNG_FORMAT_FLAG_AFIRST)
2800 #define PNG_FORMAT_RGB PNG_FORMAT_FLAG_COLOR
2801 #define PNG_FORMAT_BGR (PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_BGR)
2802 #define PNG_FORMAT_RGBA (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_ALPHA)
2803 #define PNG_FORMAT_ARGB (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_AFIRST)
2804 #define PNG_FORMAT_BGRA (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_ALPHA)
2805 #define PNG_FORMAT_ABGR (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_AFIRST)
2810 #define PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR
2811 #define PNG_FORMAT_LINEAR_Y_ALPHA (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_ALPHA)
2812 #define PNG_FORMAT_LINEAR_RGB (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR)
2813 #define PNG_FORMAT_LINEAR_RGB_ALPHA \
2814 (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA)
2821 #define PNG_FORMAT_RGB_COLORMAP (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_COLORMAP)
2822 #define PNG_FORMAT_BGR_COLORMAP (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_COLORMAP)
2823 #define PNG_FORMAT_RGBA_COLORMAP (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_COLORMAP)
2824 #define PNG_FORMAT_ARGB_COLORMAP (PNG_FORMAT_ARGB|PNG_FORMAT_FLAG_COLORMAP)
2825 #define PNG_FORMAT_BGRA_COLORMAP (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_COLORMAP)
2826 #define PNG_FORMAT_ABGR_COLORMAP (PNG_FORMAT_ABGR|PNG_FORMAT_FLAG_COLORMAP)
2846 #define PNG_IMAGE_SAMPLE_CHANNELS(fmt)\
2847 (((fmt)&(PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA))+1)
2850 #define PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt)\
2851 ((((fmt) & PNG_FORMAT_FLAG_LINEAR) >> 2)+1)
2856 #define PNG_IMAGE_SAMPLE_SIZE(fmt)\
2857 (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt))
2863 #define PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(fmt)\
2864 (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * 256)
2879 #define PNG_IMAGE_PIXEL_(test,fmt)\
2880 (((fmt)&PNG_FORMAT_FLAG_COLORMAP)?1:test(fmt))
2882 #define PNG_IMAGE_PIXEL_CHANNELS(fmt)\
2883 PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_CHANNELS,fmt)
2888 #define PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)\
2889 PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_COMPONENT_SIZE,fmt)
2894 #define PNG_IMAGE_PIXEL_SIZE(fmt) PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_SIZE,fmt)
2898 #define PNG_IMAGE_ROW_STRIDE(image)\
2899 (PNG_IMAGE_PIXEL_CHANNELS((image).format) * (image).width)
2910 #define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\
2911 (PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride))
2919 #define PNG_IMAGE_SIZE(image)\
2920 PNG_IMAGE_BUFFER_SIZE(image, PNG_IMAGE_ROW_STRIDE(image))
2925 #define PNG_IMAGE_COLORMAP_SIZE(image)\
2926 (PNG_IMAGE_SAMPLE_SIZE((image).format) * (image).colormap_entries)
2938 #define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01
2943 #define PNG_IMAGE_FLAG_FAST 0x02
2954 #define PNG_IMAGE_FLAG_16BIT_sRGB 0x04
2972 #ifdef PNG_SIMPLIFIED_READ_SUPPORTED
2979 #ifdef PNG_STDIO_SUPPORTED
2980 PNG_EXPORT(234,
int, png_image_begin_read_from_file, (png_imagep
image,
2981 const char *file_name));
2986 PNG_EXPORT(235,
int, png_image_begin_read_from_stdio, (png_imagep
image,
2991 PNG_EXPORT(236,
int, png_image_begin_read_from_memory, (png_imagep
image,
2996 png_const_colorp background,
void *
buffer, png_int_32 row_stride,
3036 #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED
3053 #ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED
3055 const char *file,
int convert_to_8bit,
const void *
buffer,
3056 png_int_32 row_stride,
const void *colormap));
3059 PNG_EXPORT(240,
int, png_image_write_to_stdio, (png_imagep
image, FILE *file,
3060 int convert_to_8_bit,
const void *
buffer, png_int_32 row_stride,
3061 const void *colormap));
3088 const void *
buffer, png_int_32 row_stride,
const void *colormap));
3111 #define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\
3112 row_stride, colormap)\
3113 png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\
3114 row_stride, colormap)
3130 #define PNG_IMAGE_DATA_SIZE(image) (PNG_IMAGE_SIZE(image)+(image).height)
3140 #ifndef PNG_ZLIB_MAX_SIZE
3141 # define PNG_ZLIB_MAX_SIZE(b) ((b)+(((b)+7U)>>3)+(((b)+63U)>>6)+11U)
3150 #define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\
3151 PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image))
3154 #define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\
3155 ((8U+25U+16U+44U+12U+\
3156 (((image).format&PNG_FORMAT_FLAG_COLORMAP)?\
3157 12U+3U*(image).colormap_entries+\
3158 (((image).format&PNG_FORMAT_FLAG_ALPHA)?\
3159 12U+(image).colormap_entries:0U):0U)+\
3160 12U)+(12U*((image_size)/PNG_ZBUF_SIZE))+(image_size))
3167 #define PNG_IMAGE_PNG_SIZE_MAX(image)\
3168 PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image))
3201 #ifdef PNG_SET_OPTION_SUPPORTED
3202 #ifdef PNG_ARM_NEON_API_SUPPORTED
3203 # define PNG_ARM_NEON 0
3205 #define PNG_MAXIMUM_INFLATE_WINDOW 2
3206 #define PNG_SKIP_sRGB_CHECK_PROFILE 4
3207 #ifdef PNG_MIPS_MSA_API_SUPPORTED
3208 # define PNG_MIPS_MSA 6
3210 #define PNG_IGNORE_ADLER32 8
3211 #ifdef PNG_POWERPC_VSX_API_SUPPORTED
3212 # define PNG_POWERPC_VSX 10
3214 #define PNG_OPTION_NEXT 12
3217 #define PNG_OPTION_UNSET 0
3218 #define PNG_OPTION_INVALID 1
3219 #define PNG_OPTION_OFF 2
3220 #define PNG_OPTION_ON 3
3222 PNG_EXPORT(244,
int, png_set_option, (png_structrp png_ptr,
int option,
3237 #ifdef PNG_EXPORT_LAST_ORDINAL
3238 PNG_EXPORT_LAST_ORDINAL(249);
GLsizei GLenum GLsizei GLsizei GLuint memory
OIIO_API std::vector< imagesize_t > histogram(const ImageBuf &src, int channel=0, int bins=256, float min=0.0f, float max=1.0f, bool ignore_empty=false, ROI roi={}, int nthreads=0)
const png_sPLT_entry * png_const_sPLT_entryp
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point * int_red_Z
GLuint GLsizei const GLchar * message
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point * int_red_X
png_color_16 ** png_color_16pp
GLenum GLuint GLenum GLsizei const GLchar * buf
struct png_sPLT_struct png_sPLT_t
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_get_cHRM_XYZ_fixed
png_const_structrp png_const_inforp info_ptr
PNG_FP_EXPORT(32, void, png_set_rgb_to_gray,(png_structrp png_ptr, int error_action, double red, double green)) PNG_FIXED_EXPORT(33
png_sPLT_t ** png_sPLT_tpp
png_unknown_chunk ** png_unknown_chunkpp
PNG_EXPORTA(4, png_structp, png_create_read_struct,(png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warn_fn), PNG_ALLOCATED)
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_blue_Y
const png_color * png_const_colorp
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed,(png_const_structrp png_ptr, png_const_inforp info_ptr, png_fixed_point *int_white_x, png_fixed_point *int_white_y, png_fixed_point *int_red_x, png_fixed_point *int_red_y, png_fixed_point *int_green_x, png_fixed_point *int_green_y, png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)) PNG_FIXED_EXPORT(231
#define png_get_int_32(buf)
png_const_structrp png_const_inforp double double double double double double * green_Z
png_structrp int int num_weights
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point *int_blue_Z png_const_structrp png_inforp double double double double double double double double double blue_Z png_set_cHRM_XYZ_fixed
#define png_get_uint_32(buf)
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_blue_X
const png_color_8 * png_const_color_8p
png_get_pixel_aspect_ratio_fixed
GLuint GLsizei GLsizei * length
const png_text * png_const_textp
PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name,(png_structrp png_ptr), PNG_DEPRECATED) PNG_EXPORT(216
png_color_16 * png_color_16p
struct png_struct_def png_struct
png_struct *PNG_RESTRICT png_structrp
GLenum GLenum GLsizei void * image
png_uint_32 warning_or_error
struct png_text_struct png_text
png_int_32 png_fixed_point
struct png_control * png_controlp
struct png_info_def png_info
GLenum const GLfloat * params
struct png_sPLT_entry_struct png_sPLT_entry
png_color_8 ** png_color_8pp
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point * int_red_Y
png_set_filter_heuristics_fixed
png_structrp int error_action
struct png_image * png_imagep
png_const_structrp png_const_inforp double double double * red_Z
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_green_Y
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_green_Z
png_sPLT_entry * png_sPLT_entryp
GLint GLsizei GLsizei height
const png_struct *PNG_RESTRICT png_const_structrp
PNG_EXPORT(1, png_uint_32, png_access_version_number,(void))
struct png_color_8_struct png_color_8
png_const_structrp png_const_inforp double * red_X
png_color_8 * png_color_8p
struct png_color_struct png_color
char * png_libpng_version_1_6_36
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point png_fixed_point *int_blue_Z png_set_cHRM_XYZ
png_get_x_offset_inches_fixed
png_structrp png_const_color_16p background_color
png_info *PNG_RESTRICT png_inforp
png_unknown_chunk * png_unknown_chunkp
struct png_time_struct png_time
const png_info *PNG_RESTRICT png_const_inforp
png_structrp png_const_color_16p int background_gamma_code
const png_info * png_const_infop
png_const_structrp png_const_inforp int * unit
png_const_structrp png_const_inforp png_fixed_point *int_file_gamma png_set_gAMA_fixed
PNG_FUNCTION(void,(PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef)
GLuint const GLchar * name
png_const_structrp png_const_inforp info_ptr png_get_y_offset_inches_fixed
png_const_structrp png_const_inforp double double double double * green_X
png_const_structrp png_const_inforp double double double double double double double * blue_X
png_const_structrp png_const_inforp double double double double double double double double * blue_Y
struct png_row_info_struct png_row_info
const png_struct * png_const_structp
png_structrp png_fixed_point screen_gamma
#define png_get_uint_16(buf)
png_structrp png_const_color_16p int int need_expand
png_set_rgb_to_gray_fixed
png_const_structrp png_const_inforp double double double double double * green_Y
typedef PNG_CALLBACK(void,*png_error_ptr,(png_structp, png_const_charp))
const png_unknown_chunk * png_const_unknown_chunkp
png_struct ** png_structpp
const png_sPLT_t * png_const_sPLT_tp
struct png_color_16_struct png_color_16
png_const_structrp png_const_inforp double double * red_Y
png_sPLT_entry ** png_sPLT_entrypp
struct png_unknown_chunk_t png_unknown_chunk
const char * png_const_charp
png_const_structrp png_const_inforp double double double double double double double double double *blue_Z png_const_structrp png_const_inforp png_fixed_point png_fixed_point png_fixed_point png_fixed_point * int_green_X
png_uint_16 * png_uint_16p
GLenum GLenum GLsizei void * row
png_row_info * png_row_infop
png_uint_32 colormap_entries
const png_byte * png_const_bytep
const png_color_16 * png_const_color_16p
png_structrp int heuristic_method
png_structrp int png_fixed_point red
png_row_info ** png_row_infopp
png_structrp int int png_const_fixed_point_p filter_weights
const png_time * png_const_timep
const png_uint_16 * png_const_uint_16p
const png_fixed_point * png_const_fixed_point_p
const void * png_const_voidp