Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 | 1 |
| 2 /* png.h - header file for PNG reference library | 2 /* png.h - header file for PNG reference library |
| 3 * | 3 * |
| 4 * libpng version 1.6.3 - July 18, 2013 | 4 * libpng version 1.6.3 - July 18, 2013 |
| 5 * Copyright (c) 1998-2013 Glenn Randers-Pehrson | 5 * Copyright (c) 1998-2013 Glenn Randers-Pehrson |
| 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) | 6 * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) |
| 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) | 7 * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) |
| 8 * | 8 * |
| 9 * This code is released under the libpng license (See LICENSE, below) | 9 * This code is released under the libpng license (See LICENSE, below) |
|
Nico
2015/08/04 18:57:31
Hm, I guess this file shouldn't be formatted.
Tom Sepez
2015/08/04 19:03:32
Right, the samples/fx_lpng stuff is actually third
| |
| 10 * | 10 * |
| 11 * Authors and maintainers: | 11 * Authors and maintainers: |
| 12 * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat | 12 * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat |
| 13 * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger | 13 * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger |
| 14 * libpng versions 0.97, January 1998, through 1.6.3 - July 18, 2013: Glenn | 14 * libpng versions 0.97, January 1998, through 1.6.3 - July 18, 2013: Glenn |
| 15 * See also "Contributing Authors", below. | 15 * See also "Contributing Authors", below. |
| 16 * | 16 * |
| 17 * Note about libpng version numbers: | 17 * Note about libpng version numbers: |
| 18 * | 18 * |
| 19 * Due to various miscommunications, unforeseen code incompatibilities | 19 * Due to various miscommunications, unforeseen code incompatibilities |
| (...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 472 #define png_set_crc_action FOXIT_png_set_crc_action | 472 #define png_set_crc_action FOXIT_png_set_crc_action |
| 473 #define png_set_filter FOXIT_png_set_filter | 473 #define png_set_filter FOXIT_png_set_filter |
| 474 #define png_set_filter_heuristics FOXIT_png_set_filter_heuristics | 474 #define png_set_filter_heuristics FOXIT_png_set_filter_heuristics |
| 475 #define png_set_filter_heuristics_fixed FOXIT_png_set_filter_heuristics_fixed | 475 #define png_set_filter_heuristics_fixed FOXIT_png_set_filter_heuristics_fixed |
| 476 #define png_set_compression_level FOXIT_png_set_compression_level | 476 #define png_set_compression_level FOXIT_png_set_compression_level |
| 477 #define png_set_compression_mem_level FOXIT_png_set_compression_mem_level | 477 #define png_set_compression_mem_level FOXIT_png_set_compression_mem_level |
| 478 #define png_set_compression_strategy FOXIT_png_set_compression_strategy | 478 #define png_set_compression_strategy FOXIT_png_set_compression_strategy |
| 479 #define png_set_compression_window_bits FOXIT_png_set_compression_window_bits | 479 #define png_set_compression_window_bits FOXIT_png_set_compression_window_bits |
| 480 #define png_set_compression_method FOXIT_png_set_compression_method | 480 #define png_set_compression_method FOXIT_png_set_compression_method |
| 481 #define png_set_text_compression_level FOXIT_png_set_text_compression_level | 481 #define png_set_text_compression_level FOXIT_png_set_text_compression_level |
| 482 #define png_set_text_compression_mem_level FOXIT_png_set_text_compression_mem_le vel | 482 #define png_set_text_compression_mem_level \ |
| 483 #define png_set_text_compression_strategy FOXIT_png_set_text_compression_strateg y | 483 FOXIT_png_set_text_compression_mem_level |
| 484 #define png_set_text_compression_window_bits FOXIT_png_set_text_compression_wind ow_bits | 484 #define png_set_text_compression_strategy \ |
| 485 FOXIT_png_set_text_compression_strategy | |
| 486 #define png_set_text_compression_window_bits \ | |
| 487 FOXIT_png_set_text_compression_window_bits | |
| 485 #define png_set_text_compression_method FOXIT_png_set_text_compression_method | 488 #define png_set_text_compression_method FOXIT_png_set_text_compression_method |
| 486 #define png_set_error_fn FOXIT_png_set_error_fn | 489 #define png_set_error_fn FOXIT_png_set_error_fn |
| 487 #define png_get_error_ptr FOXIT_png_get_error_ptr | 490 #define png_get_error_ptr FOXIT_png_get_error_ptr |
| 488 #define png_set_write_fn FOXIT_png_set_write_fn | 491 #define png_set_write_fn FOXIT_png_set_write_fn |
| 489 #define png_set_read_fn FOXIT_png_set_read_fn | 492 #define png_set_read_fn FOXIT_png_set_read_fn |
| 490 #define png_set_read_status_fn FOXIT_png_set_read_status_fn | 493 #define png_set_read_status_fn FOXIT_png_set_read_status_fn |
| 491 #define png_set_write_status_fn FOXIT_png_set_write_status_fn | 494 #define png_set_write_status_fn FOXIT_png_set_write_status_fn |
| 492 #define png_set_read_user_transform_fn FOXIT_png_set_read_user_transform_fn | 495 #define png_set_read_user_transform_fn FOXIT_png_set_read_user_transform_fn |
| 493 #define png_set_write_user_transform_fn FOXIT_png_set_write_user_transform_fn | 496 #define png_set_write_user_transform_fn FOXIT_png_set_write_user_transform_fn |
| 494 #define png_set_user_transform_info FOXIT_png_set_user_transform_info | 497 #define png_set_user_transform_info FOXIT_png_set_user_transform_info |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 637 #define png_pass_dsp_mask FOXIT_png_pass_dsp_mask | 640 #define png_pass_dsp_mask FOXIT_png_pass_dsp_mask |
| 638 #define png_pass_inc FOXIT_png_pass_inc | 641 #define png_pass_inc FOXIT_png_pass_inc |
| 639 #define png_pass_mask FOXIT_png_pass_mask | 642 #define png_pass_mask FOXIT_png_pass_mask |
| 640 #define png_pass_start FOXIT_png_pass_start | 643 #define png_pass_start FOXIT_png_pass_start |
| 641 #define png_pass_yinc FOXIT_png_pass_yinc | 644 #define png_pass_yinc FOXIT_png_pass_yinc |
| 642 #define png_pass_ystart FOXIT_png_pass_ystart | 645 #define png_pass_ystart FOXIT_png_pass_ystart |
| 643 #define png_set_mem_fn FOXIT_png_set_mem_fn | 646 #define png_set_mem_fn FOXIT_png_set_mem_fn |
| 644 | 647 |
| 645 /* Version information for png.h - this should match the version in png.c */ | 648 /* Version information for png.h - this should match the version in png.c */ |
| 646 #define PNG_LIBPNG_VER_STRING "1.6.3" | 649 #define PNG_LIBPNG_VER_STRING "1.6.3" |
| 647 #define PNG_HEADER_VERSION_STRING \ | 650 #define PNG_HEADER_VERSION_STRING " libpng version 1.6.3 - July 18, 2013\n" |
| 648 " libpng version 1.6.3 - July 18, 2013\n" | |
| 649 | 651 |
| 650 #define PNG_LIBPNG_VER_SONUM 16 | 652 #define PNG_LIBPNG_VER_SONUM 16 |
| 651 #define PNG_LIBPNG_VER_DLLNUM 16 | 653 #define PNG_LIBPNG_VER_DLLNUM 16 |
| 652 | 654 |
| 653 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ | 655 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ |
| 654 #define PNG_LIBPNG_VER_MAJOR 1 | 656 #define PNG_LIBPNG_VER_MAJOR 1 |
| 655 #define PNG_LIBPNG_VER_MINOR 6 | 657 #define PNG_LIBPNG_VER_MINOR 6 |
| 656 #define PNG_LIBPNG_VER_RELEASE 3 | 658 #define PNG_LIBPNG_VER_RELEASE 3 |
| 657 | 659 |
| 658 /* This should match the numeric part of the final component of | 660 /* This should match the numeric part of the final component of |
| 659 * PNG_LIBPNG_VER_STRING, omitting any leading zero: | 661 * PNG_LIBPNG_VER_STRING, omitting any leading zero: |
| 660 */ | 662 */ |
| 661 | 663 |
| 662 #define PNG_LIBPNG_VER_BUILD 0 | 664 #define PNG_LIBPNG_VER_BUILD 0 |
| 663 | 665 |
| 664 /* Release Status */ | 666 /* Release Status */ |
| 665 #define PNG_LIBPNG_BUILD_ALPHA 1 | 667 #define PNG_LIBPNG_BUILD_ALPHA 1 |
| 666 #define PNG_LIBPNG_BUILD_BETA 2 | 668 #define PNG_LIBPNG_BUILD_BETA 2 |
| 667 #define PNG_LIBPNG_BUILD_RC 3 | 669 #define PNG_LIBPNG_BUILD_RC 3 |
| 668 #define PNG_LIBPNG_BUILD_STABLE 4 | 670 #define PNG_LIBPNG_BUILD_STABLE 4 |
| 669 #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7 | 671 #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7 |
| 670 | 672 |
| 671 /* Release-Specific Flags */ | 673 /* Release-Specific Flags */ |
| 672 #define PNG_LIBPNG_BUILD_PATCH 8 /* Can be OR'ed with | 674 #define PNG_LIBPNG_BUILD_PATCH \ |
| 673 PNG_LIBPNG_BUILD_STABLE only */ | 675 8 /* Can be OR'ed with \ |
| 674 #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with | 676 PNG_LIBPNG_BUILD_STABLE only */ |
| 675 PNG_LIBPNG_BUILD_SPECIAL */ | 677 #define PNG_LIBPNG_BUILD_PRIVATE \ |
| 676 #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with | 678 16 /* Cannot be OR'ed with \ |
| 677 PNG_LIBPNG_BUILD_PRIVATE */ | 679 PNG_LIBPNG_BUILD_SPECIAL */ |
| 680 #define PNG_LIBPNG_BUILD_SPECIAL \ | |
| 681 32 /* Cannot be OR'ed with \ | |
| 682 PNG_LIBPNG_BUILD_PRIVATE */ | |
| 678 | 683 |
| 679 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE | 684 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE |
| 680 | 685 |
| 681 /* Careful here. At one time, Guy wanted to use 082, but that would be octal. | 686 /* Careful here. At one time, Guy wanted to use 082, but that would be octal. |
| 682 * We must not include leading zeros. | 687 * We must not include leading zeros. |
| 683 * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only | 688 * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only |
| 684 * version 1.0.0 was mis-numbered 100 instead of 10000). From | 689 * version 1.0.0 was mis-numbered 100 instead of 10000). From |
| 685 * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release | 690 * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release |
| 686 */ | 691 */ |
| 687 #define PNG_LIBPNG_VER 10603 /* 1.6.3 */ | 692 #define PNG_LIBPNG_VER 10603 /* 1.6.3 */ |
| 688 | 693 |
| 689 /* Library configuration: these options cannot be changed after | 694 /* Library configuration: these options cannot be changed after |
| 690 * the library has been built. | 695 * the library has been built. |
| 691 */ | 696 */ |
| 692 #ifndef PNGLCONF_H | 697 #ifndef PNGLCONF_H |
| 693 /* If pnglibconf.h is missing, you can | 698 /* If pnglibconf.h is missing, you can |
| 694 * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h | 699 * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h |
| 695 */ | 700 */ |
| 696 # include "pnglibconf.h" | 701 #include "pnglibconf.h" |
| 697 #endif | 702 #endif |
| 698 | 703 |
| 699 #ifndef PNG_VERSION_INFO_ONLY | 704 #ifndef PNG_VERSION_INFO_ONLY |
| 700 /* Machine specific configuration. */ | 705 /* Machine specific configuration. */ |
| 701 # include "pngconf.h" | 706 #include "pngconf.h" |
| 702 #endif | 707 #endif |
| 703 | 708 |
| 704 /* | 709 /* |
| 705 * Added at libpng-1.2.8 | 710 * Added at libpng-1.2.8 |
| 706 * | 711 * |
| 707 * Ref MSDN: Private as priority over Special | 712 * Ref MSDN: Private as priority over Special |
| 708 * VS_FF_PRIVATEBUILD File *was not* built using standard release | 713 * VS_FF_PRIVATEBUILD File *was not* built using standard release |
| 709 * procedures. If this value is given, the StringFileInfo block must | 714 * procedures. If this value is given, the StringFileInfo block must |
| 710 * contain a PrivateBuild string. | 715 * contain a PrivateBuild string. |
| 711 * | 716 * |
| 712 * VS_FF_SPECIALBUILD File *was* built by the original company using | 717 * VS_FF_SPECIALBUILD File *was* built by the original company using |
| 713 * standard release procedures but is a variation of the standard | 718 * standard release procedures but is a variation of the standard |
| 714 * file of the same version number. If this value is given, the | 719 * file of the same version number. If this value is given, the |
| 715 * StringFileInfo block must contain a SpecialBuild string. | 720 * StringFileInfo block must contain a SpecialBuild string. |
| 716 */ | 721 */ |
| 717 | 722 |
| 718 #ifdef PNG_USER_PRIVATEBUILD /* From pnglibconf.h */ | 723 #ifdef PNG_USER_PRIVATEBUILD /* From pnglibconf.h */ |
| 719 # define PNG_LIBPNG_BUILD_TYPE \ | 724 #define PNG_LIBPNG_BUILD_TYPE \ |
| 720 (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE) | 725 (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_PRIVATE) |
| 721 #else | 726 #else |
| 722 # ifdef PNG_LIBPNG_SPECIALBUILD | 727 #ifdef PNG_LIBPNG_SPECIALBUILD |
| 723 # define PNG_LIBPNG_BUILD_TYPE \ | 728 #define PNG_LIBPNG_BUILD_TYPE \ |
| 724 (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL) | 729 (PNG_LIBPNG_BUILD_BASE_TYPE | PNG_LIBPNG_BUILD_SPECIAL) |
| 725 # else | 730 #else |
| 726 # define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE) | 731 #define PNG_LIBPNG_BUILD_TYPE (PNG_LIBPNG_BUILD_BASE_TYPE) |
| 727 # endif | 732 #endif |
| 728 #endif | 733 #endif |
| 729 | 734 |
| 730 #ifndef PNG_VERSION_INFO_ONLY | 735 #ifndef PNG_VERSION_INFO_ONLY |
| 731 | 736 |
| 732 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ | 737 /* Inhibit C++ name-mangling for libpng functions but not for system calls. */ |
| 733 #ifdef __cplusplus | 738 #ifdef __cplusplus |
| 734 extern "C" { | 739 extern "C" { |
| 735 #endif /* __cplusplus */ | 740 #endif /* __cplusplus */ |
| 736 | 741 |
| 737 /* Version information for C files, stored in png.c. This had better match | 742 /* Version information for C files, stored in png.c. This had better match |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 791 */ | 796 */ |
| 792 typedef char* png_libpng_version_1_6_3; | 797 typedef char* png_libpng_version_1_6_3; |
| 793 | 798 |
| 794 /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. | 799 /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. |
| 795 * | 800 * |
| 796 * png_struct is the cache of information used while reading or writing a single | 801 * png_struct is the cache of information used while reading or writing a single |
| 797 * PNG file. One of these is always required, although the simplified API | 802 * PNG file. One of these is always required, although the simplified API |
| 798 * (below) hides the creation and destruction of it. | 803 * (below) hides the creation and destruction of it. |
| 799 */ | 804 */ |
| 800 typedef struct png_struct_def png_struct; | 805 typedef struct png_struct_def png_struct; |
| 801 typedef const png_struct * png_const_structp; | 806 typedef const png_struct* png_const_structp; |
| 802 typedef png_struct * png_structp; | 807 typedef png_struct* png_structp; |
| 803 typedef png_struct * * png_structpp; | 808 typedef png_struct** png_structpp; |
| 804 | 809 |
| 805 /* png_info contains information read from or to be written to a PNG file. One | 810 /* png_info contains information read from or to be written to a PNG file. One |
| 806 * or more of these must exist while reading or creating a PNG file. The | 811 * or more of these must exist while reading or creating a PNG file. The |
| 807 * information is not used by libpng during read but is used to control what | 812 * information is not used by libpng during read but is used to control what |
| 808 * gets written when a PNG file is created. "png_get_" function calls read | 813 * gets written when a PNG file is created. "png_get_" function calls read |
| 809 * information during read and "png_set_" functions calls write information | 814 * information during read and "png_set_" functions calls write information |
| 810 * when creating a PNG. | 815 * when creating a PNG. |
| 811 * been moved into a separate header file that is not accessible to | 816 * been moved into a separate header file that is not accessible to |
| 812 * applications. Read libpng-manual.txt or libpng.3 for more info. | 817 * applications. Read libpng-manual.txt or libpng.3 for more info. |
| 813 */ | 818 */ |
| 814 typedef struct png_info_def png_info; | 819 typedef struct png_info_def png_info; |
| 815 typedef png_info * png_infop; | 820 typedef png_info* png_infop; |
| 816 typedef const png_info * png_const_infop; | 821 typedef const png_info* png_const_infop; |
| 817 typedef png_info * * png_infopp; | 822 typedef png_info** png_infopp; |
| 818 | 823 |
| 819 /* Types with names ending 'p' are pointer types. The corresponding types with | 824 /* Types with names ending 'p' are pointer types. The corresponding types with |
| 820 * names ending 'rp' are identical pointer types except that the pointer is | 825 * names ending 'rp' are identical pointer types except that the pointer is |
| 821 * marked 'restrict', which means that it is the only pointer to the object | 826 * marked 'restrict', which means that it is the only pointer to the object |
| 822 * passed to the function. Applications should not use the 'restrict' types; | 827 * passed to the function. Applications should not use the 'restrict' types; |
| 823 * it is always valid to pass 'p' to a pointer with a function argument of the | 828 * it is always valid to pass 'p' to a pointer with a function argument of the |
| 824 * corresponding 'rp' type. Different compilers have different rules with | 829 * corresponding 'rp' type. Different compilers have different rules with |
| 825 * regard to type matching in the presence of 'restrict'. For backward | 830 * regard to type matching in the presence of 'restrict'. For backward |
| 826 * compatibility libpng callbacks never have 'restrict' in their parameters and, | 831 * compatibility libpng callbacks never have 'restrict' in their parameters and, |
| 827 * consequentially, writing portable application code is extremely difficult if | 832 * consequentially, writing portable application code is extremely difficult if |
| 828 * an attempt is made to use 'restrict'. | 833 * an attempt is made to use 'restrict'. |
| 829 */ | 834 */ |
| 830 typedef png_struct * PNG_RESTRICT png_structrp; | 835 typedef png_struct* PNG_RESTRICT png_structrp; |
| 831 typedef const png_struct * PNG_RESTRICT png_const_structrp; | 836 typedef const png_struct* PNG_RESTRICT png_const_structrp; |
| 832 typedef png_info * PNG_RESTRICT png_inforp; | 837 typedef png_info* PNG_RESTRICT png_inforp; |
| 833 typedef const png_info * PNG_RESTRICT png_const_inforp; | 838 typedef const png_info* PNG_RESTRICT png_const_inforp; |
| 834 | 839 |
| 835 /* Three color definitions. The order of the red, green, and blue, (and the | 840 /* Three color definitions. The order of the red, green, and blue, (and the |
| 836 * exact size) is not important, although the size of the fields need to | 841 * exact size) is not important, although the size of the fields need to |
| 837 * be png_byte or png_uint_16 (as defined below). | 842 * be png_byte or png_uint_16 (as defined below). |
| 838 */ | 843 */ |
| 839 typedef struct png_color_struct | 844 typedef struct png_color_struct { |
| 840 { | 845 png_byte red; |
| 841 png_byte red; | 846 png_byte green; |
| 842 png_byte green; | 847 png_byte blue; |
| 843 png_byte blue; | |
| 844 } png_color; | 848 } png_color; |
| 845 typedef png_color * png_colorp; | 849 typedef png_color* png_colorp; |
| 846 typedef const png_color * png_const_colorp; | 850 typedef const png_color* png_const_colorp; |
| 847 typedef png_color * * png_colorpp; | 851 typedef png_color** png_colorpp; |
| 848 | 852 |
| 849 typedef struct png_color_16_struct | 853 typedef struct png_color_16_struct { |
| 850 { | 854 png_byte index; /* used for palette files */ |
| 851 png_byte index; /* used for palette files */ | 855 png_uint_16 red; /* for use in red green blue files */ |
| 852 png_uint_16 red; /* for use in red green blue files */ | 856 png_uint_16 green; |
| 853 png_uint_16 green; | 857 png_uint_16 blue; |
| 854 png_uint_16 blue; | 858 png_uint_16 gray; /* for use in grayscale files */ |
| 855 png_uint_16 gray; /* for use in grayscale files */ | |
| 856 } png_color_16; | 859 } png_color_16; |
| 857 typedef png_color_16 * png_color_16p; | 860 typedef png_color_16* png_color_16p; |
| 858 typedef const png_color_16 * png_const_color_16p; | 861 typedef const png_color_16* png_const_color_16p; |
| 859 typedef png_color_16 * * png_color_16pp; | 862 typedef png_color_16** png_color_16pp; |
| 860 | 863 |
| 861 typedef struct png_color_8_struct | 864 typedef struct png_color_8_struct { |
| 862 { | 865 png_byte red; /* for use in red green blue files */ |
| 863 png_byte red; /* for use in red green blue files */ | 866 png_byte green; |
| 864 png_byte green; | 867 png_byte blue; |
| 865 png_byte blue; | 868 png_byte gray; /* for use in grayscale files */ |
| 866 png_byte gray; /* for use in grayscale files */ | 869 png_byte alpha; /* for alpha channel files */ |
| 867 png_byte alpha; /* for alpha channel files */ | |
| 868 } png_color_8; | 870 } png_color_8; |
| 869 typedef png_color_8 * png_color_8p; | 871 typedef png_color_8* png_color_8p; |
| 870 typedef const png_color_8 * png_const_color_8p; | 872 typedef const png_color_8* png_const_color_8p; |
| 871 typedef png_color_8 * * png_color_8pp; | 873 typedef png_color_8** png_color_8pp; |
| 872 | 874 |
| 873 /* | 875 /* |
| 874 * The following two structures are used for the in-core representation | 876 * The following two structures are used for the in-core representation |
| 875 * of sPLT chunks. | 877 * of sPLT chunks. |
| 876 */ | 878 */ |
| 877 typedef struct png_sPLT_entry_struct | 879 typedef struct png_sPLT_entry_struct { |
| 878 { | 880 png_uint_16 red; |
| 879 png_uint_16 red; | 881 png_uint_16 green; |
| 880 png_uint_16 green; | 882 png_uint_16 blue; |
| 881 png_uint_16 blue; | 883 png_uint_16 alpha; |
| 882 png_uint_16 alpha; | 884 png_uint_16 frequency; |
| 883 png_uint_16 frequency; | |
| 884 } png_sPLT_entry; | 885 } png_sPLT_entry; |
| 885 typedef png_sPLT_entry * png_sPLT_entryp; | 886 typedef png_sPLT_entry* png_sPLT_entryp; |
| 886 typedef const png_sPLT_entry * png_const_sPLT_entryp; | 887 typedef const png_sPLT_entry* png_const_sPLT_entryp; |
| 887 typedef png_sPLT_entry * * png_sPLT_entrypp; | 888 typedef png_sPLT_entry** png_sPLT_entrypp; |
| 888 | 889 |
| 889 /* When the depth of the sPLT palette is 8 bits, the color and alpha samples | 890 /* When the depth of the sPLT palette is 8 bits, the color and alpha samples |
| 890 * occupy the LSB of their respective members, and the MSB of each member | 891 * occupy the LSB of their respective members, and the MSB of each member |
| 891 * is zero-filled. The frequency member always occupies the full 16 bits. | 892 * is zero-filled. The frequency member always occupies the full 16 bits. |
| 892 */ | 893 */ |
| 893 | 894 |
| 894 typedef struct png_sPLT_struct | 895 typedef struct png_sPLT_struct { |
| 895 { | 896 png_charp name; /* palette name */ |
| 896 png_charp name; /* palette name */ | 897 png_byte depth; /* depth of palette samples */ |
| 897 png_byte depth; /* depth of palette samples */ | 898 png_sPLT_entryp entries; /* palette entries */ |
| 898 png_sPLT_entryp entries; /* palette entries */ | 899 png_int_32 nentries; /* number of palette entries */ |
| 899 png_int_32 nentries; /* number of palette entries */ | |
| 900 } png_sPLT_t; | 900 } png_sPLT_t; |
| 901 typedef png_sPLT_t * png_sPLT_tp; | 901 typedef png_sPLT_t* png_sPLT_tp; |
| 902 typedef const png_sPLT_t * png_const_sPLT_tp; | 902 typedef const png_sPLT_t* png_const_sPLT_tp; |
| 903 typedef png_sPLT_t * * png_sPLT_tpp; | 903 typedef png_sPLT_t** png_sPLT_tpp; |
| 904 | 904 |
| 905 #ifdef PNG_TEXT_SUPPORTED | 905 #ifdef PNG_TEXT_SUPPORTED |
| 906 /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file, | 906 /* png_text holds the contents of a text/ztxt/itxt chunk in a PNG file, |
| 907 * and whether that contents is compressed or not. The "key" field | 907 * and whether that contents is compressed or not. The "key" field |
| 908 * points to a regular zero-terminated C string. The "text" fields can be a | 908 * points to a regular zero-terminated C string. The "text" fields can be a |
| 909 * regular C string, an empty string, or a NULL pointer. | 909 * regular C string, an empty string, or a NULL pointer. |
| 910 * However, the structure returned by png_get_text() will always contain | 910 * However, the structure returned by png_get_text() will always contain |
| 911 * the "text" field as a regular zero-terminated C string (possibly | 911 * the "text" field as a regular zero-terminated C string (possibly |
| 912 * empty), never a NULL pointer, so it can be safely used in printf() and | 912 * empty), never a NULL pointer, so it can be safely used in printf() and |
| 913 * other string-handling functions. Note that the "itxt_length", "lang", and | 913 * other string-handling functions. Note that the "itxt_length", "lang", and |
| 914 * "lang_key" members of the structure only exist when the library is built | 914 * "lang_key" members of the structure only exist when the library is built |
| 915 * with iTXt chunk support. Prior to libpng-1.4.0 the library was built by | 915 * with iTXt chunk support. Prior to libpng-1.4.0 the library was built by |
| 916 * default without iTXt support. Also note that when iTXt *is* supported, | 916 * default without iTXt support. Also note that when iTXt *is* supported, |
| 917 * the "lang" and "lang_key" fields contain NULL pointers when the | 917 * the "lang" and "lang_key" fields contain NULL pointers when the |
| 918 * "compression" field contains * PNG_TEXT_COMPRESSION_NONE or | 918 * "compression" field contains * PNG_TEXT_COMPRESSION_NONE or |
| 919 * PNG_TEXT_COMPRESSION_zTXt. Note that the "compression value" is not the | 919 * PNG_TEXT_COMPRESSION_zTXt. Note that the "compression value" is not the |
| 920 * same as what appears in the PNG tEXt/zTXt/iTXt chunk's "compression flag" | 920 * same as what appears in the PNG tEXt/zTXt/iTXt chunk's "compression flag" |
| 921 * which is always 0 or 1, or its "compression method" which is always 0. | 921 * which is always 0 or 1, or its "compression method" which is always 0. |
| 922 */ | 922 */ |
| 923 typedef struct png_text_struct | 923 typedef struct png_text_struct { |
| 924 { | 924 int compression; /* compression value: |
| 925 int compression; /* compression value: | 925 -1: tEXt, none |
| 926 -1: tEXt, none | 926 0: zTXt, deflate |
| 927 0: zTXt, deflate | 927 1: iTXt, none |
| 928 1: iTXt, none | 928 2: iTXt, deflate */ |
| 929 2: iTXt, deflate */ | 929 png_charp key; /* keyword, 1-79 character description of "text" */ |
| 930 png_charp key; /* keyword, 1-79 character description of "text" */ | 930 png_charp text; /* comment, may be an empty string (ie "") |
| 931 png_charp text; /* comment, may be an empty string (ie "") | 931 or a NULL pointer */ |
| 932 or a NULL pointer */ | 932 png_size_t text_length; /* length of the text string */ |
| 933 png_size_t text_length; /* length of the text string */ | 933 png_size_t itxt_length; /* length of the itxt string */ |
| 934 png_size_t itxt_length; /* length of the itxt string */ | 934 png_charp lang; /* language code, 0-79 characters |
| 935 png_charp lang; /* language code, 0-79 characters | 935 or a NULL pointer */ |
| 936 or a NULL pointer */ | 936 png_charp lang_key; /* keyword translated UTF-8 string, 0 or more |
| 937 png_charp lang_key; /* keyword translated UTF-8 string, 0 or more | 937 chars or a NULL pointer */ |
| 938 chars or a NULL pointer */ | |
| 939 } png_text; | 938 } png_text; |
| 940 typedef png_text * png_textp; | 939 typedef png_text* png_textp; |
| 941 typedef const png_text * png_const_textp; | 940 typedef const png_text* png_const_textp; |
| 942 typedef png_text * * png_textpp; | 941 typedef png_text** png_textpp; |
| 943 #endif | 942 #endif |
| 944 | 943 |
| 945 /* Supported compression types for text in PNG files (tEXt, and zTXt). | 944 /* Supported compression types for text in PNG files (tEXt, and zTXt). |
| 946 * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */ | 945 * The values of the PNG_TEXT_COMPRESSION_ defines should NOT be changed. */ |
| 947 #define PNG_TEXT_COMPRESSION_NONE_WR -3 | 946 #define PNG_TEXT_COMPRESSION_NONE_WR -3 |
| 948 #define PNG_TEXT_COMPRESSION_zTXt_WR -2 | 947 #define PNG_TEXT_COMPRESSION_zTXt_WR -2 |
| 949 #define PNG_TEXT_COMPRESSION_NONE -1 | 948 #define PNG_TEXT_COMPRESSION_NONE -1 |
| 950 #define PNG_TEXT_COMPRESSION_zTXt 0 | 949 #define PNG_TEXT_COMPRESSION_zTXt 0 |
| 951 #define PNG_ITXT_COMPRESSION_NONE 1 | 950 #define PNG_ITXT_COMPRESSION_NONE 1 |
| 952 #define PNG_ITXT_COMPRESSION_zTXt 2 | 951 #define PNG_ITXT_COMPRESSION_zTXt 2 |
| 953 #define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */ | 952 #define PNG_TEXT_COMPRESSION_LAST 3 /* Not a valid value */ |
| 954 | 953 |
| 955 /* png_time is a way to hold the time in an machine independent way. | 954 /* png_time is a way to hold the time in an machine independent way. |
| 956 * Two conversions are provided, both from time_t and struct tm. There | 955 * Two conversions are provided, both from time_t and struct tm. There |
| 957 * is no portable way to convert to either of these structures, as far | 956 * is no portable way to convert to either of these structures, as far |
| 958 * as I know. If you know of a portable way, send it to me. As a side | 957 * as I know. If you know of a portable way, send it to me. As a side |
| 959 * note - PNG has always been Year 2000 compliant! | 958 * note - PNG has always been Year 2000 compliant! |
| 960 */ | 959 */ |
| 961 typedef struct png_time_struct | 960 typedef struct png_time_struct { |
| 962 { | 961 png_uint_16 year; /* full year, as in, 1995 */ |
| 963 png_uint_16 year; /* full year, as in, 1995 */ | 962 png_byte month; /* month of year, 1 - 12 */ |
| 964 png_byte month; /* month of year, 1 - 12 */ | 963 png_byte day; /* day of month, 1 - 31 */ |
| 965 png_byte day; /* day of month, 1 - 31 */ | 964 png_byte hour; /* hour of day, 0 - 23 */ |
| 966 png_byte hour; /* hour of day, 0 - 23 */ | 965 png_byte minute; /* minute of hour, 0 - 59 */ |
| 967 png_byte minute; /* minute of hour, 0 - 59 */ | 966 png_byte second; /* second of minute, 0 - 60 (for leap seconds) */ |
| 968 png_byte second; /* second of minute, 0 - 60 (for leap seconds) */ | |
| 969 } png_time; | 967 } png_time; |
| 970 typedef png_time * png_timep; | 968 typedef png_time* png_timep; |
| 971 typedef const png_time * png_const_timep; | 969 typedef const png_time* png_const_timep; |
| 972 typedef png_time * * png_timepp; | 970 typedef png_time** png_timepp; |
| 973 | 971 |
| 974 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED | 972 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED |
| 975 /* png_unknown_chunk is a structure to hold queued chunks for which there is | 973 /* png_unknown_chunk is a structure to hold queued chunks for which there is |
| 976 * no specific support. The idea is that we can use this to queue | 974 * no specific support. The idea is that we can use this to queue |
| 977 * up private chunks for output even though the library doesn't actually | 975 * up private chunks for output even though the library doesn't actually |
| 978 * know about their semantics. | 976 * know about their semantics. |
| 979 * | 977 * |
| 980 * The data in the structure is set by libpng on read and used on write. | 978 * The data in the structure is set by libpng on read and used on write. |
| 981 */ | 979 */ |
| 982 typedef struct png_unknown_chunk_t | 980 typedef struct png_unknown_chunk_t { |
| 983 { | 981 png_byte name[5]; /* Textual chunk name with '\0' terminator */ |
| 984 png_byte name[5]; /* Textual chunk name with '\0' terminator */ | 982 png_byte* data; /* Data, should not be modified on read! */ |
| 985 png_byte *data; /* Data, should not be modified on read! */ | 983 png_size_t size; |
| 986 png_size_t size; | |
| 987 | 984 |
| 988 /* On write 'location' must be set using the flag values listed below. | 985 /* On write 'location' must be set using the flag values listed below. |
| 989 * Notice that on read it is set by libpng however the values stored have | 986 * Notice that on read it is set by libpng however the values stored have |
| 990 * more bits set than are listed below. Always treat the value as a | 987 * more bits set than are listed below. Always treat the value as a |
| 991 * bitmask. On write set only one bit - setting multiple bits may cause the | 988 * bitmask. On write set only one bit - setting multiple bits may cause the |
| 992 * chunk to be written in multiple places. | 989 * chunk to be written in multiple places. |
| 993 */ | 990 */ |
| 994 png_byte location; /* mode of operation at read time */ | 991 png_byte location; /* mode of operation at read time */ |
| 995 } | 992 } png_unknown_chunk; |
| 996 png_unknown_chunk; | |
| 997 | 993 |
| 998 typedef png_unknown_chunk * png_unknown_chunkp; | 994 typedef png_unknown_chunk* png_unknown_chunkp; |
| 999 typedef const png_unknown_chunk * png_const_unknown_chunkp; | 995 typedef const png_unknown_chunk* png_const_unknown_chunkp; |
| 1000 typedef png_unknown_chunk * * png_unknown_chunkpp; | 996 typedef png_unknown_chunk** png_unknown_chunkpp; |
| 1001 #endif | 997 #endif |
| 1002 | 998 |
| 1003 /* Flag values for the unknown chunk location byte. */ | 999 /* Flag values for the unknown chunk location byte. */ |
| 1004 #define PNG_HAVE_IHDR 0x01 | 1000 #define PNG_HAVE_IHDR 0x01 |
| 1005 #define PNG_HAVE_PLTE 0x02 | 1001 #define PNG_HAVE_PLTE 0x02 |
| 1006 #define PNG_AFTER_IDAT 0x08 | 1002 #define PNG_AFTER_IDAT 0x08 |
| 1007 | 1003 |
| 1008 /* Maximum positive integer used in PNG is (2^31)-1 */ | 1004 /* Maximum positive integer used in PNG is (2^31)-1 */ |
| 1009 #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) | 1005 #define PNG_UINT_31_MAX ((png_uint_32)0x7fffffffL) |
| 1010 #define PNG_UINT_32_MAX ((png_uint_32)(-1)) | 1006 #define PNG_UINT_32_MAX ((png_uint_32)(-1)) |
| 1011 #define PNG_SIZE_MAX ((png_size_t)(-1)) | 1007 #define PNG_SIZE_MAX ((png_size_t)(-1)) |
| 1012 | 1008 |
| 1013 /* These are constants for fixed point values encoded in the | 1009 /* These are constants for fixed point values encoded in the |
| 1014 * PNG specification manner (x100000) | 1010 * PNG specification manner (x100000) |
| 1015 */ | 1011 */ |
| 1016 #define PNG_FP_1 100000 | 1012 #define PNG_FP_1 100000 |
| 1017 #define PNG_FP_HALF 50000 | 1013 #define PNG_FP_HALF 50000 |
| 1018 #define PNG_FP_MAX ((png_fixed_point)0x7fffffffL) | 1014 #define PNG_FP_MAX ((png_fixed_point)0x7fffffffL) |
| 1019 #define PNG_FP_MIN (-PNG_FP_MAX) | 1015 #define PNG_FP_MIN (-PNG_FP_MAX) |
| 1020 | 1016 |
| 1021 /* These describe the color_type field in png_info. */ | 1017 /* These describe the color_type field in png_info. */ |
| 1022 /* color type masks */ | 1018 /* color type masks */ |
| 1023 #define PNG_COLOR_MASK_PALETTE 1 | 1019 #define PNG_COLOR_MASK_PALETTE 1 |
| 1024 #define PNG_COLOR_MASK_COLOR 2 | 1020 #define PNG_COLOR_MASK_COLOR 2 |
| 1025 #define PNG_COLOR_MASK_ALPHA 4 | 1021 #define PNG_COLOR_MASK_ALPHA 4 |
| 1026 | 1022 |
| 1027 /* color types. Note that not all combinations are legal */ | 1023 /* color types. Note that not all combinations are legal */ |
| 1028 #define PNG_COLOR_TYPE_GRAY 0 | 1024 #define PNG_COLOR_TYPE_GRAY 0 |
| 1029 #define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE) | 1025 #define PNG_COLOR_TYPE_PALETTE (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_PALETTE) |
| 1030 #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR) | 1026 #define PNG_COLOR_TYPE_RGB (PNG_COLOR_MASK_COLOR) |
| 1031 #define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA) | 1027 #define PNG_COLOR_TYPE_RGB_ALPHA (PNG_COLOR_MASK_COLOR | PNG_COLOR_MASK_ALPHA) |
| 1032 #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA) | 1028 #define PNG_COLOR_TYPE_GRAY_ALPHA (PNG_COLOR_MASK_ALPHA) |
| 1033 /* aliases */ | 1029 /* aliases */ |
| 1034 #define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA | 1030 #define PNG_COLOR_TYPE_RGBA PNG_COLOR_TYPE_RGB_ALPHA |
| 1035 #define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA | 1031 #define PNG_COLOR_TYPE_GA PNG_COLOR_TYPE_GRAY_ALPHA |
| 1036 | 1032 |
| 1037 /* This is for compression type. PNG 1.0-1.2 only define the single type. */ | 1033 /* This is for compression type. PNG 1.0-1.2 only define the single type. */ |
| 1038 #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */ | 1034 #define PNG_COMPRESSION_TYPE_BASE 0 /* Deflate method 8, 32K window */ |
| 1039 #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE | 1035 #define PNG_COMPRESSION_TYPE_DEFAULT PNG_COMPRESSION_TYPE_BASE |
| 1040 | 1036 |
| 1041 /* This is for filter type. PNG 1.0-1.2 only define the single type. */ | 1037 /* This is for filter type. PNG 1.0-1.2 only define the single type. */ |
| 1042 #define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */ | 1038 #define PNG_FILTER_TYPE_BASE 0 /* Single row per-byte filtering */ |
| 1043 #define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */ | 1039 #define PNG_INTRAPIXEL_DIFFERENCING 64 /* Used only in MNG datastreams */ |
| 1044 #define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE | 1040 #define PNG_FILTER_TYPE_DEFAULT PNG_FILTER_TYPE_BASE |
| 1045 | 1041 |
| 1046 /* These are for the interlacing type. These values should NOT be changed. */ | 1042 /* These are for the interlacing type. These values should NOT be changed. */ |
| 1047 #define PNG_INTERLACE_NONE 0 /* Non-interlaced image */ | 1043 #define PNG_INTERLACE_NONE 0 /* Non-interlaced image */ |
| 1048 #define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */ | 1044 #define PNG_INTERLACE_ADAM7 1 /* Adam7 interlacing */ |
| 1049 #define PNG_INTERLACE_LAST 2 /* Not a valid value */ | 1045 #define PNG_INTERLACE_LAST 2 /* Not a valid value */ |
| 1050 | 1046 |
| 1051 /* These are for the oFFs chunk. These values should NOT be changed. */ | 1047 /* These are for the oFFs chunk. These values should NOT be changed. */ |
| 1052 #define PNG_OFFSET_PIXEL 0 /* Offset in pixels */ | 1048 #define PNG_OFFSET_PIXEL 0 /* Offset in pixels */ |
| 1053 #define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */ | 1049 #define PNG_OFFSET_MICROMETER 1 /* Offset in micrometers (1/10^6 meter) */ |
| 1054 #define PNG_OFFSET_LAST 2 /* Not a valid value */ | 1050 #define PNG_OFFSET_LAST 2 /* Not a valid value */ |
| 1055 | 1051 |
| 1056 /* These are for the pCAL chunk. These values should NOT be changed. */ | 1052 /* These are for the pCAL chunk. These values should NOT be changed. */ |
| 1057 #define PNG_EQUATION_LINEAR 0 /* Linear transformation */ | 1053 #define PNG_EQUATION_LINEAR 0 /* Linear transformation */ |
| 1058 #define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */ | 1054 #define PNG_EQUATION_BASE_E 1 /* Exponential base e transform */ |
| 1059 #define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */ | 1055 #define PNG_EQUATION_ARBITRARY 2 /* Arbitrary base exponential transform */ |
| 1060 #define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */ | 1056 #define PNG_EQUATION_HYPERBOLIC 3 /* Hyperbolic sine transformation */ |
| 1061 #define PNG_EQUATION_LAST 4 /* Not a valid value */ | 1057 #define PNG_EQUATION_LAST 4 /* Not a valid value */ |
| 1062 | 1058 |
| 1063 /* These are for the sCAL chunk. These values should NOT be changed. */ | 1059 /* These are for the sCAL chunk. These values should NOT be changed. */ |
| 1064 #define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */ | 1060 #define PNG_SCALE_UNKNOWN 0 /* unknown unit (image scale) */ |
| 1065 #define PNG_SCALE_METER 1 /* meters per pixel */ | 1061 #define PNG_SCALE_METER 1 /* meters per pixel */ |
| 1066 #define PNG_SCALE_RADIAN 2 /* radians per pixel */ | 1062 #define PNG_SCALE_RADIAN 2 /* radians per pixel */ |
| 1067 #define PNG_SCALE_LAST 3 /* Not a valid value */ | 1063 #define PNG_SCALE_LAST 3 /* Not a valid value */ |
| 1068 | 1064 |
| 1069 /* These are for the pHYs chunk. These values should NOT be changed. */ | 1065 /* These are for the pHYs chunk. These values should NOT be changed. */ |
| 1070 #define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */ | 1066 #define PNG_RESOLUTION_UNKNOWN 0 /* pixels/unknown unit (aspect ratio) */ |
| 1071 #define PNG_RESOLUTION_METER 1 /* pixels/meter */ | 1067 #define PNG_RESOLUTION_METER 1 /* pixels/meter */ |
| 1072 #define PNG_RESOLUTION_LAST 2 /* Not a valid value */ | 1068 #define PNG_RESOLUTION_LAST 2 /* Not a valid value */ |
| 1073 | 1069 |
| 1074 /* These are for the sRGB chunk. These values should NOT be changed. */ | 1070 /* These are for the sRGB chunk. These values should NOT be changed. */ |
| 1075 #define PNG_sRGB_INTENT_PERCEPTUAL 0 | 1071 #define PNG_sRGB_INTENT_PERCEPTUAL 0 |
| 1076 #define PNG_sRGB_INTENT_RELATIVE 1 | 1072 #define PNG_sRGB_INTENT_RELATIVE 1 |
| 1077 #define PNG_sRGB_INTENT_SATURATION 2 | 1073 #define PNG_sRGB_INTENT_SATURATION 2 |
| 1078 #define PNG_sRGB_INTENT_ABSOLUTE 3 | 1074 #define PNG_sRGB_INTENT_ABSOLUTE 3 |
| 1079 #define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */ | 1075 #define PNG_sRGB_INTENT_LAST 4 /* Not a valid value */ |
| 1080 | 1076 |
| 1081 /* This is for text chunks */ | 1077 /* This is for text chunks */ |
| 1082 #define PNG_KEYWORD_MAX_LENGTH 79 | 1078 #define PNG_KEYWORD_MAX_LENGTH 79 |
| 1083 | 1079 |
| 1084 /* Maximum number of entries in PLTE/sPLT/tRNS arrays */ | 1080 /* Maximum number of entries in PLTE/sPLT/tRNS arrays */ |
| 1085 #define PNG_MAX_PALETTE_LENGTH 256 | 1081 #define PNG_MAX_PALETTE_LENGTH 256 |
| 1086 | 1082 |
| 1087 /* These determine if an ancillary chunk's data has been successfully read | 1083 /* These determine if an ancillary chunk's data has been successfully read |
| 1088 * from the PNG header, or if the application has filled in the corresponding | 1084 * from the PNG header, or if the application has filled in the corresponding |
| 1089 * data in the info_struct to be written into the output file. The values | 1085 * data in the info_struct to be written into the output file. The values |
| 1090 * of the PNG_INFO_<chunk> defines should NOT be changed. | 1086 * of the PNG_INFO_<chunk> defines should NOT be changed. |
| 1091 */ | 1087 */ |
| 1092 #define PNG_INFO_gAMA 0x0001 | 1088 #define PNG_INFO_gAMA 0x0001 |
| 1093 #define PNG_INFO_sBIT 0x0002 | 1089 #define PNG_INFO_sBIT 0x0002 |
| 1094 #define PNG_INFO_cHRM 0x0004 | 1090 #define PNG_INFO_cHRM 0x0004 |
| 1095 #define PNG_INFO_PLTE 0x0008 | 1091 #define PNG_INFO_PLTE 0x0008 |
| 1096 #define PNG_INFO_tRNS 0x0010 | 1092 #define PNG_INFO_tRNS 0x0010 |
| 1097 #define PNG_INFO_bKGD 0x0020 | 1093 #define PNG_INFO_bKGD 0x0020 |
| 1098 #define PNG_INFO_hIST 0x0040 | 1094 #define PNG_INFO_hIST 0x0040 |
| 1099 #define PNG_INFO_pHYs 0x0080 | 1095 #define PNG_INFO_pHYs 0x0080 |
| 1100 #define PNG_INFO_oFFs 0x0100 | 1096 #define PNG_INFO_oFFs 0x0100 |
| 1101 #define PNG_INFO_tIME 0x0200 | 1097 #define PNG_INFO_tIME 0x0200 |
| 1102 #define PNG_INFO_pCAL 0x0400 | 1098 #define PNG_INFO_pCAL 0x0400 |
| 1103 #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ | 1099 #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ |
| 1104 #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ | 1100 #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ |
| 1105 #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ | 1101 #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ |
| 1106 #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ | 1102 #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ |
| 1107 #define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */ | 1103 #define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */ |
| 1108 | 1104 |
| 1109 /* This is used for the transformation routines, as some of them | 1105 /* This is used for the transformation routines, as some of them |
| 1110 * change these values for the row. It also should enable using | 1106 * change these values for the row. It also should enable using |
| 1111 * the routines for other purposes. | 1107 * the routines for other purposes. |
| 1112 */ | 1108 */ |
| 1113 typedef struct png_row_info_struct | 1109 typedef struct png_row_info_struct { |
| 1114 { | 1110 png_uint_32 width; /* width of row */ |
| 1115 png_uint_32 width; /* width of row */ | 1111 png_size_t rowbytes; /* number of bytes in row */ |
| 1116 png_size_t rowbytes; /* number of bytes in row */ | 1112 png_byte color_type; /* color type of row */ |
| 1117 png_byte color_type; /* color type of row */ | 1113 png_byte bit_depth; /* bit depth of row */ |
| 1118 png_byte bit_depth; /* bit depth of row */ | 1114 png_byte channels; /* number of channels (1, 2, 3, or 4) */ |
| 1119 png_byte channels; /* number of channels (1, 2, 3, or 4) */ | 1115 png_byte pixel_depth; /* bits per pixel (depth * channels) */ |
| 1120 png_byte pixel_depth; /* bits per pixel (depth * channels) */ | |
| 1121 } png_row_info; | 1116 } png_row_info; |
| 1122 | 1117 |
| 1123 typedef png_row_info * png_row_infop; | 1118 typedef png_row_info* png_row_infop; |
| 1124 typedef png_row_info * * png_row_infopp; | 1119 typedef png_row_info** png_row_infopp; |
| 1125 | 1120 |
| 1126 /* These are the function types for the I/O functions and for the functions | 1121 /* These are the function types for the I/O functions and for the functions |
| 1127 * that allow the user to override the default I/O functions with his or her | 1122 * that allow the user to override the default I/O functions with his or her |
| 1128 * own. The png_error_ptr type should match that of user-supplied warning | 1123 * own. The png_error_ptr type should match that of user-supplied warning |
| 1129 * and error functions, while the png_rw_ptr type should match that of the | 1124 * and error functions, while the png_rw_ptr type should match that of the |
| 1130 * user read/write data functions. Note that the 'write' function must not | 1125 * user read/write data functions. Note that the 'write' function must not |
| 1131 * modify the buffer it is passed. The 'read' function, on the other hand, is | 1126 * modify the buffer it is passed. The 'read' function, on the other hand, is |
| 1132 * expected to return the read data in the buffer. | 1127 * expected to return the read data in the buffer. |
| 1133 */ | 1128 */ |
| 1134 typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp)); | 1129 typedef PNG_CALLBACK(void, *png_error_ptr, (png_structp, png_const_charp)); |
| 1135 typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t)); | 1130 typedef PNG_CALLBACK(void, *png_rw_ptr, (png_structp, png_bytep, png_size_t)); |
| 1136 typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp)); | 1131 typedef PNG_CALLBACK(void, *png_flush_ptr, (png_structp)); |
| 1137 typedef PNG_CALLBACK(void, *png_read_status_ptr, (png_structp, png_uint_32, | 1132 typedef PNG_CALLBACK(void, |
| 1138 int)); | 1133 *png_read_status_ptr, |
| 1139 typedef PNG_CALLBACK(void, *png_write_status_ptr, (png_structp, png_uint_32, | 1134 (png_structp, png_uint_32, int)); |
| 1140 int)); | 1135 typedef PNG_CALLBACK(void, |
| 1136 *png_write_status_ptr, | |
| 1137 (png_structp, png_uint_32, int)); | |
| 1141 | 1138 |
| 1142 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED | 1139 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
| 1143 typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop)); | 1140 typedef PNG_CALLBACK(void, *png_progressive_info_ptr, (png_structp, png_infop)); |
| 1144 typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); | 1141 typedef PNG_CALLBACK(void, *png_progressive_end_ptr, (png_structp, png_infop)); |
| 1145 | 1142 |
| 1146 /* The following callback receives png_uint_32 row_number, int pass for the | 1143 /* The following callback receives png_uint_32 row_number, int pass for the |
| 1147 * png_bytep data of the row. When transforming an interlaced image the | 1144 * png_bytep data of the row. When transforming an interlaced image the |
| 1148 * row number is the row number within the sub-image of the interlace pass, so | 1145 * row number is the row number within the sub-image of the interlace pass, so |
| 1149 * the value will increase to the height of the sub-image (not the full image) | 1146 * the value will increase to the height of the sub-image (not the full image) |
| 1150 * then reset to 0 for the next pass. | 1147 * then reset to 0 for the next pass. |
| 1151 * | 1148 * |
| 1152 * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to | 1149 * Use PNG_ROW_FROM_PASS_ROW(row, pass) and PNG_COL_FROM_PASS_COL(col, pass) to |
| 1153 * find the output pixel (x,y) given an interlaced sub-image pixel | 1150 * find the output pixel (x,y) given an interlaced sub-image pixel |
| 1154 * (row,col,pass). (See below for these macros.) | 1151 * (row,col,pass). (See below for these macros.) |
| 1155 */ | 1152 */ |
| 1156 typedef PNG_CALLBACK(void, *png_progressive_row_ptr, (png_structp, png_bytep, | 1153 typedef PNG_CALLBACK(void, |
| 1157 png_uint_32, int)); | 1154 *png_progressive_row_ptr, |
| 1155 (png_structp, png_bytep, png_uint_32, int)); | |
| 1158 #endif | 1156 #endif |
| 1159 | 1157 |
| 1160 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ | 1158 #if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \ |
| 1161 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) | 1159 defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED) |
| 1162 typedef PNG_CALLBACK(void, *png_user_transform_ptr, (png_structp, png_row_infop, | 1160 typedef PNG_CALLBACK(void, |
| 1163 png_bytep)); | 1161 *png_user_transform_ptr, |
| 1162 (png_structp, png_row_infop, png_bytep)); | |
| 1164 #endif | 1163 #endif |
| 1165 | 1164 |
| 1166 #ifdef PNG_USER_CHUNKS_SUPPORTED | 1165 #ifdef PNG_USER_CHUNKS_SUPPORTED |
| 1167 typedef PNG_CALLBACK(int, *png_user_chunk_ptr, (png_structp, | 1166 typedef PNG_CALLBACK(int, |
| 1168 png_unknown_chunkp)); | 1167 *png_user_chunk_ptr, |
| 1168 (png_structp, png_unknown_chunkp)); | |
| 1169 #endif | 1169 #endif |
| 1170 #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED | 1170 #ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED |
| 1171 /* not used anywhere */ | 1171 /* not used anywhere */ |
| 1172 /* typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp)); */ | 1172 /* typedef PNG_CALLBACK(void, *png_unknown_chunk_ptr, (png_structp)); */ |
| 1173 #endif | 1173 #endif |
| 1174 | 1174 |
| 1175 #ifdef PNG_SETJMP_SUPPORTED | 1175 #ifdef PNG_SETJMP_SUPPORTED |
| 1176 /* This must match the function definition in <setjmp.h>, and the application | 1176 /* This must match the function definition in <setjmp.h>, and the application |
| 1177 * must include this before png.h to obtain the definition of jmp_buf. The | 1177 * must include this before png.h to obtain the definition of jmp_buf. The |
| 1178 * function is required to be PNG_NORETURN, but this is not checked. If the | 1178 * function is required to be PNG_NORETURN, but this is not checked. If the |
| 1179 * function does return the application will crash via an abort() or similar | 1179 * function does return the application will crash via an abort() or similar |
| 1180 * system level call. | 1180 * system level call. |
| 1181 * | 1181 * |
| 1182 * If you get a warning here while building the library you may need to make | 1182 * If you get a warning here while building the library you may need to make |
| 1183 * changes to ensure that pnglibconf.h records the calling convention used by | 1183 * changes to ensure that pnglibconf.h records the calling convention used by |
| 1184 * your compiler. This may be very difficult - try using a different compiler | 1184 * your compiler. This may be very difficult - try using a different compiler |
| 1185 * to build the library! | 1185 * to build the library! |
| 1186 */ | 1186 */ |
| 1187 PNG_FUNCTION(void, (PNGCAPI *png_longjmp_ptr), PNGARG((jmp_buf, int)), typedef); | 1187 PNG_FUNCTION(void, |
| 1188 (PNGCAPI * png_longjmp_ptr), | |
| 1189 PNGARG((jmp_buf, int)), | |
| 1190 typedef); | |
| 1188 #endif | 1191 #endif |
| 1189 | 1192 |
| 1190 /* Transform masks for the high-level interface */ | 1193 /* Transform masks for the high-level interface */ |
| 1191 #define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ | 1194 #define PNG_TRANSFORM_IDENTITY 0x0000 /* read and write */ |
| 1192 #define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ | 1195 #define PNG_TRANSFORM_STRIP_16 0x0001 /* read only */ |
| 1193 #define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ | 1196 #define PNG_TRANSFORM_STRIP_ALPHA 0x0002 /* read only */ |
| 1194 #define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ | 1197 #define PNG_TRANSFORM_PACKING 0x0004 /* read and write */ |
| 1195 #define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ | 1198 #define PNG_TRANSFORM_PACKSWAP 0x0008 /* read and write */ |
| 1196 #define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ | 1199 #define PNG_TRANSFORM_EXPAND 0x0010 /* read only */ |
| 1197 #define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ | 1200 #define PNG_TRANSFORM_INVERT_MONO 0x0020 /* read and write */ |
| 1198 #define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ | 1201 #define PNG_TRANSFORM_SHIFT 0x0040 /* read and write */ |
| 1199 #define PNG_TRANSFORM_BGR 0x0080 /* read and write */ | 1202 #define PNG_TRANSFORM_BGR 0x0080 /* read and write */ |
| 1200 #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ | 1203 #define PNG_TRANSFORM_SWAP_ALPHA 0x0100 /* read and write */ |
| 1201 #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ | 1204 #define PNG_TRANSFORM_SWAP_ENDIAN 0x0200 /* read and write */ |
| 1202 #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ | 1205 #define PNG_TRANSFORM_INVERT_ALPHA 0x0400 /* read and write */ |
| 1203 #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only */ | 1206 #define PNG_TRANSFORM_STRIP_FILLER 0x0800 /* write only */ |
| 1204 /* Added to libpng-1.2.34 */ | 1207 /* Added to libpng-1.2.34 */ |
| 1205 #define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER | 1208 #define PNG_TRANSFORM_STRIP_FILLER_BEFORE PNG_TRANSFORM_STRIP_FILLER |
| 1206 #define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */ | 1209 #define PNG_TRANSFORM_STRIP_FILLER_AFTER 0x1000 /* write only */ |
| 1207 /* Added to libpng-1.4.0 */ | 1210 /* Added to libpng-1.4.0 */ |
| 1208 #define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */ | 1211 #define PNG_TRANSFORM_GRAY_TO_RGB 0x2000 /* read only */ |
| 1209 /* Added to libpng-1.5.4 */ | 1212 /* Added to libpng-1.5.4 */ |
| 1210 #define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */ | 1213 #define PNG_TRANSFORM_EXPAND_16 0x4000 /* read only */ |
| 1211 #define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */ | 1214 #define PNG_TRANSFORM_SCALE_16 0x8000 /* read only */ |
| 1212 | 1215 |
| 1213 /* Flags for MNG supported features */ | 1216 /* Flags for MNG supported features */ |
| 1214 #define PNG_FLAG_MNG_EMPTY_PLTE 0x01 | 1217 #define PNG_FLAG_MNG_EMPTY_PLTE 0x01 |
| 1215 #define PNG_FLAG_MNG_FILTER_64 0x04 | 1218 #define PNG_FLAG_MNG_FILTER_64 0x04 |
| 1216 #define PNG_ALL_MNG_FEATURES 0x05 | 1219 #define PNG_ALL_MNG_FEATURES 0x05 |
| 1217 | 1220 |
| 1218 /* NOTE: prior to 1.5 these functions had no 'API' style declaration, | 1221 /* NOTE: prior to 1.5 these functions had no 'API' style declaration, |
| 1219 * this allowed the zlib default functions to be used on Windows | 1222 * this allowed the zlib default functions to be used on Windows |
| 1220 * platforms. In 1.5 the zlib default malloc (which just calls malloc and | 1223 * platforms. In 1.5 the zlib default malloc (which just calls malloc and |
| 1221 * ignores the first argument) should be completely compatible with the | 1224 * ignores the first argument) should be completely compatible with the |
| 1222 * following. | 1225 * following. |
| 1223 */ | 1226 */ |
| 1224 typedef PNG_CALLBACK(png_voidp, *png_malloc_ptr, (png_structp, | 1227 typedef PNG_CALLBACK(png_voidp, |
| 1225 png_alloc_size_t)); | 1228 *png_malloc_ptr, |
| 1229 (png_structp, png_alloc_size_t)); | |
| 1226 typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp)); | 1230 typedef PNG_CALLBACK(void, *png_free_ptr, (png_structp, png_voidp)); |
| 1227 | 1231 |
| 1228 /* Section 3: exported functions | 1232 /* Section 3: exported functions |
| 1229 * Here are the function definitions most commonly used. This is not | 1233 * Here are the function definitions most commonly used. This is not |
| 1230 * the place to find out how to use libpng. See libpng-manual.txt for the | 1234 * the place to find out how to use libpng. See libpng-manual.txt for the |
| 1231 * full explanation, see example.c for the summary. This just provides | 1235 * full explanation, see example.c for the summary. This just provides |
| 1232 * a simple one line description of the use of each function. | 1236 * a simple one line description of the use of each function. |
| 1233 * | 1237 * |
| 1234 * The PNG_EXPORT() and PNG_EXPORTA() macros used below are defined in | 1238 * The PNG_EXPORT() and PNG_EXPORTA() macros used below are defined in |
| 1235 * pngconf.h and in the *.dfn files in the scripts directory. | 1239 * pngconf.h and in the *.dfn files in the scripts directory. |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 1260 /* Tell lib we have already handled the first <num_bytes> magic bytes. | 1264 /* Tell lib we have already handled the first <num_bytes> magic bytes. |
| 1261 * Handling more than 8 bytes from the beginning of the file is an error. | 1265 * Handling more than 8 bytes from the beginning of the file is an error. |
| 1262 */ | 1266 */ |
| 1263 PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes)); | 1267 PNG_EXPORT(2, void, png_set_sig_bytes, (png_structrp png_ptr, int num_bytes)); |
| 1264 | 1268 |
| 1265 /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a | 1269 /* Check sig[start] through sig[start + num_to_check - 1] to see if it's a |
| 1266 * PNG file. Returns zero if the supplied bytes match the 8-byte PNG | 1270 * PNG file. Returns zero if the supplied bytes match the 8-byte PNG |
| 1267 * signature, and non-zero otherwise. Having num_to_check == 0 or | 1271 * signature, and non-zero otherwise. Having num_to_check == 0 or |
| 1268 * start > 7 will always fail (ie return non-zero). | 1272 * start > 7 will always fail (ie return non-zero). |
| 1269 */ | 1273 */ |
| 1270 PNG_EXPORT(3, int, png_sig_cmp, (png_const_bytep sig, png_size_t start, | 1274 PNG_EXPORT(3, |
| 1271 png_size_t num_to_check)); | 1275 int, |
| 1276 png_sig_cmp, | |
| 1277 (png_const_bytep sig, png_size_t start, png_size_t num_to_check)); | |
| 1272 | 1278 |
| 1273 /* Simple signature checking function. This is the same as calling | 1279 /* Simple signature checking function. This is the same as calling |
| 1274 * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). | 1280 * png_check_sig(sig, n) := !png_sig_cmp(sig, 0, n). |
| 1275 */ | 1281 */ |
| 1276 #define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n)) | 1282 #define png_check_sig(sig, n) !png_sig_cmp((sig), 0, (n)) |
| 1277 | 1283 |
| 1278 /* Allocate and initialize png_ptr struct for reading, and any other memory. */ | 1284 /* Allocate and initialize png_ptr struct for reading, and any other memory. */ |
| 1279 PNG_EXPORTA(4, png_structp, png_create_read_struct, | 1285 PNG_EXPORTA(4, |
| 1280 (png_const_charp user_png_ver, png_voidp error_ptr, | 1286 png_structp, |
| 1281 png_error_ptr error_fn, png_error_ptr warn_fn), | 1287 png_create_read_struct, |
| 1282 PNG_ALLOCATED); | 1288 (png_const_charp user_png_ver, |
| 1289 png_voidp error_ptr, | |
| 1290 png_error_ptr error_fn, | |
| 1291 png_error_ptr warn_fn), | |
| 1292 PNG_ALLOCATED); | |
| 1283 | 1293 |
| 1284 /* Allocate and initialize png_ptr struct for writing, and any other memory */ | 1294 /* Allocate and initialize png_ptr struct for writing, and any other memory */ |
| 1285 PNG_EXPORTA(5, png_structp, png_create_write_struct, | 1295 PNG_EXPORTA(5, |
| 1286 (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, | 1296 png_structp, |
| 1287 png_error_ptr warn_fn), | 1297 png_create_write_struct, |
| 1288 PNG_ALLOCATED); | 1298 (png_const_charp user_png_ver, |
| 1299 png_voidp error_ptr, | |
| 1300 png_error_ptr error_fn, | |
| 1301 png_error_ptr warn_fn), | |
| 1302 PNG_ALLOCATED); | |
| 1289 | 1303 |
| 1290 PNG_EXPORT(6, png_size_t, png_get_compression_buffer_size, | 1304 PNG_EXPORT(6, |
| 1291 (png_const_structrp png_ptr)); | 1305 png_size_t, |
| 1306 png_get_compression_buffer_size, | |
| 1307 (png_const_structrp png_ptr)); | |
| 1292 | 1308 |
| 1293 PNG_EXPORT(7, void, png_set_compression_buffer_size, (png_structrp png_ptr, | 1309 PNG_EXPORT(7, |
| 1294 png_size_t size)); | 1310 void, |
| 1311 png_set_compression_buffer_size, | |
| 1312 (png_structrp png_ptr, png_size_t size)); | |
| 1295 | 1313 |
| 1296 /* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp | 1314 /* Moved from pngconf.h in 1.4.0 and modified to ensure setjmp/longjmp |
| 1297 * match up. | 1315 * match up. |
| 1298 */ | 1316 */ |
| 1299 #ifdef PNG_SETJMP_SUPPORTED | 1317 #ifdef PNG_SETJMP_SUPPORTED |
| 1300 /* This function returns the jmp_buf built in to *png_ptr. It must be | 1318 /* This function returns the jmp_buf built in to *png_ptr. It must be |
| 1301 * supplied with an appropriate 'longjmp' function to use on that jmp_buf | 1319 * supplied with an appropriate 'longjmp' function to use on that jmp_buf |
| 1302 * unless the default error function is overridden in which case NULL is | 1320 * unless the default error function is overridden in which case NULL is |
| 1303 * acceptable. The size of the jmp_buf is checked against the actual size | 1321 * acceptable. The size of the jmp_buf is checked against the actual size |
| 1304 * allocated by the library - the call will return NULL on a mismatch | 1322 * allocated by the library - the call will return NULL on a mismatch |
| 1305 * indicating an ABI mismatch. | 1323 * indicating an ABI mismatch. |
| 1306 */ | 1324 */ |
| 1307 PNG_EXPORT(8, jmp_buf*, png_set_longjmp_fn, (png_structrp png_ptr, | 1325 PNG_EXPORT(8, |
| 1308 png_longjmp_ptr longjmp_fn, size_t jmp_buf_size)); | 1326 jmp_buf*, |
| 1309 # define png_jmpbuf(png_ptr) \ | 1327 png_set_longjmp_fn, |
| 1310 (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof (jmp_buf)))) | 1328 (png_structrp png_ptr, |
| 1329 png_longjmp_ptr longjmp_fn, | |
| 1330 size_t jmp_buf_size)); | |
| 1331 #define png_jmpbuf(png_ptr) \ | |
| 1332 (*png_set_longjmp_fn((png_ptr), longjmp, (sizeof(jmp_buf)))) | |
| 1311 #else | 1333 #else |
| 1312 # define png_jmpbuf(png_ptr) \ | 1334 #define png_jmpbuf(png_ptr) (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) |
| 1313 (LIBPNG_WAS_COMPILED_WITH__PNG_NO_SETJMP) | |
| 1314 #endif | 1335 #endif |
| 1315 /* This function should be used by libpng applications in place of | 1336 /* This function should be used by libpng applications in place of |
| 1316 * longjmp(png_ptr->jmpbuf, val). If longjmp_fn() has been set, it | 1337 * longjmp(png_ptr->jmpbuf, val). If longjmp_fn() has been set, it |
| 1317 * will use it; otherwise it will call PNG_ABORT(). This function was | 1338 * will use it; otherwise it will call PNG_ABORT(). This function was |
| 1318 * added in libpng-1.5.0. | 1339 * added in libpng-1.5.0. |
| 1319 */ | 1340 */ |
| 1320 PNG_EXPORTA(9, void, png_longjmp, (png_const_structrp png_ptr, int val), | 1341 PNG_EXPORTA(9, |
| 1321 PNG_NORETURN); | 1342 void, |
| 1343 png_longjmp, | |
| 1344 (png_const_structrp png_ptr, int val), | |
| 1345 PNG_NORETURN); | |
| 1322 | 1346 |
| 1323 #ifdef PNG_READ_SUPPORTED | 1347 #ifdef PNG_READ_SUPPORTED |
| 1324 /* Reset the compression stream */ | 1348 /* Reset the compression stream */ |
| 1325 PNG_EXPORTA(10, int, png_reset_zstream, (png_structrp png_ptr), PNG_DEPRECATED); | 1349 PNG_EXPORTA(10, int, png_reset_zstream, (png_structrp png_ptr), PNG_DEPRECATED); |
| 1326 #endif | 1350 #endif |
| 1327 | 1351 |
| 1328 /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ | 1352 /* New functions added in libpng-1.0.2 (not enabled by default until 1.2.0) */ |
| 1329 #ifdef PNG_USER_MEM_SUPPORTED | 1353 #ifdef PNG_USER_MEM_SUPPORTED |
| 1330 PNG_EXPORTA(11, png_structp, png_create_read_struct_2, | 1354 PNG_EXPORTA(11, |
| 1331 (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, | 1355 png_structp, |
| 1332 png_error_ptr warn_fn, | 1356 png_create_read_struct_2, |
| 1333 png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), | 1357 (png_const_charp user_png_ver, |
| 1334 PNG_ALLOCATED); | 1358 png_voidp error_ptr, |
| 1335 PNG_EXPORTA(12, png_structp, png_create_write_struct_2, | 1359 png_error_ptr error_fn, |
| 1336 (png_const_charp user_png_ver, png_voidp error_ptr, png_error_ptr error_fn, | 1360 png_error_ptr warn_fn, |
| 1337 png_error_ptr warn_fn, | 1361 png_voidp mem_ptr, |
| 1338 png_voidp mem_ptr, png_malloc_ptr malloc_fn, png_free_ptr free_fn), | 1362 png_malloc_ptr malloc_fn, |
| 1339 PNG_ALLOCATED); | 1363 png_free_ptr free_fn), |
| 1364 PNG_ALLOCATED); | |
| 1365 PNG_EXPORTA(12, | |
| 1366 png_structp, | |
| 1367 png_create_write_struct_2, | |
| 1368 (png_const_charp user_png_ver, | |
| 1369 png_voidp error_ptr, | |
| 1370 png_error_ptr error_fn, | |
| 1371 png_error_ptr warn_fn, | |
| 1372 png_voidp mem_ptr, | |
| 1373 png_malloc_ptr malloc_fn, | |
| 1374 png_free_ptr free_fn), | |
| 1375 PNG_ALLOCATED); | |
| 1340 #endif | 1376 #endif |
| 1341 | 1377 |
| 1342 /* Write the PNG file signature. */ | 1378 /* Write the PNG file signature. */ |
| 1343 PNG_EXPORT(13, void, png_write_sig, (png_structrp png_ptr)); | 1379 PNG_EXPORT(13, void, png_write_sig, (png_structrp png_ptr)); |
| 1344 | 1380 |
| 1345 /* Write a PNG chunk - size, type, (optional) data, CRC. */ | 1381 /* Write a PNG chunk - size, type, (optional) data, CRC. */ |
| 1346 PNG_EXPORT(14, void, png_write_chunk, (png_structrp png_ptr, png_const_bytep | 1382 PNG_EXPORT(14, |
| 1347 chunk_name, png_const_bytep data, png_size_t length)); | 1383 void, |
| 1384 png_write_chunk, | |
| 1385 (png_structrp png_ptr, | |
| 1386 png_const_bytep chunk_name, | |
| 1387 png_const_bytep data, | |
| 1388 png_size_t length)); | |
| 1348 | 1389 |
| 1349 /* Write the start of a PNG chunk - length and chunk name. */ | 1390 /* Write the start of a PNG chunk - length and chunk name. */ |
| 1350 PNG_EXPORT(15, void, png_write_chunk_start, (png_structrp png_ptr, | 1391 PNG_EXPORT(15, |
| 1351 png_const_bytep chunk_name, png_uint_32 length)); | 1392 void, |
| 1393 png_write_chunk_start, | |
| 1394 (png_structrp png_ptr, | |
| 1395 png_const_bytep chunk_name, | |
| 1396 png_uint_32 length)); | |
| 1352 | 1397 |
| 1353 /* Write the data of a PNG chunk started with png_write_chunk_start(). */ | 1398 /* Write the data of a PNG chunk started with png_write_chunk_start(). */ |
| 1354 PNG_EXPORT(16, void, png_write_chunk_data, (png_structrp png_ptr, | 1399 PNG_EXPORT(16, |
| 1355 png_const_bytep data, png_size_t length)); | 1400 void, |
| 1401 png_write_chunk_data, | |
| 1402 (png_structrp png_ptr, png_const_bytep data, png_size_t length)); | |
| 1356 | 1403 |
| 1357 /* Finish a chunk started with png_write_chunk_start() (includes CRC). */ | 1404 /* Finish a chunk started with png_write_chunk_start() (includes CRC). */ |
| 1358 PNG_EXPORT(17, void, png_write_chunk_end, (png_structrp png_ptr)); | 1405 PNG_EXPORT(17, void, png_write_chunk_end, (png_structrp png_ptr)); |
| 1359 | 1406 |
| 1360 /* Allocate and initialize the info structure */ | 1407 /* Allocate and initialize the info structure */ |
| 1361 PNG_EXPORTA(18, png_infop, png_create_info_struct, (png_const_structrp png_ptr), | 1408 PNG_EXPORTA(18, |
| 1362 PNG_ALLOCATED); | 1409 png_infop, |
| 1410 png_create_info_struct, | |
| 1411 (png_const_structrp png_ptr), | |
| 1412 PNG_ALLOCATED); | |
| 1363 | 1413 |
| 1364 /* DEPRECATED: this function allowed init structures to be created using the | 1414 /* DEPRECATED: this function allowed init structures to be created using the |
| 1365 * default allocation method (typically malloc). Use is deprecated in 1.6.0 and | 1415 * default allocation method (typically malloc). Use is deprecated in 1.6.0 and |
| 1366 * the API will be removed in the future. | 1416 * the API will be removed in the future. |
| 1367 */ | 1417 */ |
| 1368 PNG_EXPORTA(19, void, png_info_init_3, (png_infopp info_ptr, | 1418 PNG_EXPORTA(19, |
| 1369 png_size_t png_info_struct_size), PNG_DEPRECATED); | 1419 void, |
| 1420 png_info_init_3, | |
| 1421 (png_infopp info_ptr, png_size_t png_info_struct_size), | |
| 1422 PNG_DEPRECATED); | |
| 1370 | 1423 |
| 1371 /* Writes all the PNG information before the image. */ | 1424 /* Writes all the PNG information before the image. */ |
| 1372 PNG_EXPORT(20, void, png_write_info_before_PLTE, | 1425 PNG_EXPORT(20, |
| 1373 (png_structrp png_ptr, png_const_inforp info_ptr)); | 1426 void, |
| 1374 PNG_EXPORT(21, void, png_write_info, | 1427 png_write_info_before_PLTE, |
| 1375 (png_structrp png_ptr, png_const_inforp info_ptr)); | 1428 (png_structrp png_ptr, png_const_inforp info_ptr)); |
| 1429 PNG_EXPORT(21, | |
| 1430 void, | |
| 1431 png_write_info, | |
| 1432 (png_structrp png_ptr, png_const_inforp info_ptr)); | |
| 1376 | 1433 |
| 1377 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED | 1434 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED |
| 1378 /* Read the information before the actual image data. */ | 1435 /* Read the information before the actual image data. */ |
| 1379 PNG_EXPORT(22, void, png_read_info, | 1436 PNG_EXPORT(22, |
| 1380 (png_structrp png_ptr, png_inforp info_ptr)); | 1437 void, |
| 1438 png_read_info, | |
| 1439 (png_structrp png_ptr, png_inforp info_ptr)); | |
| 1381 #endif | 1440 #endif |
| 1382 | 1441 |
| 1383 #ifdef PNG_TIME_RFC1123_SUPPORTED | 1442 #ifdef PNG_TIME_RFC1123_SUPPORTED |
| 1384 /* Convert to a US string format: there is no localization support in this | 1443 /* Convert to a US string format: there is no localization support in this |
| 1385 * routine. The original implementation used a 29 character buffer in | 1444 * routine. The original implementation used a 29 character buffer in |
| 1386 * png_struct, this will be removed in future versions. | 1445 * png_struct, this will be removed in future versions. |
| 1387 */ | 1446 */ |
| 1388 #if PNG_LIBPNG_VER < 10700 | 1447 #if PNG_LIBPNG_VER < 10700 |
| 1389 /* To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h) */ | 1448 /* To do: remove this from libpng17 (and from libpng17/png.c and pngstruct.h) */ |
| 1390 PNG_EXPORTA(23, png_const_charp, png_convert_to_rfc1123, (png_structrp png_ptr, | 1449 PNG_EXPORTA(23, |
| 1391 png_const_timep ptime),PNG_DEPRECATED); | 1450 png_const_charp, |
| 1451 png_convert_to_rfc1123, | |
| 1452 (png_structrp png_ptr, png_const_timep ptime), | |
| 1453 PNG_DEPRECATED); | |
| 1392 #endif | 1454 #endif |
| 1393 PNG_EXPORT(241, int, png_convert_to_rfc1123_buffer, (char out[29], | 1455 PNG_EXPORT(241, |
| 1394 png_const_timep ptime)); | 1456 int, |
| 1457 png_convert_to_rfc1123_buffer, | |
| 1458 (char out[29], png_const_timep ptime)); | |
| 1395 #endif | 1459 #endif |
| 1396 | 1460 |
| 1397 #ifdef PNG_CONVERT_tIME_SUPPORTED | 1461 #ifdef PNG_CONVERT_tIME_SUPPORTED |
| 1398 /* Convert from a struct tm to png_time */ | 1462 /* Convert from a struct tm to png_time */ |
| 1399 PNG_EXPORT(24, void, png_convert_from_struct_tm, (png_timep ptime, | 1463 PNG_EXPORT(24, |
| 1400 const struct tm * ttime)); | 1464 void, |
| 1465 png_convert_from_struct_tm, | |
| 1466 (png_timep ptime, const struct tm* ttime)); | |
| 1401 | 1467 |
| 1402 /* Convert from time_t to png_time. Uses gmtime() */ | 1468 /* Convert from time_t to png_time. Uses gmtime() */ |
| 1403 PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime)); | 1469 PNG_EXPORT(25, void, png_convert_from_time_t, (png_timep ptime, time_t ttime)); |
| 1404 #endif /* PNG_CONVERT_tIME_SUPPORTED */ | 1470 #endif /* PNG_CONVERT_tIME_SUPPORTED */ |
| 1405 | 1471 |
| 1406 #ifdef PNG_READ_EXPAND_SUPPORTED | 1472 #ifdef PNG_READ_EXPAND_SUPPORTED |
| 1407 /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ | 1473 /* Expand data to 24-bit RGB, or 8-bit grayscale, with alpha if available. */ |
| 1408 PNG_EXPORT(26, void, png_set_expand, (png_structrp png_ptr)); | 1474 PNG_EXPORT(26, void, png_set_expand, (png_structrp png_ptr)); |
| 1409 PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structrp png_ptr)); | 1475 PNG_EXPORT(27, void, png_set_expand_gray_1_2_4_to_8, (png_structrp png_ptr)); |
| 1410 PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structrp png_ptr)); | 1476 PNG_EXPORT(28, void, png_set_palette_to_rgb, (png_structrp png_ptr)); |
| (...skipping 12 matching lines...) Expand all Loading... | |
| 1423 PNG_EXPORT(30, void, png_set_bgr, (png_structrp png_ptr)); | 1489 PNG_EXPORT(30, void, png_set_bgr, (png_structrp png_ptr)); |
| 1424 #endif | 1490 #endif |
| 1425 | 1491 |
| 1426 #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED | 1492 #ifdef PNG_READ_GRAY_TO_RGB_SUPPORTED |
| 1427 /* Expand the grayscale to 24-bit RGB if necessary. */ | 1493 /* Expand the grayscale to 24-bit RGB if necessary. */ |
| 1428 PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structrp png_ptr)); | 1494 PNG_EXPORT(31, void, png_set_gray_to_rgb, (png_structrp png_ptr)); |
| 1429 #endif | 1495 #endif |
| 1430 | 1496 |
| 1431 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED | 1497 #ifdef PNG_READ_RGB_TO_GRAY_SUPPORTED |
| 1432 /* Reduce RGB to grayscale. */ | 1498 /* Reduce RGB to grayscale. */ |
| 1433 #define PNG_ERROR_ACTION_NONE 1 | 1499 #define PNG_ERROR_ACTION_NONE 1 |
| 1434 #define PNG_ERROR_ACTION_WARN 2 | 1500 #define PNG_ERROR_ACTION_WARN 2 |
| 1435 #define PNG_ERROR_ACTION_ERROR 3 | 1501 #define PNG_ERROR_ACTION_ERROR 3 |
| 1436 #define PNG_RGB_TO_GRAY_DEFAULT (-1)/*for red/green coefficients*/ | 1502 #define PNG_RGB_TO_GRAY_DEFAULT (-1) /*for red/green coefficients*/ |
| 1437 | 1503 |
| 1438 PNG_FP_EXPORT(32, void, png_set_rgb_to_gray, (png_structrp png_ptr, | 1504 PNG_FP_EXPORT( |
| 1439 int error_action, double red, double green)) | 1505 32, |
| 1440 PNG_FIXED_EXPORT(33, void, png_set_rgb_to_gray_fixed, (png_structrp png_ptr, | 1506 void, |
| 1441 int error_action, png_fixed_point red, png_fixed_point green)) | 1507 png_set_rgb_to_gray, |
| 1508 (png_structrp png_ptr, int error_action, double red, double green)) | |
| 1509 PNG_FIXED_EXPORT(33, | |
| 1510 void, | |
| 1511 png_set_rgb_to_gray_fixed, | |
| 1512 (png_structrp png_ptr, | |
| 1513 int error_action, | |
| 1514 png_fixed_point red, | |
| 1515 png_fixed_point green)) | |
| 1442 | 1516 |
| 1443 PNG_EXPORT(34, png_byte, png_get_rgb_to_gray_status, (png_const_structrp | 1517 PNG_EXPORT(34, |
| 1444 png_ptr)); | 1518 png_byte, |
| 1519 png_get_rgb_to_gray_status, | |
| 1520 (png_const_structrp png_ptr)); | |
| 1445 #endif | 1521 #endif |
| 1446 | 1522 |
| 1447 #ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED | 1523 #ifdef PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED |
| 1448 PNG_EXPORT(35, void, png_build_grayscale_palette, (int bit_depth, | 1524 PNG_EXPORT(35, |
| 1449 png_colorp palette)); | 1525 void, |
| 1526 png_build_grayscale_palette, | |
| 1527 (int bit_depth, png_colorp palette)); | |
| 1450 #endif | 1528 #endif |
| 1451 | 1529 |
| 1452 #ifdef PNG_READ_ALPHA_MODE_SUPPORTED | 1530 #ifdef PNG_READ_ALPHA_MODE_SUPPORTED |
| 1453 /* How the alpha channel is interpreted - this affects how the color channels of | 1531 /* How the alpha channel is interpreted - this affects how the color channels of |
| 1454 * a PNG file are returned when an alpha channel, or tRNS chunk in a palette | 1532 * a PNG file are returned when an alpha channel, or tRNS chunk in a palette |
| 1455 * file, is present. | 1533 * file, is present. |
| 1456 * | 1534 * |
| 1457 * This has no effect on the way pixels are written into a PNG output | 1535 * This has no effect on the way pixels are written into a PNG output |
| 1458 * datastream. The color samples in a PNG datastream are never premultiplied | 1536 * datastream. The color samples in a PNG datastream are never premultiplied |
| 1459 * with the alpha samples. | 1537 * with the alpha samples. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1491 * The final choice is to gamma encode the alpha channel as well. This is | 1569 * The final choice is to gamma encode the alpha channel as well. This is |
| 1492 * broken because, in practice, no implementation that uses this choice | 1570 * broken because, in practice, no implementation that uses this choice |
| 1493 * correctly undoes the encoding before handling alpha composition. Use this | 1571 * correctly undoes the encoding before handling alpha composition. Use this |
| 1494 * choice only if other serious errors in the software or hardware you use | 1572 * choice only if other serious errors in the software or hardware you use |
| 1495 * mandate it; the typical serious error is for dark halos to appear around | 1573 * mandate it; the typical serious error is for dark halos to appear around |
| 1496 * opaque areas of the composited PNG image because of arithmetic overflow. | 1574 * opaque areas of the composited PNG image because of arithmetic overflow. |
| 1497 * | 1575 * |
| 1498 * The API function png_set_alpha_mode specifies which of these choices to use | 1576 * The API function png_set_alpha_mode specifies which of these choices to use |
| 1499 * with an enumerated 'mode' value and the gamma of the required output: | 1577 * with an enumerated 'mode' value and the gamma of the required output: |
| 1500 */ | 1578 */ |
| 1501 #define PNG_ALPHA_PNG 0 /* according to the PNG standard */ | 1579 #define PNG_ALPHA_PNG 0 /* according to the PNG standard */ |
| 1502 #define PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ | 1580 #define PNG_ALPHA_STANDARD 1 /* according to Porter/Duff */ |
| 1503 #define PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ | 1581 #define PNG_ALPHA_ASSOCIATED 1 /* as above; this is the normal practice */ |
| 1504 #define PNG_ALPHA_PREMULTIPLIED 1 /* as above */ | 1582 #define PNG_ALPHA_PREMULTIPLIED 1 /* as above */ |
| 1505 #define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ | 1583 #define PNG_ALPHA_OPTIMIZED 2 /* 'PNG' for opaque pixels, else 'STANDARD' */ |
| 1506 #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ | 1584 #define PNG_ALPHA_BROKEN 3 /* the alpha channel is gamma encoded */ |
| 1507 | 1585 |
| 1508 PNG_FP_EXPORT(227, void, png_set_alpha_mode, (png_structrp png_ptr, int mode, | 1586 PNG_FP_EXPORT(227, |
| 1509 double output_gamma)) | 1587 void, |
| 1510 PNG_FIXED_EXPORT(228, void, png_set_alpha_mode_fixed, (png_structrp png_ptr, | 1588 png_set_alpha_mode, |
| 1511 int mode, png_fixed_point output_gamma)) | 1589 (png_structrp png_ptr, int mode, double output_gamma)) |
| 1590 PNG_FIXED_EXPORT(228, | |
| 1591 void, | |
| 1592 png_set_alpha_mode_fixed, | |
| 1593 (png_structrp png_ptr, int mode, png_fixed_point output_gamma)) | |
| 1512 #endif | 1594 #endif |
| 1513 | 1595 |
| 1514 #if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) | 1596 #if defined(PNG_GAMMA_SUPPORTED) || defined(PNG_READ_ALPHA_MODE_SUPPORTED) |
| 1515 /* The output_gamma value is a screen gamma in libpng terminology: it expresses | 1597 /* The output_gamma value is a screen gamma in libpng terminology: it expresses |
| 1516 * how to decode the output values, not how they are encoded. The values used | 1598 * how to decode the output values, not how they are encoded. The values used |
| 1517 * correspond to the normal numbers used to describe the overall gamma of a | 1599 * correspond to the normal numbers used to describe the overall gamma of a |
| 1518 * computer display system; for example 2.2 for an sRGB conformant system. The | 1600 * computer display system; for example 2.2 for an sRGB conformant system. The |
| 1519 * values are scaled by 100000 in the _fixed version of the API (so 220000 for | 1601 * values are scaled by 100000 in the _fixed version of the API (so 220000 for |
| 1520 * sRGB.) | 1602 * sRGB.) |
| 1521 * | 1603 * |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1571 * | 1653 * |
| 1572 * Both these values are reserved (not simple gamma values) in order to allow | 1654 * Both these values are reserved (not simple gamma values) in order to allow |
| 1573 * more precise correction internally in the future. | 1655 * more precise correction internally in the future. |
| 1574 * | 1656 * |
| 1575 * NOTE: the following values can be passed to either the fixed or floating | 1657 * NOTE: the following values can be passed to either the fixed or floating |
| 1576 * point APIs, but the floating point API will also accept floating point | 1658 * point APIs, but the floating point API will also accept floating point |
| 1577 * values. | 1659 * values. |
| 1578 */ | 1660 */ |
| 1579 #define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */ | 1661 #define PNG_DEFAULT_sRGB -1 /* sRGB gamma and color space */ |
| 1580 #define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */ | 1662 #define PNG_GAMMA_MAC_18 -2 /* Old Mac '1.8' gamma and color space */ |
| 1581 #define PNG_GAMMA_sRGB 220000 /* Television standards--matches sRGB gamma */ | 1663 #define PNG_GAMMA_sRGB 220000 /* Television standards--matches sRGB gamma */ |
| 1582 #define PNG_GAMMA_LINEAR PNG_FP_1 /* Linear */ | 1664 #define PNG_GAMMA_LINEAR PNG_FP_1 /* Linear */ |
| 1583 #endif | 1665 #endif |
| 1584 | 1666 |
| 1585 /* The following are examples of calls to png_set_alpha_mode to achieve the | 1667 /* The following are examples of calls to png_set_alpha_mode to achieve the |
| 1586 * required overall gamma correction and, where necessary, alpha | 1668 * required overall gamma correction and, where necessary, alpha |
| 1587 * premultiplication. | 1669 * premultiplication. |
| 1588 * | 1670 * |
| 1589 * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); | 1671 * png_set_alpha_mode(pp, PNG_ALPHA_PNG, PNG_DEFAULT_sRGB); |
| 1590 * This is the default libpng handling of the alpha channel - it is not | 1672 * This is the default libpng handling of the alpha channel - it is not |
| 1591 * pre-multiplied into the color components. In addition the call states | 1673 * pre-multiplied into the color components. In addition the call states |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1667 PNG_EXPORT(37, void, png_set_swap_alpha, (png_structrp png_ptr)); | 1749 PNG_EXPORT(37, void, png_set_swap_alpha, (png_structrp png_ptr)); |
| 1668 #endif | 1750 #endif |
| 1669 | 1751 |
| 1670 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ | 1752 #if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \ |
| 1671 defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) | 1753 defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED) |
| 1672 PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr)); | 1754 PNG_EXPORT(38, void, png_set_invert_alpha, (png_structrp png_ptr)); |
| 1673 #endif | 1755 #endif |
| 1674 | 1756 |
| 1675 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) | 1757 #if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED) |
| 1676 /* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ | 1758 /* Add a filler byte to 8-bit Gray or 24-bit RGB images. */ |
| 1677 PNG_EXPORT(39, void, png_set_filler, (png_structrp png_ptr, png_uint_32 filler, | 1759 PNG_EXPORT(39, |
| 1678 int flags)); | 1760 void, |
| 1761 png_set_filler, | |
| 1762 (png_structrp png_ptr, png_uint_32 filler, int flags)); | |
| 1679 /* The values of the PNG_FILLER_ defines should NOT be changed */ | 1763 /* The values of the PNG_FILLER_ defines should NOT be changed */ |
| 1680 # define PNG_FILLER_BEFORE 0 | 1764 #define PNG_FILLER_BEFORE 0 |
| 1681 # define PNG_FILLER_AFTER 1 | 1765 #define PNG_FILLER_AFTER 1 |
| 1682 /* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ | 1766 /* Add an alpha byte to 8-bit Gray or 24-bit RGB images. */ |
| 1683 PNG_EXPORT(40, void, png_set_add_alpha, (png_structrp png_ptr, | 1767 PNG_EXPORT(40, |
| 1684 png_uint_32 filler, int flags)); | 1768 void, |
| 1769 png_set_add_alpha, | |
| 1770 (png_structrp png_ptr, png_uint_32 filler, int flags)); | |
| 1685 #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ | 1771 #endif /* PNG_READ_FILLER_SUPPORTED || PNG_WRITE_FILLER_SUPPORTED */ |
| 1686 | 1772 |
| 1687 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) | 1773 #if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED) |
| 1688 /* Swap bytes in 16-bit depth files. */ | 1774 /* Swap bytes in 16-bit depth files. */ |
| 1689 PNG_EXPORT(41, void, png_set_swap, (png_structrp png_ptr)); | 1775 PNG_EXPORT(41, void, png_set_swap, (png_structrp png_ptr)); |
| 1690 #endif | 1776 #endif |
| 1691 | 1777 |
| 1692 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) | 1778 #if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED) |
| 1693 /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ | 1779 /* Use 1 byte per pixel in 1, 2, or 4-bit depth files. */ |
| 1694 PNG_EXPORT(42, void, png_set_packing, (png_structrp png_ptr)); | 1780 PNG_EXPORT(42, void, png_set_packing, (png_structrp png_ptr)); |
| 1695 #endif | 1781 #endif |
| 1696 | 1782 |
| 1697 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ | 1783 #if defined(PNG_READ_PACKSWAP_SUPPORTED) || \ |
| 1698 defined(PNG_WRITE_PACKSWAP_SUPPORTED) | 1784 defined(PNG_WRITE_PACKSWAP_SUPPORTED) |
| 1699 /* Swap packing order of pixels in bytes. */ | 1785 /* Swap packing order of pixels in bytes. */ |
| 1700 PNG_EXPORT(43, void, png_set_packswap, (png_structrp png_ptr)); | 1786 PNG_EXPORT(43, void, png_set_packswap, (png_structrp png_ptr)); |
| 1701 #endif | 1787 #endif |
| 1702 | 1788 |
| 1703 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) | 1789 #if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED) |
| 1704 /* Converts files to legal bit depths. */ | 1790 /* Converts files to legal bit depths. */ |
| 1705 PNG_EXPORT(44, void, png_set_shift, (png_structrp png_ptr, png_const_color_8p | 1791 PNG_EXPORT(44, |
| 1706 true_bits)); | 1792 void, |
| 1793 png_set_shift, | |
| 1794 (png_structrp png_ptr, png_const_color_8p true_bits)); | |
| 1707 #endif | 1795 #endif |
| 1708 | 1796 |
| 1709 #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ | 1797 #if defined(PNG_READ_INTERLACING_SUPPORTED) || \ |
| 1710 defined(PNG_WRITE_INTERLACING_SUPPORTED) | 1798 defined(PNG_WRITE_INTERLACING_SUPPORTED) |
| 1711 /* Have the code handle the interlacing. Returns the number of passes. | 1799 /* Have the code handle the interlacing. Returns the number of passes. |
| 1712 * MUST be called before png_read_update_info or png_start_read_image, | 1800 * MUST be called before png_read_update_info or png_start_read_image, |
| 1713 * otherwise it will not have the desired effect. Note that it is still | 1801 * otherwise it will not have the desired effect. Note that it is still |
| 1714 * necessary to call png_read_row or png_read_rows png_get_image_height | 1802 * necessary to call png_read_row or png_read_rows png_get_image_height |
| 1715 * times for each pass. | 1803 * times for each pass. |
| 1716 */ | 1804 */ |
| 1717 PNG_EXPORT(45, int, png_set_interlace_handling, (png_structrp png_ptr)); | 1805 PNG_EXPORT(45, int, png_set_interlace_handling, (png_structrp png_ptr)); |
| 1718 #endif | 1806 #endif |
| 1719 | 1807 |
| 1720 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) | 1808 #if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED) |
| 1721 /* Invert monochrome files */ | 1809 /* Invert monochrome files */ |
| 1722 PNG_EXPORT(46, void, png_set_invert_mono, (png_structrp png_ptr)); | 1810 PNG_EXPORT(46, void, png_set_invert_mono, (png_structrp png_ptr)); |
| 1723 #endif | 1811 #endif |
| 1724 | 1812 |
| 1725 #ifdef PNG_READ_BACKGROUND_SUPPORTED | 1813 #ifdef PNG_READ_BACKGROUND_SUPPORTED |
| 1726 /* Handle alpha and tRNS by replacing with a background color. Prior to | 1814 /* Handle alpha and tRNS by replacing with a background color. Prior to |
| 1727 * libpng-1.5.4 this API must not be called before the PNG file header has been | 1815 * libpng-1.5.4 this API must not be called before the PNG file header has been |
| 1728 * read. Doing so will result in unexpected behavior and possible warnings or | 1816 * read. Doing so will result in unexpected behavior and possible warnings or |
| 1729 * errors if the PNG file contains a bKGD chunk. | 1817 * errors if the PNG file contains a bKGD chunk. |
| 1730 */ | 1818 */ |
| 1731 PNG_FP_EXPORT(47, void, png_set_background, (png_structrp png_ptr, | 1819 PNG_FP_EXPORT(47, |
| 1732 png_const_color_16p background_color, int background_gamma_code, | 1820 void, |
| 1733 int need_expand, double background_gamma)) | 1821 png_set_background, |
| 1734 PNG_FIXED_EXPORT(215, void, png_set_background_fixed, (png_structrp png_ptr, | 1822 (png_structrp png_ptr, |
| 1735 png_const_color_16p background_color, int background_gamma_code, | 1823 png_const_color_16p background_color, |
| 1736 int need_expand, png_fixed_point background_gamma)) | 1824 int background_gamma_code, |
| 1825 int need_expand, | |
| 1826 double background_gamma)) | |
| 1827 PNG_FIXED_EXPORT(215, | |
| 1828 void, | |
| 1829 png_set_background_fixed, | |
| 1830 (png_structrp png_ptr, | |
| 1831 png_const_color_16p background_color, | |
| 1832 int background_gamma_code, | |
| 1833 int need_expand, | |
| 1834 png_fixed_point background_gamma)) | |
| 1737 #endif | 1835 #endif |
| 1738 #ifdef PNG_READ_BACKGROUND_SUPPORTED | 1836 #ifdef PNG_READ_BACKGROUND_SUPPORTED |
| 1739 # define PNG_BACKGROUND_GAMMA_UNKNOWN 0 | 1837 #define PNG_BACKGROUND_GAMMA_UNKNOWN 0 |
| 1740 # define PNG_BACKGROUND_GAMMA_SCREEN 1 | 1838 #define PNG_BACKGROUND_GAMMA_SCREEN 1 |
| 1741 # define PNG_BACKGROUND_GAMMA_FILE 2 | 1839 #define PNG_BACKGROUND_GAMMA_FILE 2 |
| 1742 # define PNG_BACKGROUND_GAMMA_UNIQUE 3 | 1840 #define PNG_BACKGROUND_GAMMA_UNIQUE 3 |
| 1743 #endif | 1841 #endif |
| 1744 | 1842 |
| 1745 #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED | 1843 #ifdef PNG_READ_SCALE_16_TO_8_SUPPORTED |
| 1746 /* Scale a 16-bit depth file down to 8-bit, accurately. */ | 1844 /* Scale a 16-bit depth file down to 8-bit, accurately. */ |
| 1747 PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr)); | 1845 PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr)); |
| 1748 #endif | 1846 #endif |
| 1749 | 1847 |
| 1750 #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED | 1848 #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED |
| 1751 #define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */ | 1849 #define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */ |
| 1752 /* Strip the second byte of information from a 16-bit depth file. */ | 1850 /* Strip the second byte of information from a 16-bit depth file. */ |
| 1753 PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr)); | 1851 PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr)); |
| 1754 #endif | 1852 #endif |
| 1755 | 1853 |
| 1756 #ifdef PNG_READ_QUANTIZE_SUPPORTED | 1854 #ifdef PNG_READ_QUANTIZE_SUPPORTED |
| 1757 /* Turn on quantizing, and reduce the palette to the number of colors | 1855 /* Turn on quantizing, and reduce the palette to the number of colors |
| 1758 * available. | 1856 * available. |
| 1759 */ | 1857 */ |
| 1760 PNG_EXPORT(49, void, png_set_quantize, (png_structrp png_ptr, | 1858 PNG_EXPORT(49, |
| 1761 png_colorp palette, int num_palette, int maximum_colors, | 1859 void, |
| 1762 png_const_uint_16p histogram, int full_quantize)); | 1860 png_set_quantize, |
| 1861 (png_structrp png_ptr, | |
| 1862 png_colorp palette, | |
| 1863 int num_palette, | |
| 1864 int maximum_colors, | |
| 1865 png_const_uint_16p histogram, | |
| 1866 int full_quantize)); | |
| 1763 #endif | 1867 #endif |
| 1764 | 1868 |
| 1765 #ifdef PNG_READ_GAMMA_SUPPORTED | 1869 #ifdef PNG_READ_GAMMA_SUPPORTED |
| 1766 /* The threshold on gamma processing is configurable but hard-wired into the | 1870 /* The threshold on gamma processing is configurable but hard-wired into the |
| 1767 * library. The following is the floating point variant. | 1871 * library. The following is the floating point variant. |
| 1768 */ | 1872 */ |
| 1769 #define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED*.00001) | 1873 #define PNG_GAMMA_THRESHOLD (PNG_GAMMA_THRESHOLD_FIXED * .00001) |
| 1770 | 1874 |
| 1771 /* Handle gamma correction. Screen_gamma=(display_exponent). | 1875 /* Handle gamma correction. Screen_gamma=(display_exponent). |
| 1772 * NOTE: this API simply sets the screen and file gamma values. It will | 1876 * NOTE: this API simply sets the screen and file gamma values. It will |
| 1773 * therefore override the value for gamma in a PNG file if it is called after | 1877 * therefore override the value for gamma in a PNG file if it is called after |
| 1774 * the file header has been read - use with care - call before reading the PNG | 1878 * the file header has been read - use with care - call before reading the PNG |
| 1775 * file for best results! | 1879 * file for best results! |
| 1776 * | 1880 * |
| 1777 * These routines accept the same gamma values as png_set_alpha_mode (described | 1881 * These routines accept the same gamma values as png_set_alpha_mode (described |
| 1778 * above). The PNG_GAMMA_ defines and PNG_DEFAULT_sRGB can be passed to either | 1882 * above). The PNG_GAMMA_ defines and PNG_DEFAULT_sRGB can be passed to either |
| 1779 * API (floating point or fixed.) Notice, however, that the 'file_gamma' value | 1883 * API (floating point or fixed.) Notice, however, that the 'file_gamma' value |
| 1780 * is the inverse of a 'screen gamma' value. | 1884 * is the inverse of a 'screen gamma' value. |
| 1781 */ | 1885 */ |
| 1782 PNG_FP_EXPORT(50, void, png_set_gamma, (png_structrp png_ptr, | 1886 PNG_FP_EXPORT(50, |
| 1783 double screen_gamma, double override_file_gamma)) | 1887 void, |
| 1784 PNG_FIXED_EXPORT(208, void, png_set_gamma_fixed, (png_structrp png_ptr, | 1888 png_set_gamma, |
| 1785 png_fixed_point screen_gamma, png_fixed_point override_file_gamma)) | 1889 (png_structrp png_ptr, |
| 1890 double screen_gamma, | |
| 1891 double override_file_gamma)) | |
| 1892 PNG_FIXED_EXPORT(208, | |
| 1893 void, | |
| 1894 png_set_gamma_fixed, | |
| 1895 (png_structrp png_ptr, | |
| 1896 png_fixed_point screen_gamma, | |
| 1897 png_fixed_point override_file_gamma)) | |
| 1786 #endif | 1898 #endif |
| 1787 | 1899 |
| 1788 #ifdef PNG_WRITE_FLUSH_SUPPORTED | 1900 #ifdef PNG_WRITE_FLUSH_SUPPORTED |
| 1789 /* Set how many lines between output flushes - 0 for no flushing */ | 1901 /* Set how many lines between output flushes - 0 for no flushing */ |
| 1790 PNG_EXPORT(51, void, png_set_flush, (png_structrp png_ptr, int nrows)); | 1902 PNG_EXPORT(51, void, png_set_flush, (png_structrp png_ptr, int nrows)); |
| 1791 /* Flush the current PNG output buffer */ | 1903 /* Flush the current PNG output buffer */ |
| 1792 PNG_EXPORT(52, void, png_write_flush, (png_structrp png_ptr)); | 1904 PNG_EXPORT(52, void, png_write_flush, (png_structrp png_ptr)); |
| 1793 #endif | 1905 #endif |
| 1794 | 1906 |
| 1795 /* Optional update palette with requested transformations */ | 1907 /* Optional update palette with requested transformations */ |
| 1796 PNG_EXPORT(53, void, png_start_read_image, (png_structrp png_ptr)); | 1908 PNG_EXPORT(53, void, png_start_read_image, (png_structrp png_ptr)); |
| 1797 | 1909 |
| 1798 /* Optional call to update the users info structure */ | 1910 /* Optional call to update the users info structure */ |
| 1799 PNG_EXPORT(54, void, png_read_update_info, (png_structrp png_ptr, | 1911 PNG_EXPORT(54, |
| 1800 png_inforp info_ptr)); | 1912 void, |
| 1913 png_read_update_info, | |
| 1914 (png_structrp png_ptr, png_inforp info_ptr)); | |
| 1801 | 1915 |
| 1802 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED | 1916 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED |
| 1803 /* Read one or more rows of image data. */ | 1917 /* Read one or more rows of image data. */ |
| 1804 PNG_EXPORT(55, void, png_read_rows, (png_structrp png_ptr, png_bytepp row, | 1918 PNG_EXPORT(55, |
| 1805 png_bytepp display_row, png_uint_32 num_rows)); | 1919 void, |
| 1920 png_read_rows, | |
| 1921 (png_structrp png_ptr, | |
| 1922 png_bytepp row, | |
| 1923 png_bytepp display_row, | |
| 1924 png_uint_32 num_rows)); | |
| 1806 #endif | 1925 #endif |
| 1807 | 1926 |
| 1808 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED | 1927 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED |
| 1809 /* Read a row of data. */ | 1928 /* Read a row of data. */ |
| 1810 PNG_EXPORT(56, void, png_read_row, (png_structrp png_ptr, png_bytep row, | 1929 PNG_EXPORT(56, |
| 1811 png_bytep display_row)); | 1930 void, |
| 1931 png_read_row, | |
| 1932 (png_structrp png_ptr, png_bytep row, png_bytep display_row)); | |
| 1812 #endif | 1933 #endif |
| 1813 | 1934 |
| 1814 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED | 1935 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED |
| 1815 /* Read the whole image into memory at once. */ | 1936 /* Read the whole image into memory at once. */ |
| 1816 PNG_EXPORT(57, void, png_read_image, (png_structrp png_ptr, png_bytepp image)); | 1937 PNG_EXPORT(57, void, png_read_image, (png_structrp png_ptr, png_bytepp image)); |
| 1817 #endif | 1938 #endif |
| 1818 | 1939 |
| 1819 /* Write a row of image data */ | 1940 /* Write a row of image data */ |
| 1820 PNG_EXPORT(58, void, png_write_row, (png_structrp png_ptr, | 1941 PNG_EXPORT(58, |
| 1821 png_const_bytep row)); | 1942 void, |
| 1943 png_write_row, | |
| 1944 (png_structrp png_ptr, png_const_bytep row)); | |
| 1822 | 1945 |
| 1823 /* Write a few rows of image data: (*row) is not written; however, the type | 1946 /* Write a few rows of image data: (*row) is not written; however, the type |
| 1824 * is declared as writeable to maintain compatibility with previous versions | 1947 * is declared as writeable to maintain compatibility with previous versions |
| 1825 * of libpng and to allow the 'display_row' array from read_rows to be passed | 1948 * of libpng and to allow the 'display_row' array from read_rows to be passed |
| 1826 * unchanged to write_rows. | 1949 * unchanged to write_rows. |
| 1827 */ | 1950 */ |
| 1828 PNG_EXPORT(59, void, png_write_rows, (png_structrp png_ptr, png_bytepp row, | 1951 PNG_EXPORT(59, |
| 1829 png_uint_32 num_rows)); | 1952 void, |
| 1953 png_write_rows, | |
| 1954 (png_structrp png_ptr, png_bytepp row, png_uint_32 num_rows)); | |
| 1830 | 1955 |
| 1831 /* Write the image data */ | 1956 /* Write the image data */ |
| 1832 PNG_EXPORT(60, void, png_write_image, (png_structrp png_ptr, png_bytepp image)); | 1957 PNG_EXPORT(60, void, png_write_image, (png_structrp png_ptr, png_bytepp image)); |
| 1833 | 1958 |
| 1834 /* Write the end of the PNG file. */ | 1959 /* Write the end of the PNG file. */ |
| 1835 PNG_EXPORT(61, void, png_write_end, (png_structrp png_ptr, | 1960 PNG_EXPORT(61, |
| 1836 png_inforp info_ptr)); | 1961 void, |
| 1962 png_write_end, | |
| 1963 (png_structrp png_ptr, png_inforp info_ptr)); | |
| 1837 | 1964 |
| 1838 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED | 1965 #ifdef PNG_SEQUENTIAL_READ_SUPPORTED |
| 1839 /* Read the end of the PNG file. */ | 1966 /* Read the end of the PNG file. */ |
| 1840 PNG_EXPORT(62, void, png_read_end, (png_structrp png_ptr, png_inforp info_ptr)); | 1967 PNG_EXPORT(62, void, png_read_end, (png_structrp png_ptr, png_inforp info_ptr)); |
| 1841 #endif | 1968 #endif |
| 1842 | 1969 |
| 1843 /* Free any memory associated with the png_info_struct */ | 1970 /* Free any memory associated with the png_info_struct */ |
| 1844 PNG_EXPORT(63, void, png_destroy_info_struct, (png_const_structrp png_ptr, | 1971 PNG_EXPORT(63, |
| 1845 png_infopp info_ptr_ptr)); | 1972 void, |
| 1973 png_destroy_info_struct, | |
| 1974 (png_const_structrp png_ptr, png_infopp info_ptr_ptr)); | |
| 1846 | 1975 |
| 1847 /* Free any memory associated with the png_struct and the png_info_structs */ | 1976 /* Free any memory associated with the png_struct and the png_info_structs */ |
| 1848 PNG_EXPORT(64, void, png_destroy_read_struct, (png_structpp png_ptr_ptr, | 1977 PNG_EXPORT(64, |
| 1849 png_infopp info_ptr_ptr, png_infopp end_info_ptr_ptr)); | 1978 void, |
| 1979 png_destroy_read_struct, | |
| 1980 (png_structpp png_ptr_ptr, | |
| 1981 png_infopp info_ptr_ptr, | |
| 1982 png_infopp end_info_ptr_ptr)); | |
| 1850 | 1983 |
| 1851 /* Free any memory associated with the png_struct and the png_info_structs */ | 1984 /* Free any memory associated with the png_struct and the png_info_structs */ |
| 1852 PNG_EXPORT(65, void, png_destroy_write_struct, (png_structpp png_ptr_ptr, | 1985 PNG_EXPORT(65, |
| 1853 png_infopp info_ptr_ptr)); | 1986 void, |
| 1987 png_destroy_write_struct, | |
| 1988 (png_structpp png_ptr_ptr, png_infopp info_ptr_ptr)); | |
| 1854 | 1989 |
| 1855 /* Set the libpng method of handling chunk CRC errors */ | 1990 /* Set the libpng method of handling chunk CRC errors */ |
| 1856 PNG_EXPORT(66, void, png_set_crc_action, (png_structrp png_ptr, int crit_action, | 1991 PNG_EXPORT(66, |
| 1857 int ancil_action)); | 1992 void, |
| 1993 png_set_crc_action, | |
| 1994 (png_structrp png_ptr, int crit_action, int ancil_action)); | |
| 1858 | 1995 |
| 1859 /* Values for png_set_crc_action() say how to handle CRC errors in | 1996 /* Values for png_set_crc_action() say how to handle CRC errors in |
| 1860 * ancillary and critical chunks, and whether to use the data contained | 1997 * ancillary and critical chunks, and whether to use the data contained |
| 1861 * therein. Note that it is impossible to "discard" data in a critical | 1998 * therein. Note that it is impossible to "discard" data in a critical |
| 1862 * chunk. For versions prior to 0.90, the action was always error/quit, | 1999 * chunk. For versions prior to 0.90, the action was always error/quit, |
| 1863 * whereas in version 0.90 and later, the action for CRC errors in ancillary | 2000 * whereas in version 0.90 and later, the action for CRC errors in ancillary |
| 1864 * chunks is warn/discard. These values should NOT be changed. | 2001 * chunks is warn/discard. These values should NOT be changed. |
| 1865 * | 2002 * |
| 1866 * value action:critical action:ancillary | 2003 * value action:critical action:ancillary |
| 1867 */ | 2004 */ |
| 1868 #define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ | 2005 #define PNG_CRC_DEFAULT 0 /* error/quit warn/discard data */ |
| 1869 #define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ | 2006 #define PNG_CRC_ERROR_QUIT 1 /* error/quit error/quit */ |
| 1870 #define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ | 2007 #define PNG_CRC_WARN_DISCARD 2 /* (INVALID) warn/discard data */ |
| 1871 #define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ | 2008 #define PNG_CRC_WARN_USE 3 /* warn/use data warn/use data */ |
| 1872 #define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ | 2009 #define PNG_CRC_QUIET_USE 4 /* quiet/use data quiet/use data */ |
| 1873 #define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ | 2010 #define PNG_CRC_NO_CHANGE 5 /* use current value use current value */ |
| 1874 | 2011 |
| 1875 /* These functions give the user control over the scan-line filtering in | 2012 /* These functions give the user control over the scan-line filtering in |
| 1876 * libpng and the compression methods used by zlib. These functions are | 2013 * libpng and the compression methods used by zlib. These functions are |
| 1877 * mainly useful for testing, as the defaults should work with most users. | 2014 * mainly useful for testing, as the defaults should work with most users. |
| 1878 * Those users who are tight on memory or want faster performance at the | 2015 * Those users who are tight on memory or want faster performance at the |
| 1879 * expense of compression can modify them. See the compression library | 2016 * expense of compression can modify them. See the compression library |
| 1880 * header file (zlib.h) for an explination of the compression functions. | 2017 * header file (zlib.h) for an explination of the compression functions. |
| 1881 */ | 2018 */ |
| 1882 | 2019 |
| 1883 /* Set the filtering method(s) used by libpng. Currently, the only valid | 2020 /* Set the filtering method(s) used by libpng. Currently, the only valid |
| 1884 * value for "method" is 0. | 2021 * value for "method" is 0. |
| 1885 */ | 2022 */ |
| 1886 PNG_EXPORT(67, void, png_set_filter, (png_structrp png_ptr, int method, | 2023 PNG_EXPORT(67, |
| 1887 int filters)); | 2024 void, |
| 2025 png_set_filter, | |
| 2026 (png_structrp png_ptr, int method, int filters)); | |
| 1888 | 2027 |
| 1889 /* Flags for png_set_filter() to say which filters to use. The flags | 2028 /* Flags for png_set_filter() to say which filters to use. The flags |
| 1890 * are chosen so that they don't conflict with real filter types | 2029 * are chosen so that they don't conflict with real filter types |
| 1891 * below, in case they are supplied instead of the #defined constants. | 2030 * below, in case they are supplied instead of the #defined constants. |
| 1892 * These values should NOT be changed. | 2031 * These values should NOT be changed. |
| 1893 */ | 2032 */ |
| 1894 #define PNG_NO_FILTERS 0x00 | 2033 #define PNG_NO_FILTERS 0x00 |
| 1895 #define PNG_FILTER_NONE 0x08 | 2034 #define PNG_FILTER_NONE 0x08 |
| 1896 #define PNG_FILTER_SUB 0x10 | 2035 #define PNG_FILTER_SUB 0x10 |
| 1897 #define PNG_FILTER_UP 0x20 | 2036 #define PNG_FILTER_UP 0x20 |
| 1898 #define PNG_FILTER_AVG 0x40 | 2037 #define PNG_FILTER_AVG 0x40 |
| 1899 #define PNG_FILTER_PAETH 0x80 | 2038 #define PNG_FILTER_PAETH 0x80 |
| 1900 #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ | 2039 #define PNG_ALL_FILTERS \ |
| 1901 PNG_FILTER_AVG | PNG_FILTER_PAETH) | 2040 (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | PNG_FILTER_AVG | \ |
| 2041 PNG_FILTER_PAETH) | |
| 1902 | 2042 |
| 1903 /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. | 2043 /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. |
| 1904 * These defines should NOT be changed. | 2044 * These defines should NOT be changed. |
| 1905 */ | 2045 */ |
| 1906 #define PNG_FILTER_VALUE_NONE 0 | 2046 #define PNG_FILTER_VALUE_NONE 0 |
| 1907 #define PNG_FILTER_VALUE_SUB 1 | 2047 #define PNG_FILTER_VALUE_SUB 1 |
| 1908 #define PNG_FILTER_VALUE_UP 2 | 2048 #define PNG_FILTER_VALUE_UP 2 |
| 1909 #define PNG_FILTER_VALUE_AVG 3 | 2049 #define PNG_FILTER_VALUE_AVG 3 |
| 1910 #define PNG_FILTER_VALUE_PAETH 4 | 2050 #define PNG_FILTER_VALUE_PAETH 4 |
| 1911 #define PNG_FILTER_VALUE_LAST 5 | 2051 #define PNG_FILTER_VALUE_LAST 5 |
| 1912 | 2052 |
| 1913 #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */ | 2053 #ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED /* EXPERIMENTAL */ |
| 1914 /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ | 2054 /* The "heuristic_method" is given by one of the PNG_FILTER_HEURISTIC_ |
| 1915 * defines, either the default (minimum-sum-of-absolute-differences), or | 2055 * defines, either the default (minimum-sum-of-absolute-differences), or |
| 1916 * the experimental method (weighted-minimum-sum-of-absolute-differences). | 2056 * the experimental method (weighted-minimum-sum-of-absolute-differences). |
| 1917 * | 2057 * |
| 1918 * Weights are factors >= 1.0, indicating how important it is to keep the | 2058 * Weights are factors >= 1.0, indicating how important it is to keep the |
| 1919 * filter type consistent between rows. Larger numbers mean the current | 2059 * filter type consistent between rows. Larger numbers mean the current |
| 1920 * filter is that many times as likely to be the same as the "num_weights" | 2060 * filter is that many times as likely to be the same as the "num_weights" |
| 1921 * previous filters. This is cumulative for each previous row with a weight. | 2061 * previous filters. This is cumulative for each previous row with a weight. |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 1932 * setting the costs. Costs try to improve the speed of decompression without | 2072 * setting the costs. Costs try to improve the speed of decompression without |
| 1933 * unduly increasing the compressed image size. | 2073 * unduly increasing the compressed image size. |
| 1934 * | 2074 * |
| 1935 * A negative weight or cost indicates the default value is to be used, and | 2075 * A negative weight or cost indicates the default value is to be used, and |
| 1936 * values in the range [0.0, 1.0) indicate the value is to remain unchanged. | 2076 * values in the range [0.0, 1.0) indicate the value is to remain unchanged. |
| 1937 * The default values for both weights and costs are currently 1.0, but may | 2077 * The default values for both weights and costs are currently 1.0, but may |
| 1938 * change if good general weighting/cost heuristics can be found. If both | 2078 * change if good general weighting/cost heuristics can be found. If both |
| 1939 * the weights and costs are set to 1.0, this degenerates the WEIGHTED method | 2079 * the weights and costs are set to 1.0, this degenerates the WEIGHTED method |
| 1940 * to the UNWEIGHTED method, but with added encoding time/computation. | 2080 * to the UNWEIGHTED method, but with added encoding time/computation. |
| 1941 */ | 2081 */ |
| 1942 PNG_FP_EXPORT(68, void, png_set_filter_heuristics, (png_structrp png_ptr, | 2082 PNG_FP_EXPORT(68, |
| 1943 int heuristic_method, int num_weights, png_const_doublep filter_weights, | 2083 void, |
| 1944 png_const_doublep filter_costs)) | 2084 png_set_filter_heuristics, |
| 1945 PNG_FIXED_EXPORT(209, void, png_set_filter_heuristics_fixed, | 2085 (png_structrp png_ptr, |
| 1946 (png_structrp png_ptr, int heuristic_method, int num_weights, | 2086 int heuristic_method, |
| 1947 png_const_fixed_point_p filter_weights, | 2087 int num_weights, |
| 1948 png_const_fixed_point_p filter_costs)) | 2088 png_const_doublep filter_weights, |
| 2089 png_const_doublep filter_costs)) | |
| 2090 PNG_FIXED_EXPORT(209, | |
| 2091 void, | |
| 2092 png_set_filter_heuristics_fixed, | |
| 2093 (png_structrp png_ptr, | |
| 2094 int heuristic_method, | |
| 2095 int num_weights, | |
| 2096 png_const_fixed_point_p filter_weights, | |
| 2097 png_const_fixed_point_p filter_costs)) | |
| 1949 #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ | 2098 #endif /* PNG_WRITE_WEIGHTED_FILTER_SUPPORTED */ |
| 1950 | 2099 |
| 1951 /* Heuristic used for row filter selection. These defines should NOT be | 2100 /* Heuristic used for row filter selection. These defines should NOT be |
| 1952 * changed. | 2101 * changed. |
| 1953 */ | 2102 */ |
| 1954 #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ | 2103 #define PNG_FILTER_HEURISTIC_DEFAULT 0 /* Currently "UNWEIGHTED" */ |
| 1955 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ | 2104 #define PNG_FILTER_HEURISTIC_UNWEIGHTED 1 /* Used by libpng < 0.95 */ |
| 1956 #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ | 2105 #define PNG_FILTER_HEURISTIC_WEIGHTED 2 /* Experimental feature */ |
| 1957 #define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ | 2106 #define PNG_FILTER_HEURISTIC_LAST 3 /* Not a valid value */ |
| 1958 | 2107 |
| 1959 #ifdef PNG_WRITE_SUPPORTED | 2108 #ifdef PNG_WRITE_SUPPORTED |
| 1960 /* Set the library compression level. Currently, valid values range from | 2109 /* Set the library compression level. Currently, valid values range from |
| 1961 * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 | 2110 * 0 - 9, corresponding directly to the zlib compression levels 0 - 9 |
| 1962 * (0 - no compression, 9 - "maximal" compression). Note that tests have | 2111 * (0 - no compression, 9 - "maximal" compression). Note that tests have |
| 1963 * shown that zlib compression levels 3-6 usually perform as well as level 9 | 2112 * shown that zlib compression levels 3-6 usually perform as well as level 9 |
| 1964 * for PNG images, and do considerably fewer caclulations. In the future, | 2113 * for PNG images, and do considerably fewer caclulations. In the future, |
| 1965 * these values may not correspond directly to the zlib compression levels. | 2114 * these values may not correspond directly to the zlib compression levels. |
| 1966 */ | 2115 */ |
| 1967 PNG_EXPORT(69, void, png_set_compression_level, (png_structrp png_ptr, | 2116 PNG_EXPORT(69, |
| 1968 int level)); | 2117 void, |
| 2118 png_set_compression_level, | |
| 2119 (png_structrp png_ptr, int level)); | |
| 1969 | 2120 |
| 1970 PNG_EXPORT(70, void, png_set_compression_mem_level, (png_structrp png_ptr, | 2121 PNG_EXPORT(70, |
| 1971 int mem_level)); | 2122 void, |
| 2123 png_set_compression_mem_level, | |
| 2124 (png_structrp png_ptr, int mem_level)); | |
| 1972 | 2125 |
| 1973 PNG_EXPORT(71, void, png_set_compression_strategy, (png_structrp png_ptr, | 2126 PNG_EXPORT(71, |
| 1974 int strategy)); | 2127 void, |
| 2128 png_set_compression_strategy, | |
| 2129 (png_structrp png_ptr, int strategy)); | |
| 1975 | 2130 |
| 1976 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a | 2131 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a |
| 1977 * smaller value of window_bits if it can do so safely. | 2132 * smaller value of window_bits if it can do so safely. |
| 1978 */ | 2133 */ |
| 1979 PNG_EXPORT(72, void, png_set_compression_window_bits, (png_structrp png_ptr, | 2134 PNG_EXPORT(72, |
| 1980 int window_bits)); | 2135 void, |
| 2136 png_set_compression_window_bits, | |
| 2137 (png_structrp png_ptr, int window_bits)); | |
| 1981 | 2138 |
| 1982 PNG_EXPORT(73, void, png_set_compression_method, (png_structrp png_ptr, | 2139 PNG_EXPORT(73, |
| 1983 int method)); | 2140 void, |
| 2141 png_set_compression_method, | |
| 2142 (png_structrp png_ptr, int method)); | |
| 1984 #endif | 2143 #endif |
| 1985 | 2144 |
| 1986 #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED | 2145 #ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED |
| 1987 /* Also set zlib parameters for compressing non-IDAT chunks */ | 2146 /* Also set zlib parameters for compressing non-IDAT chunks */ |
| 1988 PNG_EXPORT(222, void, png_set_text_compression_level, (png_structrp png_ptr, | 2147 PNG_EXPORT(222, |
| 1989 int level)); | 2148 void, |
| 2149 png_set_text_compression_level, | |
| 2150 (png_structrp png_ptr, int level)); | |
| 1990 | 2151 |
| 1991 PNG_EXPORT(223, void, png_set_text_compression_mem_level, (png_structrp png_ptr, | 2152 PNG_EXPORT(223, |
| 1992 int mem_level)); | 2153 void, |
| 2154 png_set_text_compression_mem_level, | |
| 2155 (png_structrp png_ptr, int mem_level)); | |
| 1993 | 2156 |
| 1994 PNG_EXPORT(224, void, png_set_text_compression_strategy, (png_structrp png_ptr, | 2157 PNG_EXPORT(224, |
| 1995 int strategy)); | 2158 void, |
| 2159 png_set_text_compression_strategy, | |
| 2160 (png_structrp png_ptr, int strategy)); | |
| 1996 | 2161 |
| 1997 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a | 2162 /* If PNG_WRITE_OPTIMIZE_CMF_SUPPORTED is defined, libpng will use a |
| 1998 * smaller value of window_bits if it can do so safely. | 2163 * smaller value of window_bits if it can do so safely. |
| 1999 */ | 2164 */ |
| 2000 PNG_EXPORT(225, void, png_set_text_compression_window_bits, | 2165 PNG_EXPORT(225, |
| 2001 (png_structrp png_ptr, int window_bits)); | 2166 void, |
| 2167 png_set_text_compression_window_bits, | |
| 2168 (png_structrp png_ptr, int window_bits)); | |
| 2002 | 2169 |
| 2003 PNG_EXPORT(226, void, png_set_text_compression_method, (png_structrp png_ptr, | 2170 PNG_EXPORT(226, |
| 2004 int method)); | 2171 void, |
| 2172 png_set_text_compression_method, | |
| 2173 (png_structrp png_ptr, int method)); | |
| 2005 #endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */ | 2174 #endif /* PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED */ |
| 2006 | 2175 |
| 2007 /* These next functions are called for input/output, memory, and error | 2176 /* These next functions are called for input/output, memory, and error |
| 2008 * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, | 2177 * handling. They are in the file pngrio.c, pngwio.c, and pngerror.c, |
| 2009 * and call standard C I/O routines such as fread(), fwrite(), and | 2178 * and call standard C I/O routines such as fread(), fwrite(), and |
| 2010 * fprintf(). These functions can be made to use other I/O routines | 2179 * fprintf(). These functions can be made to use other I/O routines |
| 2011 * at run time for those applications that need to handle I/O in a | 2180 * at run time for those applications that need to handle I/O in a |
| 2012 * different manner by calling png_set_???_fn(). See libpng-manual.txt for | 2181 * different manner by calling png_set_???_fn(). See libpng-manual.txt for |
| 2013 * more information. | 2182 * more information. |
| 2014 */ | 2183 */ |
| 2015 | 2184 |
| 2016 #ifdef PNG_STDIO_SUPPORTED | 2185 #ifdef PNG_STDIO_SUPPORTED |
| 2017 /* Initialize the input/output for the PNG file to the default functions. */ | 2186 /* Initialize the input/output for the PNG file to the default functions. */ |
| 2018 PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, png_FILE_p fp)); | 2187 PNG_EXPORT(74, void, png_init_io, (png_structrp png_ptr, png_FILE_p fp)); |
| 2019 #endif | 2188 #endif |
| 2020 | 2189 |
| 2021 /* Replace the (error and abort), and warning functions with user | 2190 /* Replace the (error and abort), and warning functions with user |
| 2022 * supplied functions. If no messages are to be printed you must still | 2191 * supplied functions. If no messages are to be printed you must still |
| 2023 * write and use replacement functions. The replacement error_fn should | 2192 * write and use replacement functions. The replacement error_fn should |
| 2024 * still do a longjmp to the last setjmp location if you are using this | 2193 * still do a longjmp to the last setjmp location if you are using this |
| 2025 * method of error handling. If error_fn or warning_fn is NULL, the | 2194 * method of error handling. If error_fn or warning_fn is NULL, the |
| 2026 * default function will be used. | 2195 * default function will be used. |
| 2027 */ | 2196 */ |
| 2028 | 2197 |
| 2029 PNG_EXPORT(75, void, png_set_error_fn, (png_structrp png_ptr, | 2198 PNG_EXPORT(75, |
| 2030 png_voidp error_ptr, png_error_ptr error_fn, png_error_ptr warning_fn)); | 2199 void, |
| 2200 png_set_error_fn, | |
| 2201 (png_structrp png_ptr, | |
| 2202 png_voidp error_ptr, | |
| 2203 png_error_ptr error_fn, | |
| 2204 png_error_ptr warning_fn)); | |
| 2031 | 2205 |
| 2032 /* Return the user pointer associated with the error functions */ | 2206 /* Return the user pointer associated with the error functions */ |
| 2033 PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structrp png_ptr)); | 2207 PNG_EXPORT(76, png_voidp, png_get_error_ptr, (png_const_structrp png_ptr)); |
| 2034 | 2208 |
| 2035 /* Replace the default data output functions with a user supplied one(s). | 2209 /* Replace the default data output functions with a user supplied one(s). |
| 2036 * If buffered output is not used, then output_flush_fn can be set to NULL. | 2210 * If buffered output is not used, then output_flush_fn can be set to NULL. |
| 2037 * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time | 2211 * If PNG_WRITE_FLUSH_SUPPORTED is not defined at libpng compile time |
| 2038 * output_flush_fn will be ignored (and thus can be NULL). | 2212 * output_flush_fn will be ignored (and thus can be NULL). |
| 2039 * It is probably a mistake to use NULL for output_flush_fn if | 2213 * It is probably a mistake to use NULL for output_flush_fn if |
| 2040 * write_data_fn is not also NULL unless you have built libpng with | 2214 * write_data_fn is not also NULL unless you have built libpng with |
| 2041 * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's | 2215 * PNG_WRITE_FLUSH_SUPPORTED undefined, because in this case libpng's |
| 2042 * default flush function, which uses the standard *FILE structure, will | 2216 * default flush function, which uses the standard *FILE structure, will |
| 2043 * be used. | 2217 * be used. |
| 2044 */ | 2218 */ |
| 2045 PNG_EXPORT(77, void, png_set_write_fn, (png_structrp png_ptr, png_voidp io_ptr, | 2219 PNG_EXPORT(77, |
| 2046 png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)); | 2220 void, |
| 2221 png_set_write_fn, | |
| 2222 (png_structrp png_ptr, | |
| 2223 png_voidp io_ptr, | |
| 2224 png_rw_ptr write_data_fn, | |
| 2225 png_flush_ptr output_flush_fn)); | |
| 2047 | 2226 |
| 2048 /* Replace the default data input function with a user supplied one. */ | 2227 /* Replace the default data input function with a user supplied one. */ |
| 2049 PNG_EXPORT(78, void, png_set_read_fn, (png_structrp png_ptr, png_voidp io_ptr, | 2228 PNG_EXPORT(78, |
| 2050 png_rw_ptr read_data_fn)); | 2229 void, |
| 2230 png_set_read_fn, | |
| 2231 (png_structrp png_ptr, png_voidp io_ptr, png_rw_ptr read_data_fn)); | |
| 2051 | 2232 |
| 2052 /* Return the user pointer associated with the I/O functions */ | 2233 /* Return the user pointer associated with the I/O functions */ |
| 2053 PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_const_structrp png_ptr)); | 2234 PNG_EXPORT(79, png_voidp, png_get_io_ptr, (png_const_structrp png_ptr)); |
| 2054 | 2235 |
| 2055 PNG_EXPORT(80, void, png_set_read_status_fn, (png_structrp png_ptr, | 2236 PNG_EXPORT(80, |
| 2056 png_read_status_ptr read_row_fn)); | 2237 void, |
| 2238 png_set_read_status_fn, | |
| 2239 (png_structrp png_ptr, png_read_status_ptr read_row_fn)); | |
| 2057 | 2240 |
| 2058 PNG_EXPORT(81, void, png_set_write_status_fn, (png_structrp png_ptr, | 2241 PNG_EXPORT(81, |
| 2059 png_write_status_ptr write_row_fn)); | 2242 void, |
| 2243 png_set_write_status_fn, | |
| 2244 (png_structrp png_ptr, png_write_status_ptr write_row_fn)); | |
| 2060 | 2245 |
| 2061 #ifdef PNG_USER_MEM_SUPPORTED | 2246 #ifdef PNG_USER_MEM_SUPPORTED |
| 2062 /* Replace the default memory allocation functions with user supplied one(s). */ | 2247 /* Replace the default memory allocation functions with user supplied one(s). */ |
| 2063 PNG_EXPORT(82, void, png_set_mem_fn, (png_structrp png_ptr, png_voidp mem_ptr, | 2248 PNG_EXPORT(82, |
| 2064 png_malloc_ptr malloc_fn, png_free_ptr free_fn)); | 2249 void, |
| 2250 png_set_mem_fn, | |
| 2251 (png_structrp png_ptr, | |
| 2252 png_voidp mem_ptr, | |
| 2253 png_malloc_ptr malloc_fn, | |
| 2254 png_free_ptr free_fn)); | |
| 2065 /* Return the user pointer associated with the memory functions */ | 2255 /* Return the user pointer associated with the memory functions */ |
| 2066 PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structrp png_ptr)); | 2256 PNG_EXPORT(83, png_voidp, png_get_mem_ptr, (png_const_structrp png_ptr)); |
| 2067 #endif | 2257 #endif |
| 2068 | 2258 |
| 2069 #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED | 2259 #ifdef PNG_READ_USER_TRANSFORM_SUPPORTED |
| 2070 PNG_EXPORT(84, void, png_set_read_user_transform_fn, (png_structrp png_ptr, | 2260 PNG_EXPORT(84, |
| 2071 png_user_transform_ptr read_user_transform_fn)); | 2261 void, |
| 2262 png_set_read_user_transform_fn, | |
| 2263 (png_structrp png_ptr, | |
| 2264 png_user_transform_ptr read_user_transform_fn)); | |
| 2072 #endif | 2265 #endif |
| 2073 | 2266 |
| 2074 #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED | 2267 #ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED |
| 2075 PNG_EXPORT(85, void, png_set_write_user_transform_fn, (png_structrp png_ptr, | 2268 PNG_EXPORT(85, |
| 2076 png_user_transform_ptr write_user_transform_fn)); | 2269 void, |
| 2270 png_set_write_user_transform_fn, | |
| 2271 (png_structrp png_ptr, | |
| 2272 png_user_transform_ptr write_user_transform_fn)); | |
| 2077 #endif | 2273 #endif |
| 2078 | 2274 |
| 2079 #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED | 2275 #ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED |
| 2080 PNG_EXPORT(86, void, png_set_user_transform_info, (png_structrp png_ptr, | 2276 PNG_EXPORT(86, |
| 2081 png_voidp user_transform_ptr, int user_transform_depth, | 2277 void, |
| 2082 int user_transform_channels)); | 2278 png_set_user_transform_info, |
| 2279 (png_structrp png_ptr, | |
| 2280 png_voidp user_transform_ptr, | |
| 2281 int user_transform_depth, | |
| 2282 int user_transform_channels)); | |
| 2083 /* Return the user pointer associated with the user transform functions */ | 2283 /* Return the user pointer associated with the user transform functions */ |
| 2084 PNG_EXPORT(87, png_voidp, png_get_user_transform_ptr, | 2284 PNG_EXPORT(87, |
| 2085 (png_const_structrp png_ptr)); | 2285 png_voidp, |
| 2286 png_get_user_transform_ptr, | |
| 2287 (png_const_structrp png_ptr)); | |
| 2086 #endif | 2288 #endif |
| 2087 | 2289 |
| 2088 #ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED | 2290 #ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED |
| 2089 /* Return information about the row currently being processed. Note that these | 2291 /* Return information about the row currently being processed. Note that these |
| 2090 * APIs do not fail but will return unexpected results if called outside a user | 2292 * APIs do not fail but will return unexpected results if called outside a user |
| 2091 * transform callback. Also note that when transforming an interlaced image the | 2293 * transform callback. Also note that when transforming an interlaced image the |
| 2092 * row number is the row number within the sub-image of the interlace pass, so | 2294 * row number is the row number within the sub-image of the interlace pass, so |
| 2093 * the value will increase to the height of the sub-image (not the full image) | 2295 * the value will increase to the height of the sub-image (not the full image) |
| 2094 * then reset to 0 for the next pass. | 2296 * then reset to 0 for the next pass. |
| 2095 * | 2297 * |
| (...skipping 18 matching lines...) Expand all Loading... | |
| 2114 * The integer return from the callback function is interpreted thus: | 2316 * The integer return from the callback function is interpreted thus: |
| 2115 * | 2317 * |
| 2116 * negative: An error occured, png_chunk_error will be called. | 2318 * negative: An error occured, png_chunk_error will be called. |
| 2117 * zero: The chunk was not handled, the chunk will be saved. A critical | 2319 * zero: The chunk was not handled, the chunk will be saved. A critical |
| 2118 * chunk will cause an error at this point unless it is to be saved. | 2320 * chunk will cause an error at this point unless it is to be saved. |
| 2119 * positive: The chunk was handled, libpng will ignore/discard it. | 2321 * positive: The chunk was handled, libpng will ignore/discard it. |
| 2120 * | 2322 * |
| 2121 * See "INTERACTION WTIH USER CHUNK CALLBACKS" below for important notes about | 2323 * See "INTERACTION WTIH USER CHUNK CALLBACKS" below for important notes about |
| 2122 * how this behavior will change in libpng 1.7 | 2324 * how this behavior will change in libpng 1.7 |
| 2123 */ | 2325 */ |
| 2124 PNG_EXPORT(88, void, png_set_read_user_chunk_fn, (png_structrp png_ptr, | 2326 PNG_EXPORT(88, |
| 2125 png_voidp user_chunk_ptr, png_user_chunk_ptr read_user_chunk_fn)); | 2327 void, |
| 2328 png_set_read_user_chunk_fn, | |
| 2329 (png_structrp png_ptr, | |
| 2330 png_voidp user_chunk_ptr, | |
| 2331 png_user_chunk_ptr read_user_chunk_fn)); | |
| 2126 #endif | 2332 #endif |
| 2127 | 2333 |
| 2128 #ifdef PNG_USER_CHUNKS_SUPPORTED | 2334 #ifdef PNG_USER_CHUNKS_SUPPORTED |
| 2129 PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structrp png_ptr)); | 2335 PNG_EXPORT(89, png_voidp, png_get_user_chunk_ptr, (png_const_structrp png_ptr)); |
| 2130 #endif | 2336 #endif |
| 2131 | 2337 |
| 2132 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED | 2338 #ifdef PNG_PROGRESSIVE_READ_SUPPORTED |
| 2133 /* Sets the function callbacks for the push reader, and a pointer to a | 2339 /* Sets the function callbacks for the push reader, and a pointer to a |
| 2134 * user-defined structure available to the callback functions. | 2340 * user-defined structure available to the callback functions. |
| 2135 */ | 2341 */ |
| 2136 PNG_EXPORT(90, void, png_set_progressive_read_fn, (png_structrp png_ptr, | 2342 PNG_EXPORT(90, |
| 2137 png_voidp progressive_ptr, png_progressive_info_ptr info_fn, | 2343 void, |
| 2138 png_progressive_row_ptr row_fn, png_progressive_end_ptr end_fn)); | 2344 png_set_progressive_read_fn, |
| 2345 (png_structrp png_ptr, | |
| 2346 png_voidp progressive_ptr, | |
| 2347 png_progressive_info_ptr info_fn, | |
| 2348 png_progressive_row_ptr row_fn, | |
| 2349 png_progressive_end_ptr end_fn)); | |
| 2139 | 2350 |
| 2140 /* Returns the user pointer associated with the push read functions */ | 2351 /* Returns the user pointer associated with the push read functions */ |
| 2141 PNG_EXPORT(91, png_voidp, png_get_progressive_ptr, | 2352 PNG_EXPORT(91, |
| 2142 (png_const_structrp png_ptr)); | 2353 png_voidp, |
| 2354 png_get_progressive_ptr, | |
| 2355 (png_const_structrp png_ptr)); | |
| 2143 | 2356 |
| 2144 /* Function to be called when data becomes available */ | 2357 /* Function to be called when data becomes available */ |
| 2145 PNG_EXPORT(92, void, png_process_data, (png_structrp png_ptr, | 2358 PNG_EXPORT(92, |
| 2146 png_inforp info_ptr, png_bytep buffer, png_size_t buffer_size)); | 2359 void, |
| 2360 png_process_data, | |
| 2361 (png_structrp png_ptr, | |
| 2362 png_inforp info_ptr, | |
| 2363 png_bytep buffer, | |
| 2364 png_size_t buffer_size)); | |
| 2147 | 2365 |
| 2148 /* A function which may be called *only* within png_process_data to stop the | 2366 /* A function which may be called *only* within png_process_data to stop the |
| 2149 * processing of any more data. The function returns the number of bytes | 2367 * processing of any more data. The function returns the number of bytes |
| 2150 * remaining, excluding any that libpng has cached internally. A subsequent | 2368 * remaining, excluding any that libpng has cached internally. A subsequent |
| 2151 * call to png_process_data must supply these bytes again. If the argument | 2369 * call to png_process_data must supply these bytes again. If the argument |
| 2152 * 'save' is set to true the routine will first save all the pending data and | 2370 * 'save' is set to true the routine will first save all the pending data and |
| 2153 * will always return 0. | 2371 * will always return 0. |
| 2154 */ | 2372 */ |
| 2155 PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save)); | 2373 PNG_EXPORT(219, png_size_t, png_process_data_pause, (png_structrp, int save)); |
| 2156 | 2374 |
| 2157 /* A function which may be called *only* outside (after) a call to | 2375 /* A function which may be called *only* outside (after) a call to |
| 2158 * png_process_data. It returns the number of bytes of data to skip in the | 2376 * png_process_data. It returns the number of bytes of data to skip in the |
| 2159 * input. Normally it will return 0, but if it returns a non-zero value the | 2377 * input. Normally it will return 0, but if it returns a non-zero value the |
| 2160 * application must skip than number of bytes of input data and pass the | 2378 * application must skip than number of bytes of input data and pass the |
| 2161 * following data to the next call to png_process_data. | 2379 * following data to the next call to png_process_data. |
| 2162 */ | 2380 */ |
| 2163 PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp)); | 2381 PNG_EXPORT(220, png_uint_32, png_process_data_skip, (png_structrp)); |
| 2164 | 2382 |
| 2165 #ifdef PNG_READ_INTERLACING_SUPPORTED | 2383 #ifdef PNG_READ_INTERLACING_SUPPORTED |
| 2166 /* Function that combines rows. 'new_row' is a flag that should come from | 2384 /* Function that combines rows. 'new_row' is a flag that should come from |
| 2167 * the callback and be non-NULL if anything needs to be done; the library | 2385 * the callback and be non-NULL if anything needs to be done; the library |
| 2168 * stores its own version of the new data internally and ignores the passed | 2386 * stores its own version of the new data internally and ignores the passed |
| 2169 * in value. | 2387 * in value. |
| 2170 */ | 2388 */ |
| 2171 PNG_EXPORT(93, void, png_progressive_combine_row, (png_const_structrp png_ptr, | 2389 PNG_EXPORT(93, |
| 2172 png_bytep old_row, png_const_bytep new_row)); | 2390 void, |
| 2391 png_progressive_combine_row, | |
| 2392 (png_const_structrp png_ptr, | |
| 2393 png_bytep old_row, | |
| 2394 png_const_bytep new_row)); | |
| 2173 #endif /* PNG_READ_INTERLACING_SUPPORTED */ | 2395 #endif /* PNG_READ_INTERLACING_SUPPORTED */ |
| 2174 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ | 2396 #endif /* PNG_PROGRESSIVE_READ_SUPPORTED */ |
| 2175 | 2397 |
| 2176 PNG_EXPORTA(94, png_voidp, png_malloc, (png_const_structrp png_ptr, | 2398 PNG_EXPORTA(94, |
| 2177 png_alloc_size_t size), PNG_ALLOCATED); | 2399 png_voidp, |
| 2400 png_malloc, | |
| 2401 (png_const_structrp png_ptr, png_alloc_size_t size), | |
| 2402 PNG_ALLOCATED); | |
| 2178 /* Added at libpng version 1.4.0 */ | 2403 /* Added at libpng version 1.4.0 */ |
| 2179 PNG_EXPORTA(95, png_voidp, png_calloc, (png_const_structrp png_ptr, | 2404 PNG_EXPORTA(95, |
| 2180 png_alloc_size_t size), PNG_ALLOCATED); | 2405 png_voidp, |
| 2406 png_calloc, | |
| 2407 (png_const_structrp png_ptr, png_alloc_size_t size), | |
| 2408 PNG_ALLOCATED); | |
| 2181 | 2409 |
| 2182 /* Added at libpng version 1.2.4 */ | 2410 /* Added at libpng version 1.2.4 */ |
| 2183 PNG_EXPORTA(96, png_voidp, png_malloc_warn, (png_const_structrp png_ptr, | 2411 PNG_EXPORTA(96, |
| 2184 png_alloc_size_t size), PNG_ALLOCATED); | 2412 png_voidp, |
| 2413 png_malloc_warn, | |
| 2414 (png_const_structrp png_ptr, png_alloc_size_t size), | |
| 2415 PNG_ALLOCATED); | |
| 2185 | 2416 |
| 2186 /* Frees a pointer allocated by png_malloc() */ | 2417 /* Frees a pointer allocated by png_malloc() */ |
| 2187 PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr)); | 2418 PNG_EXPORT(97, void, png_free, (png_const_structrp png_ptr, png_voidp ptr)); |
| 2188 | 2419 |
| 2189 /* Free data that was allocated internally */ | 2420 /* Free data that was allocated internally */ |
| 2190 PNG_EXPORT(98, void, png_free_data, (png_const_structrp png_ptr, | 2421 PNG_EXPORT(98, |
| 2191 png_inforp info_ptr, png_uint_32 free_me, int num)); | 2422 void, |
| 2423 png_free_data, | |
| 2424 (png_const_structrp png_ptr, | |
| 2425 png_inforp info_ptr, | |
| 2426 png_uint_32 free_me, | |
| 2427 int num)); | |
| 2192 | 2428 |
| 2193 /* Reassign responsibility for freeing existing data, whether allocated | 2429 /* Reassign responsibility for freeing existing data, whether allocated |
| 2194 * by libpng or by the application; this works on the png_info structure passed | 2430 * by libpng or by the application; this works on the png_info structure passed |
| 2195 * in, it does not change the state for other png_info structures. | 2431 * in, it does not change the state for other png_info structures. |
| 2196 * | 2432 * |
| 2197 * It is unlikely that this function works correctly as of 1.6.0 and using it | 2433 * It is unlikely that this function works correctly as of 1.6.0 and using it |
| 2198 * may result either in memory leaks or double free of allocated data. | 2434 * may result either in memory leaks or double free of allocated data. |
| 2199 */ | 2435 */ |
| 2200 PNG_EXPORTA(99, void, png_data_freer, (png_const_structrp png_ptr, | 2436 PNG_EXPORTA(99, |
| 2201 png_inforp info_ptr, int freer, png_uint_32 mask), PNG_DEPRECATED); | 2437 void, |
| 2438 png_data_freer, | |
| 2439 (png_const_structrp png_ptr, | |
| 2440 png_inforp info_ptr, | |
| 2441 int freer, | |
| 2442 png_uint_32 mask), | |
| 2443 PNG_DEPRECATED); | |
| 2202 | 2444 |
| 2203 /* Assignments for png_data_freer */ | 2445 /* Assignments for png_data_freer */ |
| 2204 #define PNG_DESTROY_WILL_FREE_DATA 1 | 2446 #define PNG_DESTROY_WILL_FREE_DATA 1 |
| 2205 #define PNG_SET_WILL_FREE_DATA 1 | 2447 #define PNG_SET_WILL_FREE_DATA 1 |
| 2206 #define PNG_USER_WILL_FREE_DATA 2 | 2448 #define PNG_USER_WILL_FREE_DATA 2 |
| 2207 /* Flags for png_ptr->free_me and info_ptr->free_me */ | 2449 /* Flags for png_ptr->free_me and info_ptr->free_me */ |
| 2208 #define PNG_FREE_HIST 0x0008 | 2450 #define PNG_FREE_HIST 0x0008 |
| 2209 #define PNG_FREE_ICCP 0x0010 | 2451 #define PNG_FREE_ICCP 0x0010 |
| 2210 #define PNG_FREE_SPLT 0x0020 | 2452 #define PNG_FREE_SPLT 0x0020 |
| 2211 #define PNG_FREE_ROWS 0x0040 | 2453 #define PNG_FREE_ROWS 0x0040 |
| 2212 #define PNG_FREE_PCAL 0x0080 | 2454 #define PNG_FREE_PCAL 0x0080 |
| 2213 #define PNG_FREE_SCAL 0x0100 | 2455 #define PNG_FREE_SCAL 0x0100 |
| 2214 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED | 2456 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED |
| 2215 # define PNG_FREE_UNKN 0x0200 | 2457 #define PNG_FREE_UNKN 0x0200 |
| 2216 #endif | 2458 #endif |
| 2217 /* PNG_FREE_LIST 0x0400 removed in 1.6.0 because it is ignored */ | 2459 /* PNG_FREE_LIST 0x0400 removed in 1.6.0 because it is ignored */ |
| 2218 #define PNG_FREE_PLTE 0x1000 | 2460 #define PNG_FREE_PLTE 0x1000 |
| 2219 #define PNG_FREE_TRNS 0x2000 | 2461 #define PNG_FREE_TRNS 0x2000 |
| 2220 #define PNG_FREE_TEXT 0x4000 | 2462 #define PNG_FREE_TEXT 0x4000 |
| 2221 #define PNG_FREE_ALL 0x7fff | 2463 #define PNG_FREE_ALL 0x7fff |
| 2222 #define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ | 2464 #define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ |
| 2223 | 2465 |
| 2224 #ifdef PNG_USER_MEM_SUPPORTED | 2466 #ifdef PNG_USER_MEM_SUPPORTED |
| 2225 PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr, | 2467 PNG_EXPORTA(100, |
| 2226 png_alloc_size_t size), PNG_ALLOCATED PNG_DEPRECATED); | 2468 png_voidp, |
| 2227 PNG_EXPORTA(101, void, png_free_default, (png_const_structrp png_ptr, | 2469 png_malloc_default, |
| 2228 png_voidp ptr), PNG_DEPRECATED); | 2470 (png_const_structrp png_ptr, png_alloc_size_t size), |
| 2471 PNG_ALLOCATED PNG_DEPRECATED); | |
| 2472 PNG_EXPORTA(101, | |
| 2473 void, | |
| 2474 png_free_default, | |
| 2475 (png_const_structrp png_ptr, png_voidp ptr), | |
| 2476 PNG_DEPRECATED); | |
| 2229 #endif | 2477 #endif |
| 2230 | 2478 |
| 2231 #ifdef PNG_ERROR_TEXT_SUPPORTED | 2479 #ifdef PNG_ERROR_TEXT_SUPPORTED |
| 2232 /* Fatal error in PNG image of libpng - can't continue */ | 2480 /* Fatal error in PNG image of libpng - can't continue */ |
| 2233 PNG_EXPORTA(102, void, png_error, (png_const_structrp png_ptr, | 2481 PNG_EXPORTA(102, |
| 2234 png_const_charp error_message), PNG_NORETURN); | 2482 void, |
| 2483 png_error, | |
| 2484 (png_const_structrp png_ptr, png_const_charp error_message), | |
| 2485 PNG_NORETURN); | |
| 2235 | 2486 |
| 2236 /* The same, but the chunk name is prepended to the error string. */ | 2487 /* The same, but the chunk name is prepended to the error string. */ |
| 2237 PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr, | 2488 PNG_EXPORTA(103, |
| 2238 png_const_charp error_message), PNG_NORETURN); | 2489 void, |
| 2490 png_chunk_error, | |
| 2491 (png_const_structrp png_ptr, png_const_charp error_message), | |
| 2492 PNG_NORETURN); | |
| 2239 | 2493 |
| 2240 #else | 2494 #else |
| 2241 /* Fatal error in PNG image of libpng - can't continue */ | 2495 /* Fatal error in PNG image of libpng - can't continue */ |
| 2242 PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN); | 2496 PNG_EXPORTA(104, void, png_err, (png_const_structrp png_ptr), PNG_NORETURN); |
| 2243 #endif | 2497 #endif |
| 2244 | 2498 |
| 2245 #ifdef PNG_WARNINGS_SUPPORTED | 2499 #ifdef PNG_WARNINGS_SUPPORTED |
| 2246 /* Non-fatal error in libpng. Can continue, but may have a problem. */ | 2500 /* Non-fatal error in libpng. Can continue, but may have a problem. */ |
| 2247 PNG_EXPORT(105, void, png_warning, (png_const_structrp png_ptr, | 2501 PNG_EXPORT(105, |
| 2248 png_const_charp warning_message)); | 2502 void, |
| 2503 png_warning, | |
| 2504 (png_const_structrp png_ptr, png_const_charp warning_message)); | |
| 2249 | 2505 |
| 2250 /* Non-fatal error in libpng, chunk name is prepended to message. */ | 2506 /* Non-fatal error in libpng, chunk name is prepended to message. */ |
| 2251 PNG_EXPORT(106, void, png_chunk_warning, (png_const_structrp png_ptr, | 2507 PNG_EXPORT(106, |
| 2252 png_const_charp warning_message)); | 2508 void, |
| 2509 png_chunk_warning, | |
| 2510 (png_const_structrp png_ptr, png_const_charp warning_message)); | |
| 2253 #endif | 2511 #endif |
| 2254 | 2512 |
| 2255 #ifdef PNG_BENIGN_ERRORS_SUPPORTED | 2513 #ifdef PNG_BENIGN_ERRORS_SUPPORTED |
| 2256 /* Benign error in libpng. Can continue, but may have a problem. | 2514 /* Benign error in libpng. Can continue, but may have a problem. |
| 2257 * User can choose whether to handle as a fatal error or as a warning. */ | 2515 * User can choose whether to handle as a fatal error or as a warning. */ |
| 2258 PNG_EXPORT(107, void, png_benign_error, (png_const_structrp png_ptr, | 2516 PNG_EXPORT(107, |
| 2259 png_const_charp warning_message)); | 2517 void, |
| 2518 png_benign_error, | |
| 2519 (png_const_structrp png_ptr, png_const_charp warning_message)); | |
| 2260 | 2520 |
| 2261 #ifdef PNG_READ_SUPPORTED | 2521 #ifdef PNG_READ_SUPPORTED |
| 2262 /* Same, chunk name is prepended to message (only during read) */ | 2522 /* Same, chunk name is prepended to message (only during read) */ |
| 2263 PNG_EXPORT(108, void, png_chunk_benign_error, (png_const_structrp png_ptr, | 2523 PNG_EXPORT(108, |
| 2264 png_const_charp warning_message)); | 2524 void, |
| 2525 png_chunk_benign_error, | |
| 2526 (png_const_structrp png_ptr, png_const_charp warning_message)); | |
| 2265 #endif | 2527 #endif |
| 2266 | 2528 |
| 2267 PNG_EXPORT(109, void, png_set_benign_errors, | 2529 PNG_EXPORT(109, |
| 2268 (png_structrp png_ptr, int allowed)); | 2530 void, |
| 2531 png_set_benign_errors, | |
| 2532 (png_structrp png_ptr, int allowed)); | |
| 2269 #else | 2533 #else |
| 2270 # ifdef PNG_ALLOW_BENIGN_ERRORS | 2534 #ifdef PNG_ALLOW_BENIGN_ERRORS |
| 2271 # define png_benign_error png_warning | 2535 #define png_benign_error png_warning |
| 2272 # define png_chunk_benign_error png_chunk_warning | 2536 #define png_chunk_benign_error png_chunk_warning |
| 2273 # else | 2537 #else |
| 2274 # define png_benign_error png_error | 2538 #define png_benign_error png_error |
| 2275 # define png_chunk_benign_error png_chunk_error | 2539 #define png_chunk_benign_error png_chunk_error |
| 2276 # endif | 2540 #endif |
| 2277 #endif | 2541 #endif |
| 2278 | 2542 |
| 2279 /* The png_set_<chunk> functions are for storing values in the png_info_struct. | 2543 /* The png_set_<chunk> functions are for storing values in the png_info_struct. |
| 2280 * Similarly, the png_get_<chunk> calls are used to read values from the | 2544 * Similarly, the png_get_<chunk> calls are used to read values from the |
| 2281 * png_info_struct, either storing the parameters in the passed variables, or | 2545 * png_info_struct, either storing the parameters in the passed variables, or |
| 2282 * setting pointers into the png_info_struct where the data is stored. The | 2546 * setting pointers into the png_info_struct where the data is stored. The |
| 2283 * png_get_<chunk> functions return a non-zero value if the data was available | 2547 * png_get_<chunk> functions return a non-zero value if the data was available |
| 2284 * in info_ptr, or return zero and do not change any of the parameters if the | 2548 * in info_ptr, or return zero and do not change any of the parameters if the |
| 2285 * data was not available. | 2549 * data was not available. |
| 2286 * | 2550 * |
| 2287 * These functions should be used instead of directly accessing png_info | 2551 * These functions should be used instead of directly accessing png_info |
| 2288 * to avoid problems with future changes in the size and internal layout of | 2552 * to avoid problems with future changes in the size and internal layout of |
| 2289 * png_info_struct. | 2553 * png_info_struct. |
| 2290 */ | 2554 */ |
| 2291 /* Returns "flag" if chunk data is valid in info_ptr. */ | 2555 /* Returns "flag" if chunk data is valid in info_ptr. */ |
| 2292 PNG_EXPORT(110, png_uint_32, png_get_valid, (png_const_structrp png_ptr, | 2556 PNG_EXPORT(110, |
| 2293 png_const_inforp info_ptr, png_uint_32 flag)); | 2557 png_uint_32, |
| 2558 png_get_valid, | |
| 2559 (png_const_structrp png_ptr, | |
| 2560 png_const_inforp info_ptr, | |
| 2561 png_uint_32 flag)); | |
| 2294 | 2562 |
| 2295 /* Returns number of bytes needed to hold a transformed row. */ | 2563 /* Returns number of bytes needed to hold a transformed row. */ |
| 2296 PNG_EXPORT(111, png_size_t, png_get_rowbytes, (png_const_structrp png_ptr, | 2564 PNG_EXPORT(111, |
| 2297 png_const_inforp info_ptr)); | 2565 png_size_t, |
| 2566 png_get_rowbytes, | |
| 2567 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2298 | 2568 |
| 2299 #ifdef PNG_INFO_IMAGE_SUPPORTED | 2569 #ifdef PNG_INFO_IMAGE_SUPPORTED |
| 2300 /* Returns row_pointers, which is an array of pointers to scanlines that was | 2570 /* Returns row_pointers, which is an array of pointers to scanlines that was |
| 2301 * returned from png_read_png(). | 2571 * returned from png_read_png(). |
| 2302 */ | 2572 */ |
| 2303 PNG_EXPORT(112, png_bytepp, png_get_rows, (png_const_structrp png_ptr, | 2573 PNG_EXPORT(112, |
| 2304 png_const_inforp info_ptr)); | 2574 png_bytepp, |
| 2575 png_get_rows, | |
| 2576 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2305 | 2577 |
| 2306 /* Set row_pointers, which is an array of pointers to scanlines for use | 2578 /* Set row_pointers, which is an array of pointers to scanlines for use |
| 2307 * by png_write_png(). | 2579 * by png_write_png(). |
| 2308 */ | 2580 */ |
| 2309 PNG_EXPORT(113, void, png_set_rows, (png_const_structrp png_ptr, | 2581 PNG_EXPORT(113, |
| 2310 png_inforp info_ptr, png_bytepp row_pointers)); | 2582 void, |
| 2583 png_set_rows, | |
| 2584 (png_const_structrp png_ptr, | |
| 2585 png_inforp info_ptr, | |
| 2586 png_bytepp row_pointers)); | |
| 2311 #endif | 2587 #endif |
| 2312 | 2588 |
| 2313 /* Returns number of color channels in image. */ | 2589 /* Returns number of color channels in image. */ |
| 2314 PNG_EXPORT(114, png_byte, png_get_channels, (png_const_structrp png_ptr, | 2590 PNG_EXPORT(114, |
| 2315 png_const_inforp info_ptr)); | 2591 png_byte, |
| 2592 png_get_channels, | |
| 2593 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2316 | 2594 |
| 2317 #ifdef PNG_EASY_ACCESS_SUPPORTED | 2595 #ifdef PNG_EASY_ACCESS_SUPPORTED |
| 2318 /* Returns image width in pixels. */ | 2596 /* Returns image width in pixels. */ |
| 2319 PNG_EXPORT(115, png_uint_32, png_get_image_width, (png_const_structrp png_ptr, | 2597 PNG_EXPORT(115, |
| 2320 png_const_inforp info_ptr)); | 2598 png_uint_32, |
| 2599 png_get_image_width, | |
| 2600 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2321 | 2601 |
| 2322 /* Returns image height in pixels. */ | 2602 /* Returns image height in pixels. */ |
| 2323 PNG_EXPORT(116, png_uint_32, png_get_image_height, (png_const_structrp png_ptr, | 2603 PNG_EXPORT(116, |
| 2324 png_const_inforp info_ptr)); | 2604 png_uint_32, |
| 2605 png_get_image_height, | |
| 2606 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2325 | 2607 |
| 2326 /* Returns image bit_depth. */ | 2608 /* Returns image bit_depth. */ |
| 2327 PNG_EXPORT(117, png_byte, png_get_bit_depth, (png_const_structrp png_ptr, | 2609 PNG_EXPORT(117, |
| 2328 png_const_inforp info_ptr)); | 2610 png_byte, |
| 2611 png_get_bit_depth, | |
| 2612 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2329 | 2613 |
| 2330 /* Returns image color_type. */ | 2614 /* Returns image color_type. */ |
| 2331 PNG_EXPORT(118, png_byte, png_get_color_type, (png_const_structrp png_ptr, | 2615 PNG_EXPORT(118, |
| 2332 png_const_inforp info_ptr)); | 2616 png_byte, |
| 2617 png_get_color_type, | |
| 2618 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2333 | 2619 |
| 2334 /* Returns image filter_type. */ | 2620 /* Returns image filter_type. */ |
| 2335 PNG_EXPORT(119, png_byte, png_get_filter_type, (png_const_structrp png_ptr, | 2621 PNG_EXPORT(119, |
| 2336 png_const_inforp info_ptr)); | 2622 png_byte, |
| 2623 png_get_filter_type, | |
| 2624 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2337 | 2625 |
| 2338 /* Returns image interlace_type. */ | 2626 /* Returns image interlace_type. */ |
| 2339 PNG_EXPORT(120, png_byte, png_get_interlace_type, (png_const_structrp png_ptr, | 2627 PNG_EXPORT(120, |
| 2340 png_const_inforp info_ptr)); | 2628 png_byte, |
| 2629 png_get_interlace_type, | |
| 2630 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2341 | 2631 |
| 2342 /* Returns image compression_type. */ | 2632 /* Returns image compression_type. */ |
| 2343 PNG_EXPORT(121, png_byte, png_get_compression_type, (png_const_structrp png_ptr, | 2633 PNG_EXPORT(121, |
| 2344 png_const_inforp info_ptr)); | 2634 png_byte, |
| 2635 png_get_compression_type, | |
| 2636 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2345 | 2637 |
| 2346 /* Returns image resolution in pixels per meter, from pHYs chunk data. */ | 2638 /* Returns image resolution in pixels per meter, from pHYs chunk data. */ |
| 2347 PNG_EXPORT(122, png_uint_32, png_get_pixels_per_meter, | 2639 PNG_EXPORT(122, |
| 2348 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 2640 png_uint_32, |
| 2349 PNG_EXPORT(123, png_uint_32, png_get_x_pixels_per_meter, | 2641 png_get_pixels_per_meter, |
| 2350 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 2642 (png_const_structrp png_ptr, png_const_inforp info_ptr)); |
| 2351 PNG_EXPORT(124, png_uint_32, png_get_y_pixels_per_meter, | 2643 PNG_EXPORT(123, |
| 2352 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 2644 png_uint_32, |
| 2645 png_get_x_pixels_per_meter, | |
| 2646 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2647 PNG_EXPORT(124, | |
| 2648 png_uint_32, | |
| 2649 png_get_y_pixels_per_meter, | |
| 2650 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2353 | 2651 |
| 2354 /* Returns pixel aspect ratio, computed from pHYs chunk data. */ | 2652 /* Returns pixel aspect ratio, computed from pHYs chunk data. */ |
| 2355 PNG_FP_EXPORT(125, float, png_get_pixel_aspect_ratio, | 2653 PNG_FP_EXPORT(125, |
| 2356 (png_const_structrp png_ptr, png_const_inforp info_ptr)) | 2654 float, |
| 2357 PNG_FIXED_EXPORT(210, png_fixed_point, png_get_pixel_aspect_ratio_fixed, | 2655 png_get_pixel_aspect_ratio, |
| 2358 (png_const_structrp png_ptr, png_const_inforp info_ptr)) | 2656 (png_const_structrp png_ptr, png_const_inforp info_ptr)) |
| 2657 PNG_FIXED_EXPORT(210, | |
| 2658 png_fixed_point, | |
| 2659 png_get_pixel_aspect_ratio_fixed, | |
| 2660 (png_const_structrp png_ptr, png_const_inforp info_ptr)) | |
| 2359 | 2661 |
| 2360 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ | 2662 /* Returns image x, y offset in pixels or microns, from oFFs chunk data. */ |
| 2361 PNG_EXPORT(126, png_int_32, png_get_x_offset_pixels, | 2663 PNG_EXPORT(126, |
| 2362 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 2664 png_int_32, |
| 2363 PNG_EXPORT(127, png_int_32, png_get_y_offset_pixels, | 2665 png_get_x_offset_pixels, |
| 2364 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 2666 (png_const_structrp png_ptr, png_const_inforp info_ptr)); |
| 2365 PNG_EXPORT(128, png_int_32, png_get_x_offset_microns, | 2667 PNG_EXPORT(127, |
| 2366 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 2668 png_int_32, |
| 2367 PNG_EXPORT(129, png_int_32, png_get_y_offset_microns, | 2669 png_get_y_offset_pixels, |
| 2368 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 2670 (png_const_structrp png_ptr, png_const_inforp info_ptr)); |
| 2671 PNG_EXPORT(128, | |
| 2672 png_int_32, | |
| 2673 png_get_x_offset_microns, | |
| 2674 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2675 PNG_EXPORT(129, | |
| 2676 png_int_32, | |
| 2677 png_get_y_offset_microns, | |
| 2678 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2369 | 2679 |
| 2370 #endif /* PNG_EASY_ACCESS_SUPPORTED */ | 2680 #endif /* PNG_EASY_ACCESS_SUPPORTED */ |
| 2371 | 2681 |
| 2372 #ifdef PNG_READ_SUPPORTED | 2682 #ifdef PNG_READ_SUPPORTED |
| 2373 /* Returns pointer to signature string read from PNG header */ | 2683 /* Returns pointer to signature string read from PNG header */ |
| 2374 PNG_EXPORT(130, png_const_bytep, png_get_signature, (png_const_structrp png_ptr, | 2684 PNG_EXPORT(130, |
| 2375 png_const_inforp info_ptr)); | 2685 png_const_bytep, |
| 2686 png_get_signature, | |
| 2687 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 2376 #endif | 2688 #endif |
| 2377 | 2689 |
| 2378 #ifdef PNG_bKGD_SUPPORTED | 2690 #ifdef PNG_bKGD_SUPPORTED |
| 2379 PNG_EXPORT(131, png_uint_32, png_get_bKGD, (png_const_structrp png_ptr, | 2691 PNG_EXPORT(131, |
| 2380 png_inforp info_ptr, png_color_16p *background)); | 2692 png_uint_32, |
| 2693 png_get_bKGD, | |
| 2694 (png_const_structrp png_ptr, | |
| 2695 png_inforp info_ptr, | |
| 2696 png_color_16p* background)); | |
| 2381 #endif | 2697 #endif |
| 2382 | 2698 |
| 2383 #ifdef PNG_bKGD_SUPPORTED | 2699 #ifdef PNG_bKGD_SUPPORTED |
| 2384 PNG_EXPORT(132, void, png_set_bKGD, (png_const_structrp png_ptr, | 2700 PNG_EXPORT(132, |
| 2385 png_inforp info_ptr, png_const_color_16p background)); | 2701 void, |
| 2702 png_set_bKGD, | |
| 2703 (png_const_structrp png_ptr, | |
| 2704 png_inforp info_ptr, | |
| 2705 png_const_color_16p background)); | |
| 2386 #endif | 2706 #endif |
| 2387 | 2707 |
| 2388 #ifdef PNG_cHRM_SUPPORTED | 2708 #ifdef PNG_cHRM_SUPPORTED |
| 2389 PNG_FP_EXPORT(133, png_uint_32, png_get_cHRM, (png_const_structrp png_ptr, | 2709 PNG_FP_EXPORT(133, |
| 2390 png_const_inforp info_ptr, double *white_x, double *white_y, double *red_x, | 2710 png_uint_32, |
| 2391 double *red_y, double *green_x, double *green_y, double *blue_x, | 2711 png_get_cHRM, |
| 2392 double *blue_y)) | 2712 (png_const_structrp png_ptr, |
| 2393 PNG_FP_EXPORT(230, png_uint_32, png_get_cHRM_XYZ, (png_const_structrp png_ptr, | 2713 png_const_inforp info_ptr, |
| 2394 png_const_inforp info_ptr, double *red_X, double *red_Y, double *red_Z, | 2714 double* white_x, |
| 2395 double *green_X, double *green_Y, double *green_Z, double *blue_X, | 2715 double* white_y, |
| 2396 double *blue_Y, double *blue_Z)) | 2716 double* red_x, |
| 2397 PNG_FIXED_EXPORT(134, png_uint_32, png_get_cHRM_fixed, | 2717 double* red_y, |
| 2398 (png_const_structrp png_ptr, png_const_inforp info_ptr, | 2718 double* green_x, |
| 2399 png_fixed_point *int_white_x, png_fixed_point *int_white_y, | 2719 double* green_y, |
| 2400 png_fixed_point *int_red_x, png_fixed_point *int_red_y, | 2720 double* blue_x, |
| 2401 png_fixed_point *int_green_x, png_fixed_point *int_green_y, | 2721 double* blue_y)) |
| 2402 png_fixed_point *int_blue_x, png_fixed_point *int_blue_y)) | 2722 PNG_FP_EXPORT(230, |
| 2403 PNG_FIXED_EXPORT(231, png_uint_32, png_get_cHRM_XYZ_fixed, | 2723 png_uint_32, |
| 2404 (png_const_structrp png_ptr, png_const_inforp info_ptr, | 2724 png_get_cHRM_XYZ, |
| 2405 png_fixed_point *int_red_X, png_fixed_point *int_red_Y, | 2725 (png_const_structrp png_ptr, |
| 2406 png_fixed_point *int_red_Z, png_fixed_point *int_green_X, | 2726 png_const_inforp info_ptr, |
| 2407 png_fixed_point *int_green_Y, png_fixed_point *int_green_Z, | 2727 double* red_X, |
| 2408 png_fixed_point *int_blue_X, png_fixed_point *int_blue_Y, | 2728 double* red_Y, |
| 2409 png_fixed_point *int_blue_Z)) | 2729 double* red_Z, |
| 2730 double* green_X, | |
| 2731 double* green_Y, | |
| 2732 double* green_Z, | |
| 2733 double* blue_X, | |
| 2734 double* blue_Y, | |
| 2735 double* blue_Z)) | |
| 2736 PNG_FIXED_EXPORT(134, | |
| 2737 png_uint_32, | |
| 2738 png_get_cHRM_fixed, | |
| 2739 (png_const_structrp png_ptr, | |
| 2740 png_const_inforp info_ptr, | |
| 2741 png_fixed_point* int_white_x, | |
| 2742 png_fixed_point* int_white_y, | |
| 2743 png_fixed_point* int_red_x, | |
| 2744 png_fixed_point* int_red_y, | |
| 2745 png_fixed_point* int_green_x, | |
| 2746 png_fixed_point* int_green_y, | |
| 2747 png_fixed_point* int_blue_x, | |
| 2748 png_fixed_point* int_blue_y)) | |
| 2749 PNG_FIXED_EXPORT(231, | |
| 2750 png_uint_32, | |
| 2751 png_get_cHRM_XYZ_fixed, | |
| 2752 (png_const_structrp png_ptr, | |
| 2753 png_const_inforp info_ptr, | |
| 2754 png_fixed_point* int_red_X, | |
| 2755 png_fixed_point* int_red_Y, | |
| 2756 png_fixed_point* int_red_Z, | |
| 2757 png_fixed_point* int_green_X, | |
| 2758 png_fixed_point* int_green_Y, | |
| 2759 png_fixed_point* int_green_Z, | |
| 2760 png_fixed_point* int_blue_X, | |
| 2761 png_fixed_point* int_blue_Y, | |
| 2762 png_fixed_point* int_blue_Z)) | |
| 2410 #endif | 2763 #endif |
| 2411 | 2764 |
| 2412 #ifdef PNG_cHRM_SUPPORTED | 2765 #ifdef PNG_cHRM_SUPPORTED |
| 2413 PNG_FP_EXPORT(135, void, png_set_cHRM, (png_const_structrp png_ptr, | 2766 PNG_FP_EXPORT(135, |
| 2414 png_inforp info_ptr, | 2767 void, |
| 2415 double white_x, double white_y, double red_x, double red_y, double green_x, | 2768 png_set_cHRM, |
| 2416 double green_y, double blue_x, double blue_y)) | 2769 (png_const_structrp png_ptr, |
| 2417 PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_const_structrp png_ptr, | 2770 png_inforp info_ptr, |
| 2418 png_inforp info_ptr, double red_X, double red_Y, double red_Z, | 2771 double white_x, |
| 2419 double green_X, double green_Y, double green_Z, double blue_X, | 2772 double white_y, |
| 2420 double blue_Y, double blue_Z)) | 2773 double red_x, |
| 2421 PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_const_structrp png_ptr, | 2774 double red_y, |
| 2422 png_inforp info_ptr, png_fixed_point int_white_x, | 2775 double green_x, |
| 2423 png_fixed_point int_white_y, png_fixed_point int_red_x, | 2776 double green_y, |
| 2424 png_fixed_point int_red_y, png_fixed_point int_green_x, | 2777 double blue_x, |
| 2425 png_fixed_point int_green_y, png_fixed_point int_blue_x, | 2778 double blue_y)) |
| 2426 png_fixed_point int_blue_y)) | 2779 PNG_FP_EXPORT(232, |
| 2427 PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr, | 2780 void, |
| 2428 png_inforp info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y, | 2781 png_set_cHRM_XYZ, |
| 2429 png_fixed_point int_red_Z, png_fixed_point int_green_X, | 2782 (png_const_structrp png_ptr, |
| 2430 png_fixed_point int_green_Y, png_fixed_point int_green_Z, | 2783 png_inforp info_ptr, |
| 2431 png_fixed_point int_blue_X, png_fixed_point int_blue_Y, | 2784 double red_X, |
| 2432 png_fixed_point int_blue_Z)) | 2785 double red_Y, |
| 2786 double red_Z, | |
| 2787 double green_X, | |
| 2788 double green_Y, | |
| 2789 double green_Z, | |
| 2790 double blue_X, | |
| 2791 double blue_Y, | |
| 2792 double blue_Z)) | |
| 2793 PNG_FIXED_EXPORT(136, | |
| 2794 void, | |
| 2795 png_set_cHRM_fixed, | |
| 2796 (png_const_structrp png_ptr, | |
| 2797 png_inforp info_ptr, | |
| 2798 png_fixed_point int_white_x, | |
| 2799 png_fixed_point int_white_y, | |
| 2800 png_fixed_point int_red_x, | |
| 2801 png_fixed_point int_red_y, | |
| 2802 png_fixed_point int_green_x, | |
| 2803 png_fixed_point int_green_y, | |
| 2804 png_fixed_point int_blue_x, | |
| 2805 png_fixed_point int_blue_y)) | |
| 2806 PNG_FIXED_EXPORT(233, | |
| 2807 void, | |
| 2808 png_set_cHRM_XYZ_fixed, | |
| 2809 (png_const_structrp png_ptr, | |
| 2810 png_inforp info_ptr, | |
| 2811 png_fixed_point int_red_X, | |
| 2812 png_fixed_point int_red_Y, | |
| 2813 png_fixed_point int_red_Z, | |
| 2814 png_fixed_point int_green_X, | |
| 2815 png_fixed_point int_green_Y, | |
| 2816 png_fixed_point int_green_Z, | |
| 2817 png_fixed_point int_blue_X, | |
| 2818 png_fixed_point int_blue_Y, | |
| 2819 png_fixed_point int_blue_Z)) | |
| 2433 #endif | 2820 #endif |
| 2434 | 2821 |
| 2435 #ifdef PNG_gAMA_SUPPORTED | 2822 #ifdef PNG_gAMA_SUPPORTED |
| 2436 PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr, | 2823 PNG_FP_EXPORT(137, |
| 2437 png_const_inforp info_ptr, double *file_gamma)) | 2824 png_uint_32, |
| 2438 PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed, | 2825 png_get_gAMA, |
| 2439 (png_const_structrp png_ptr, png_const_inforp info_ptr, | 2826 (png_const_structrp png_ptr, |
| 2440 png_fixed_point *int_file_gamma)) | 2827 png_const_inforp info_ptr, |
| 2828 double* file_gamma)) | |
| 2829 PNG_FIXED_EXPORT(138, | |
| 2830 png_uint_32, | |
| 2831 png_get_gAMA_fixed, | |
| 2832 (png_const_structrp png_ptr, | |
| 2833 png_const_inforp info_ptr, | |
| 2834 png_fixed_point* int_file_gamma)) | |
| 2441 #endif | 2835 #endif |
| 2442 | 2836 |
| 2443 #ifdef PNG_gAMA_SUPPORTED | 2837 #ifdef PNG_gAMA_SUPPORTED |
| 2444 PNG_FP_EXPORT(139, void, png_set_gAMA, (png_const_structrp png_ptr, | 2838 PNG_FP_EXPORT(139, |
| 2445 png_inforp info_ptr, double file_gamma)) | 2839 void, |
| 2446 PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr, | 2840 png_set_gAMA, |
| 2447 png_inforp info_ptr, png_fixed_point int_file_gamma)) | 2841 (png_const_structrp png_ptr, |
| 2842 png_inforp info_ptr, | |
| 2843 double file_gamma)) | |
| 2844 PNG_FIXED_EXPORT(140, | |
| 2845 void, | |
| 2846 png_set_gAMA_fixed, | |
| 2847 (png_const_structrp png_ptr, | |
| 2848 png_inforp info_ptr, | |
| 2849 png_fixed_point int_file_gamma)) | |
| 2448 #endif | 2850 #endif |
| 2449 | 2851 |
| 2450 #ifdef PNG_hIST_SUPPORTED | 2852 #ifdef PNG_hIST_SUPPORTED |
| 2451 PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr, | 2853 PNG_EXPORT(141, |
| 2452 png_inforp info_ptr, png_uint_16p *hist)); | 2854 png_uint_32, |
| 2855 png_get_hIST, | |
| 2856 (png_const_structrp png_ptr, | |
| 2857 png_inforp info_ptr, | |
| 2858 png_uint_16p* hist)); | |
| 2453 #endif | 2859 #endif |
| 2454 | 2860 |
| 2455 #ifdef PNG_hIST_SUPPORTED | 2861 #ifdef PNG_hIST_SUPPORTED |
| 2456 PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr, | 2862 PNG_EXPORT(142, |
| 2457 png_inforp info_ptr, png_const_uint_16p hist)); | 2863 void, |
| 2458 #endif | 2864 png_set_hIST, |
| 2459 | 2865 (png_const_structrp png_ptr, |
| 2460 PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_const_structrp png_ptr, | 2866 png_inforp info_ptr, |
| 2461 png_const_inforp info_ptr, png_uint_32 *width, png_uint_32 *height, | 2867 png_const_uint_16p hist)); |
| 2462 int *bit_depth, int *color_type, int *interlace_method, | 2868 #endif |
| 2463 int *compression_method, int *filter_method)); | 2869 |
| 2464 | 2870 PNG_EXPORT(143, |
| 2465 PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr, | 2871 png_uint_32, |
| 2466 png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth, | 2872 png_get_IHDR, |
| 2467 int color_type, int interlace_method, int compression_method, | 2873 (png_const_structrp png_ptr, |
| 2468 int filter_method)); | 2874 png_const_inforp info_ptr, |
| 2875 png_uint_32* width, | |
| 2876 png_uint_32* height, | |
| 2877 int* bit_depth, | |
| 2878 int* color_type, | |
| 2879 int* interlace_method, | |
| 2880 int* compression_method, | |
| 2881 int* filter_method)); | |
| 2882 | |
| 2883 PNG_EXPORT(144, | |
| 2884 void, | |
| 2885 png_set_IHDR, | |
| 2886 (png_const_structrp png_ptr, | |
| 2887 png_inforp info_ptr, | |
| 2888 png_uint_32 width, | |
| 2889 png_uint_32 height, | |
| 2890 int bit_depth, | |
| 2891 int color_type, | |
| 2892 int interlace_method, | |
| 2893 int compression_method, | |
| 2894 int filter_method)); | |
| 2469 | 2895 |
| 2470 #ifdef PNG_oFFs_SUPPORTED | 2896 #ifdef PNG_oFFs_SUPPORTED |
| 2471 PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr, | 2897 PNG_EXPORT(145, |
| 2472 png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y, | 2898 png_uint_32, |
| 2473 int *unit_type)); | 2899 png_get_oFFs, |
| 2900 (png_const_structrp png_ptr, | |
| 2901 png_const_inforp info_ptr, | |
| 2902 png_int_32* offset_x, | |
| 2903 png_int_32* offset_y, | |
| 2904 int* unit_type)); | |
| 2474 #endif | 2905 #endif |
| 2475 | 2906 |
| 2476 #ifdef PNG_oFFs_SUPPORTED | 2907 #ifdef PNG_oFFs_SUPPORTED |
| 2477 PNG_EXPORT(146, void, png_set_oFFs, (png_const_structrp png_ptr, | 2908 PNG_EXPORT(146, |
| 2478 png_inforp info_ptr, png_int_32 offset_x, png_int_32 offset_y, | 2909 void, |
| 2479 int unit_type)); | 2910 png_set_oFFs, |
| 2911 (png_const_structrp png_ptr, | |
| 2912 png_inforp info_ptr, | |
| 2913 png_int_32 offset_x, | |
| 2914 png_int_32 offset_y, | |
| 2915 int unit_type)); | |
| 2480 #endif | 2916 #endif |
| 2481 | 2917 |
| 2482 #ifdef PNG_pCAL_SUPPORTED | 2918 #ifdef PNG_pCAL_SUPPORTED |
| 2483 PNG_EXPORT(147, png_uint_32, png_get_pCAL, (png_const_structrp png_ptr, | 2919 PNG_EXPORT(147, |
| 2484 png_inforp info_ptr, png_charp *purpose, png_int_32 *X0, | 2920 png_uint_32, |
| 2485 png_int_32 *X1, int *type, int *nparams, png_charp *units, | 2921 png_get_pCAL, |
| 2486 png_charpp *params)); | 2922 (png_const_structrp png_ptr, |
| 2923 png_inforp info_ptr, | |
| 2924 png_charp* purpose, | |
| 2925 png_int_32* X0, | |
| 2926 png_int_32* X1, | |
| 2927 int* type, | |
| 2928 int* nparams, | |
| 2929 png_charp* units, | |
| 2930 png_charpp* params)); | |
| 2487 #endif | 2931 #endif |
| 2488 | 2932 |
| 2489 #ifdef PNG_pCAL_SUPPORTED | 2933 #ifdef PNG_pCAL_SUPPORTED |
| 2490 PNG_EXPORT(148, void, png_set_pCAL, (png_const_structrp png_ptr, | 2934 PNG_EXPORT(148, |
| 2491 png_inforp info_ptr, png_const_charp purpose, png_int_32 X0, png_int_32 X1, | 2935 void, |
| 2492 int type, int nparams, png_const_charp units, png_charpp params)); | 2936 png_set_pCAL, |
| 2937 (png_const_structrp png_ptr, | |
| 2938 png_inforp info_ptr, | |
| 2939 png_const_charp purpose, | |
| 2940 png_int_32 X0, | |
| 2941 png_int_32 X1, | |
| 2942 int type, | |
| 2943 int nparams, | |
| 2944 png_const_charp units, | |
| 2945 png_charpp params)); | |
| 2493 #endif | 2946 #endif |
| 2494 | 2947 |
| 2495 #ifdef PNG_pHYs_SUPPORTED | 2948 #ifdef PNG_pHYs_SUPPORTED |
| 2496 PNG_EXPORT(149, png_uint_32, png_get_pHYs, (png_const_structrp png_ptr, | 2949 PNG_EXPORT(149, |
| 2497 png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, | 2950 png_uint_32, |
| 2498 int *unit_type)); | 2951 png_get_pHYs, |
| 2952 (png_const_structrp png_ptr, | |
| 2953 png_const_inforp info_ptr, | |
| 2954 png_uint_32* res_x, | |
| 2955 png_uint_32* res_y, | |
| 2956 int* unit_type)); | |
| 2499 #endif | 2957 #endif |
| 2500 | 2958 |
| 2501 #ifdef PNG_pHYs_SUPPORTED | 2959 #ifdef PNG_pHYs_SUPPORTED |
| 2502 PNG_EXPORT(150, void, png_set_pHYs, (png_const_structrp png_ptr, | 2960 PNG_EXPORT(150, |
| 2503 png_inforp info_ptr, png_uint_32 res_x, png_uint_32 res_y, int unit_type)); | 2961 void, |
| 2504 #endif | 2962 png_set_pHYs, |
| 2505 | 2963 (png_const_structrp png_ptr, |
| 2506 PNG_EXPORT(151, png_uint_32, png_get_PLTE, (png_const_structrp png_ptr, | 2964 png_inforp info_ptr, |
| 2507 png_inforp info_ptr, png_colorp *palette, int *num_palette)); | 2965 png_uint_32 res_x, |
| 2508 | 2966 png_uint_32 res_y, |
| 2509 PNG_EXPORT(152, void, png_set_PLTE, (png_structrp png_ptr, | 2967 int unit_type)); |
| 2510 png_inforp info_ptr, png_const_colorp palette, int num_palette)); | 2968 #endif |
| 2969 | |
| 2970 PNG_EXPORT(151, | |
| 2971 png_uint_32, | |
| 2972 png_get_PLTE, | |
| 2973 (png_const_structrp png_ptr, | |
| 2974 png_inforp info_ptr, | |
| 2975 png_colorp* palette, | |
| 2976 int* num_palette)); | |
| 2977 | |
| 2978 PNG_EXPORT(152, | |
| 2979 void, | |
| 2980 png_set_PLTE, | |
| 2981 (png_structrp png_ptr, | |
| 2982 png_inforp info_ptr, | |
| 2983 png_const_colorp palette, | |
| 2984 int num_palette)); | |
| 2511 | 2985 |
| 2512 #ifdef PNG_sBIT_SUPPORTED | 2986 #ifdef PNG_sBIT_SUPPORTED |
| 2513 PNG_EXPORT(153, png_uint_32, png_get_sBIT, (png_const_structrp png_ptr, | 2987 PNG_EXPORT(153, |
| 2514 png_inforp info_ptr, png_color_8p *sig_bit)); | 2988 png_uint_32, |
| 2989 png_get_sBIT, | |
| 2990 (png_const_structrp png_ptr, | |
| 2991 png_inforp info_ptr, | |
| 2992 png_color_8p* sig_bit)); | |
| 2515 #endif | 2993 #endif |
| 2516 | 2994 |
| 2517 #ifdef PNG_sBIT_SUPPORTED | 2995 #ifdef PNG_sBIT_SUPPORTED |
| 2518 PNG_EXPORT(154, void, png_set_sBIT, (png_const_structrp png_ptr, | 2996 PNG_EXPORT(154, |
| 2519 png_inforp info_ptr, png_const_color_8p sig_bit)); | 2997 void, |
| 2998 png_set_sBIT, | |
| 2999 (png_const_structrp png_ptr, | |
| 3000 png_inforp info_ptr, | |
| 3001 png_const_color_8p sig_bit)); | |
| 2520 #endif | 3002 #endif |
| 2521 | 3003 |
| 2522 #ifdef PNG_sRGB_SUPPORTED | 3004 #ifdef PNG_sRGB_SUPPORTED |
| 2523 PNG_EXPORT(155, png_uint_32, png_get_sRGB, (png_const_structrp png_ptr, | 3005 PNG_EXPORT(155, |
| 2524 png_const_inforp info_ptr, int *file_srgb_intent)); | 3006 png_uint_32, |
| 3007 png_get_sRGB, | |
| 3008 (png_const_structrp png_ptr, | |
| 3009 png_const_inforp info_ptr, | |
| 3010 int* file_srgb_intent)); | |
| 2525 #endif | 3011 #endif |
| 2526 | 3012 |
| 2527 #ifdef PNG_sRGB_SUPPORTED | 3013 #ifdef PNG_sRGB_SUPPORTED |
| 2528 PNG_EXPORT(156, void, png_set_sRGB, (png_const_structrp png_ptr, | 3014 PNG_EXPORT(156, |
| 2529 png_inforp info_ptr, int srgb_intent)); | 3015 void, |
| 2530 PNG_EXPORT(157, void, png_set_sRGB_gAMA_and_cHRM, (png_const_structrp png_ptr, | 3016 png_set_sRGB, |
| 2531 png_inforp info_ptr, int srgb_intent)); | 3017 (png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent)); |
| 3018 PNG_EXPORT(157, | |
| 3019 void, | |
| 3020 png_set_sRGB_gAMA_and_cHRM, | |
| 3021 (png_const_structrp png_ptr, png_inforp info_ptr, int srgb_intent)); | |
| 2532 #endif | 3022 #endif |
| 2533 | 3023 |
| 2534 #ifdef PNG_iCCP_SUPPORTED | 3024 #ifdef PNG_iCCP_SUPPORTED |
| 2535 PNG_EXPORT(158, png_uint_32, png_get_iCCP, (png_const_structrp png_ptr, | 3025 PNG_EXPORT(158, |
| 2536 png_inforp info_ptr, png_charpp name, int *compression_type, | 3026 png_uint_32, |
| 2537 png_bytepp profile, png_uint_32 *proflen)); | 3027 png_get_iCCP, |
| 3028 (png_const_structrp png_ptr, | |
| 3029 png_inforp info_ptr, | |
| 3030 png_charpp name, | |
| 3031 int* compression_type, | |
| 3032 png_bytepp profile, | |
| 3033 png_uint_32* proflen)); | |
| 2538 #endif | 3034 #endif |
| 2539 | 3035 |
| 2540 #ifdef PNG_iCCP_SUPPORTED | 3036 #ifdef PNG_iCCP_SUPPORTED |
| 2541 PNG_EXPORT(159, void, png_set_iCCP, (png_const_structrp png_ptr, | 3037 PNG_EXPORT(159, |
| 2542 png_inforp info_ptr, png_const_charp name, int compression_type, | 3038 void, |
| 2543 png_const_bytep profile, png_uint_32 proflen)); | 3039 png_set_iCCP, |
| 3040 (png_const_structrp png_ptr, | |
| 3041 png_inforp info_ptr, | |
| 3042 png_const_charp name, | |
| 3043 int compression_type, | |
| 3044 png_const_bytep profile, | |
| 3045 png_uint_32 proflen)); | |
| 2544 #endif | 3046 #endif |
| 2545 | 3047 |
| 2546 #ifdef PNG_sPLT_SUPPORTED | 3048 #ifdef PNG_sPLT_SUPPORTED |
| 2547 PNG_EXPORT(160, int, png_get_sPLT, (png_const_structrp png_ptr, | 3049 PNG_EXPORT(160, |
| 2548 png_inforp info_ptr, png_sPLT_tpp entries)); | 3050 int, |
| 3051 png_get_sPLT, | |
| 3052 (png_const_structrp png_ptr, | |
| 3053 png_inforp info_ptr, | |
| 3054 png_sPLT_tpp entries)); | |
| 2549 #endif | 3055 #endif |
| 2550 | 3056 |
| 2551 #ifdef PNG_sPLT_SUPPORTED | 3057 #ifdef PNG_sPLT_SUPPORTED |
| 2552 PNG_EXPORT(161, void, png_set_sPLT, (png_const_structrp png_ptr, | 3058 PNG_EXPORT(161, |
| 2553 png_inforp info_ptr, png_const_sPLT_tp entries, int nentries)); | 3059 void, |
| 3060 png_set_sPLT, | |
| 3061 (png_const_structrp png_ptr, | |
| 3062 png_inforp info_ptr, | |
| 3063 png_const_sPLT_tp entries, | |
| 3064 int nentries)); | |
| 2554 #endif | 3065 #endif |
| 2555 | 3066 |
| 2556 #ifdef PNG_TEXT_SUPPORTED | 3067 #ifdef PNG_TEXT_SUPPORTED |
| 2557 /* png_get_text also returns the number of text chunks in *num_text */ | 3068 /* png_get_text also returns the number of text chunks in *num_text */ |
| 2558 PNG_EXPORT(162, int, png_get_text, (png_const_structrp png_ptr, | 3069 PNG_EXPORT(162, |
| 2559 png_inforp info_ptr, png_textp *text_ptr, int *num_text)); | 3070 int, |
| 3071 png_get_text, | |
| 3072 (png_const_structrp png_ptr, | |
| 3073 png_inforp info_ptr, | |
| 3074 png_textp* text_ptr, | |
| 3075 int* num_text)); | |
| 2560 #endif | 3076 #endif |
| 2561 | 3077 |
| 2562 /* Note while png_set_text() will accept a structure whose text, | 3078 /* Note while png_set_text() will accept a structure whose text, |
| 2563 * language, and translated keywords are NULL pointers, the structure | 3079 * language, and translated keywords are NULL pointers, the structure |
| 2564 * returned by png_get_text will always contain regular | 3080 * returned by png_get_text will always contain regular |
| 2565 * zero-terminated C strings. They might be empty strings but | 3081 * zero-terminated C strings. They might be empty strings but |
| 2566 * they will never be NULL pointers. | 3082 * they will never be NULL pointers. |
| 2567 */ | 3083 */ |
| 2568 | 3084 |
| 2569 #ifdef PNG_TEXT_SUPPORTED | 3085 #ifdef PNG_TEXT_SUPPORTED |
| 2570 PNG_EXPORT(163, void, png_set_text, (png_const_structrp png_ptr, | 3086 PNG_EXPORT(163, |
| 2571 png_inforp info_ptr, png_const_textp text_ptr, int num_text)); | 3087 void, |
| 3088 png_set_text, | |
| 3089 (png_const_structrp png_ptr, | |
| 3090 png_inforp info_ptr, | |
| 3091 png_const_textp text_ptr, | |
| 3092 int num_text)); | |
| 2572 #endif | 3093 #endif |
| 2573 | 3094 |
| 2574 #ifdef PNG_tIME_SUPPORTED | 3095 #ifdef PNG_tIME_SUPPORTED |
| 2575 PNG_EXPORT(164, png_uint_32, png_get_tIME, (png_const_structrp png_ptr, | 3096 PNG_EXPORT(164, |
| 2576 png_inforp info_ptr, png_timep *mod_time)); | 3097 png_uint_32, |
| 3098 png_get_tIME, | |
| 3099 (png_const_structrp png_ptr, | |
| 3100 png_inforp info_ptr, | |
| 3101 png_timep* mod_time)); | |
| 2577 #endif | 3102 #endif |
| 2578 | 3103 |
| 2579 #ifdef PNG_tIME_SUPPORTED | 3104 #ifdef PNG_tIME_SUPPORTED |
| 2580 PNG_EXPORT(165, void, png_set_tIME, (png_const_structrp png_ptr, | 3105 PNG_EXPORT(165, |
| 2581 png_inforp info_ptr, png_const_timep mod_time)); | 3106 void, |
| 3107 png_set_tIME, | |
| 3108 (png_const_structrp png_ptr, | |
| 3109 png_inforp info_ptr, | |
| 3110 png_const_timep mod_time)); | |
| 2582 #endif | 3111 #endif |
| 2583 | 3112 |
| 2584 #ifdef PNG_tRNS_SUPPORTED | 3113 #ifdef PNG_tRNS_SUPPORTED |
| 2585 PNG_EXPORT(166, png_uint_32, png_get_tRNS, (png_const_structrp png_ptr, | 3114 PNG_EXPORT(166, |
| 2586 png_inforp info_ptr, png_bytep *trans_alpha, int *num_trans, | 3115 png_uint_32, |
| 2587 png_color_16p *trans_color)); | 3116 png_get_tRNS, |
| 3117 (png_const_structrp png_ptr, | |
| 3118 png_inforp info_ptr, | |
| 3119 png_bytep* trans_alpha, | |
| 3120 int* num_trans, | |
| 3121 png_color_16p* trans_color)); | |
| 2588 #endif | 3122 #endif |
| 2589 | 3123 |
| 2590 #ifdef PNG_tRNS_SUPPORTED | 3124 #ifdef PNG_tRNS_SUPPORTED |
| 2591 PNG_EXPORT(167, void, png_set_tRNS, (png_structrp png_ptr, | 3125 PNG_EXPORT(167, |
| 2592 png_inforp info_ptr, png_const_bytep trans_alpha, int num_trans, | 3126 void, |
| 2593 png_const_color_16p trans_color)); | 3127 png_set_tRNS, |
| 3128 (png_structrp png_ptr, | |
| 3129 png_inforp info_ptr, | |
| 3130 png_const_bytep trans_alpha, | |
| 3131 int num_trans, | |
| 3132 png_const_color_16p trans_color)); | |
| 2594 #endif | 3133 #endif |
| 2595 | 3134 |
| 2596 #ifdef PNG_sCAL_SUPPORTED | 3135 #ifdef PNG_sCAL_SUPPORTED |
| 2597 PNG_FP_EXPORT(168, png_uint_32, png_get_sCAL, (png_const_structrp png_ptr, | 3136 PNG_FP_EXPORT(168, |
| 2598 png_const_inforp info_ptr, int *unit, double *width, double *height)) | 3137 png_uint_32, |
| 3138 png_get_sCAL, | |
| 3139 (png_const_structrp png_ptr, | |
| 3140 png_const_inforp info_ptr, | |
| 3141 int* unit, | |
| 3142 double* width, | |
| 3143 double* height)) | |
| 2599 #if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \ | 3144 #if defined(PNG_FLOATING_ARITHMETIC_SUPPORTED) || \ |
| 2600 defined(PNG_FLOATING_POINT_SUPPORTED) | 3145 defined(PNG_FLOATING_POINT_SUPPORTED) |
| 2601 /* NOTE: this API is currently implemented using floating point arithmetic, | 3146 /* NOTE: this API is currently implemented using floating point arithmetic, |
| 2602 * consequently it can only be used on systems with floating point support. | 3147 * consequently it can only be used on systems with floating point support. |
| 2603 * In any case the range of values supported by png_fixed_point is small and it | 3148 * In any case the range of values supported by png_fixed_point is small and it |
| 2604 * is highly recommended that png_get_sCAL_s be used instead. | 3149 * is highly recommended that png_get_sCAL_s be used instead. |
| 2605 */ | 3150 */ |
| 2606 PNG_FIXED_EXPORT(214, png_uint_32, png_get_sCAL_fixed, | 3151 PNG_FIXED_EXPORT(214, |
| 2607 (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, | 3152 png_uint_32, |
| 2608 png_fixed_point *width, png_fixed_point *height)) | 3153 png_get_sCAL_fixed, |
| 3154 (png_const_structrp png_ptr, | |
| 3155 png_const_inforp info_ptr, | |
| 3156 int* unit, | |
| 3157 png_fixed_point* width, | |
| 3158 png_fixed_point* height)) | |
| 2609 #endif | 3159 #endif |
| 2610 PNG_EXPORT(169, png_uint_32, png_get_sCAL_s, | 3160 PNG_EXPORT(169, |
| 2611 (png_const_structrp png_ptr, png_const_inforp info_ptr, int *unit, | 3161 png_uint_32, |
| 2612 png_charpp swidth, png_charpp sheight)); | 3162 png_get_sCAL_s, |
| 3163 (png_const_structrp png_ptr, | |
| 3164 png_const_inforp info_ptr, | |
| 3165 int* unit, | |
| 3166 png_charpp swidth, | |
| 3167 png_charpp sheight)); | |
| 2613 | 3168 |
| 2614 PNG_FP_EXPORT(170, void, png_set_sCAL, (png_const_structrp png_ptr, | 3169 PNG_FP_EXPORT(170, |
| 2615 png_inforp info_ptr, int unit, double width, double height)) | 3170 void, |
| 2616 PNG_FIXED_EXPORT(213, void, png_set_sCAL_fixed, (png_const_structrp png_ptr, | 3171 png_set_sCAL, |
| 2617 png_inforp info_ptr, int unit, png_fixed_point width, | 3172 (png_const_structrp png_ptr, |
| 2618 png_fixed_point height)) | 3173 png_inforp info_ptr, |
| 2619 PNG_EXPORT(171, void, png_set_sCAL_s, (png_const_structrp png_ptr, | 3174 int unit, |
| 2620 png_inforp info_ptr, int unit, | 3175 double width, |
| 2621 png_const_charp swidth, png_const_charp sheight)); | 3176 double height)) |
| 3177 PNG_FIXED_EXPORT(213, | |
| 3178 void, | |
| 3179 png_set_sCAL_fixed, | |
| 3180 (png_const_structrp png_ptr, | |
| 3181 png_inforp info_ptr, | |
| 3182 int unit, | |
| 3183 png_fixed_point width, | |
| 3184 png_fixed_point height)) | |
| 3185 PNG_EXPORT(171, | |
| 3186 void, | |
| 3187 png_set_sCAL_s, | |
| 3188 (png_const_structrp png_ptr, | |
| 3189 png_inforp info_ptr, | |
| 3190 int unit, | |
| 3191 png_const_charp swidth, | |
| 3192 png_const_charp sheight)); | |
| 2622 #endif /* PNG_sCAL_SUPPORTED */ | 3193 #endif /* PNG_sCAL_SUPPORTED */ |
| 2623 | 3194 |
| 2624 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED | 3195 #ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED |
| 2625 /* Provide the default handling for all unknown chunks or, optionally, for | 3196 /* Provide the default handling for all unknown chunks or, optionally, for |
| 2626 * specific unknown chunks. | 3197 * specific unknown chunks. |
| 2627 * | 3198 * |
| 2628 * NOTE: prior to 1.6.0 the handling specified for particular chunks on read was | 3199 * NOTE: prior to 1.6.0 the handling specified for particular chunks on read was |
| 2629 * ignored and the default was used, the per-chunk setting only had an effect on | 3200 * ignored and the default was used, the per-chunk setting only had an effect on |
| 2630 * write. If you wish to have chunk-specific handling on read in code that must | 3201 * write. If you wish to have chunk-specific handling on read in code that must |
| 2631 * work on earlier versions you must use a user chunk callback to specify the | 3202 * work on earlier versions you must use a user chunk callback to specify the |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2713 * otherwise the chunk list array is ignored. | 3284 * otherwise the chunk list array is ignored. |
| 2714 * | 3285 * |
| 2715 * If num_chunks is 0 the "keep" parameter specifies the default behavior for | 3286 * If num_chunks is 0 the "keep" parameter specifies the default behavior for |
| 2716 * unknown chunks, as described above. | 3287 * unknown chunks, as described above. |
| 2717 * | 3288 * |
| 2718 * If num_chunks is negative, then the "keep" parameter specifies the manner | 3289 * If num_chunks is negative, then the "keep" parameter specifies the manner |
| 2719 * for handling all unknown chunks plus all chunks recognized by libpng | 3290 * for handling all unknown chunks plus all chunks recognized by libpng |
| 2720 * except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to | 3291 * except for the IHDR, PLTE, tRNS, IDAT, and IEND chunks (which continue to |
| 2721 * be processed by libpng. | 3292 * be processed by libpng. |
| 2722 */ | 3293 */ |
| 2723 PNG_EXPORT(172, void, png_set_keep_unknown_chunks, (png_structrp png_ptr, | 3294 PNG_EXPORT(172, |
| 2724 int keep, png_const_bytep chunk_list, int num_chunks)); | 3295 void, |
| 3296 png_set_keep_unknown_chunks, | |
| 3297 (png_structrp png_ptr, | |
| 3298 int keep, | |
| 3299 png_const_bytep chunk_list, | |
| 3300 int num_chunks)); | |
| 2725 | 3301 |
| 2726 /* The "keep" PNG_HANDLE_CHUNK_ parameter for the specified chunk is returned; | 3302 /* The "keep" PNG_HANDLE_CHUNK_ parameter for the specified chunk is returned; |
| 2727 * the result is therefore true (non-zero) if special handling is required, | 3303 * the result is therefore true (non-zero) if special handling is required, |
| 2728 * false for the default handling. | 3304 * false for the default handling. |
| 2729 */ | 3305 */ |
| 2730 PNG_EXPORT(173, int, png_handle_as_unknown, (png_const_structrp png_ptr, | 3306 PNG_EXPORT(173, |
| 2731 png_const_bytep chunk_name)); | 3307 int, |
| 3308 png_handle_as_unknown, | |
| 3309 (png_const_structrp png_ptr, png_const_bytep chunk_name)); | |
| 2732 #endif | 3310 #endif |
| 2733 | 3311 |
| 2734 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED | 3312 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED |
| 2735 PNG_EXPORT(174, void, png_set_unknown_chunks, (png_const_structrp png_ptr, | 3313 PNG_EXPORT(174, |
| 2736 png_inforp info_ptr, png_const_unknown_chunkp unknowns, | 3314 void, |
| 2737 int num_unknowns)); | 3315 png_set_unknown_chunks, |
| 2738 /* NOTE: prior to 1.6.0 this routine set the 'location' field of the added | 3316 (png_const_structrp png_ptr, |
| 2739 * unknowns to the location currently stored in the png_struct. This is | 3317 png_inforp info_ptr, |
| 2740 * invariably the wrong value on write. To fix this call the following API | 3318 png_const_unknown_chunkp unknowns, |
| 2741 * for each chunk in the list with the correct location. If you know your | 3319 int num_unknowns)); |
| 2742 * code won't be compiled on earlier versions you can rely on | 3320 /* NOTE: prior to 1.6.0 this routine set the 'location' field of the added |
| 2743 * png_set_unknown_chunks(write-ptr, png_get_unknown_chunks(read-ptr)) doing | 3321 * unknowns to the location currently stored in the png_struct. This is |
| 2744 * the correct thing. | 3322 * invariably the wrong value on write. To fix this call the following API |
| 2745 */ | 3323 * for each chunk in the list with the correct location. If you know your |
| 2746 | 3324 * code won't be compiled on earlier versions you can rely on |
| 2747 PNG_EXPORT(175, void, png_set_unknown_chunk_location, | 3325 * png_set_unknown_chunks(write-ptr, png_get_unknown_chunks(read-ptr)) doing |
| 3326 * the correct thing. | |
| 3327 */ | |
| 3328 | |
| 3329 PNG_EXPORT( | |
| 3330 175, | |
| 3331 void, | |
| 3332 png_set_unknown_chunk_location, | |
| 2748 (png_const_structrp png_ptr, png_inforp info_ptr, int chunk, int location)); | 3333 (png_const_structrp png_ptr, png_inforp info_ptr, int chunk, int location)); |
| 2749 | 3334 |
| 2750 PNG_EXPORT(176, int, png_get_unknown_chunks, (png_const_structrp png_ptr, | 3335 PNG_EXPORT(176, |
| 2751 png_inforp info_ptr, png_unknown_chunkpp entries)); | 3336 int, |
| 3337 png_get_unknown_chunks, | |
| 3338 (png_const_structrp png_ptr, | |
| 3339 png_inforp info_ptr, | |
| 3340 png_unknown_chunkpp entries)); | |
| 2752 #endif | 3341 #endif |
| 2753 | 3342 |
| 2754 /* Png_free_data() will turn off the "valid" flag for anything it frees. | 3343 /* Png_free_data() will turn off the "valid" flag for anything it frees. |
| 2755 * If you need to turn it off for a chunk that your application has freed, | 3344 * If you need to turn it off for a chunk that your application has freed, |
| 2756 * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); | 3345 * you can use png_set_invalid(png_ptr, info_ptr, PNG_INFO_CHNK); |
| 2757 */ | 3346 */ |
| 2758 PNG_EXPORT(177, void, png_set_invalid, (png_const_structrp png_ptr, | 3347 PNG_EXPORT(177, |
| 2759 png_inforp info_ptr, int mask)); | 3348 void, |
| 3349 png_set_invalid, | |
| 3350 (png_const_structrp png_ptr, png_inforp info_ptr, int mask)); | |
| 2760 | 3351 |
| 2761 #ifdef PNG_INFO_IMAGE_SUPPORTED | 3352 #ifdef PNG_INFO_IMAGE_SUPPORTED |
| 2762 /* The "params" pointer is currently not used and is for future expansion. */ | 3353 /* The "params" pointer is currently not used and is for future expansion. */ |
| 2763 PNG_EXPORT(178, void, png_read_png, (png_structrp png_ptr, png_inforp info_ptr, | 3354 PNG_EXPORT(178, |
| 2764 int transforms, png_voidp params)); | 3355 void, |
| 2765 PNG_EXPORT(179, void, png_write_png, (png_structrp png_ptr, png_inforp info_ptr, | 3356 png_read_png, |
| 2766 int transforms, png_voidp params)); | 3357 (png_structrp png_ptr, |
| 2767 #endif | 3358 png_inforp info_ptr, |
| 2768 | 3359 int transforms, |
| 2769 PNG_EXPORT(180, png_const_charp, png_get_copyright, | 3360 png_voidp params)); |
| 2770 (png_const_structrp png_ptr)); | 3361 PNG_EXPORT(179, |
| 2771 PNG_EXPORT(181, png_const_charp, png_get_header_ver, | 3362 void, |
| 2772 (png_const_structrp png_ptr)); | 3363 png_write_png, |
| 2773 PNG_EXPORT(182, png_const_charp, png_get_header_version, | 3364 (png_structrp png_ptr, |
| 2774 (png_const_structrp png_ptr)); | 3365 png_inforp info_ptr, |
| 2775 PNG_EXPORT(183, png_const_charp, png_get_libpng_ver, | 3366 int transforms, |
| 2776 (png_const_structrp png_ptr)); | 3367 png_voidp params)); |
| 3368 #endif | |
| 3369 | |
| 3370 PNG_EXPORT(180, | |
| 3371 png_const_charp, | |
| 3372 png_get_copyright, | |
| 3373 (png_const_structrp png_ptr)); | |
| 3374 PNG_EXPORT(181, | |
| 3375 png_const_charp, | |
| 3376 png_get_header_ver, | |
| 3377 (png_const_structrp png_ptr)); | |
| 3378 PNG_EXPORT(182, | |
| 3379 png_const_charp, | |
| 3380 png_get_header_version, | |
| 3381 (png_const_structrp png_ptr)); | |
| 3382 PNG_EXPORT(183, | |
| 3383 png_const_charp, | |
| 3384 png_get_libpng_ver, | |
| 3385 (png_const_structrp png_ptr)); | |
| 2777 | 3386 |
| 2778 #ifdef PNG_MNG_FEATURES_SUPPORTED | 3387 #ifdef PNG_MNG_FEATURES_SUPPORTED |
| 2779 PNG_EXPORT(184, png_uint_32, png_permit_mng_features, (png_structrp png_ptr, | 3388 PNG_EXPORT(184, |
| 2780 png_uint_32 mng_features_permitted)); | 3389 png_uint_32, |
| 3390 png_permit_mng_features, | |
| 3391 (png_structrp png_ptr, png_uint_32 mng_features_permitted)); | |
| 2781 #endif | 3392 #endif |
| 2782 | 3393 |
| 2783 /* For use in png_set_keep_unknown, added to version 1.2.6 */ | 3394 /* For use in png_set_keep_unknown, added to version 1.2.6 */ |
| 2784 #define PNG_HANDLE_CHUNK_AS_DEFAULT 0 | 3395 #define PNG_HANDLE_CHUNK_AS_DEFAULT 0 |
| 2785 #define PNG_HANDLE_CHUNK_NEVER 1 | 3396 #define PNG_HANDLE_CHUNK_NEVER 1 |
| 2786 #define PNG_HANDLE_CHUNK_IF_SAFE 2 | 3397 #define PNG_HANDLE_CHUNK_IF_SAFE 2 |
| 2787 #define PNG_HANDLE_CHUNK_ALWAYS 3 | 3398 #define PNG_HANDLE_CHUNK_ALWAYS 3 |
| 2788 #define PNG_HANDLE_CHUNK_LAST 4 | 3399 #define PNG_HANDLE_CHUNK_LAST 4 |
| 2789 | 3400 |
| 2790 /* Strip the prepended error numbers ("#nnn ") from error and warning | 3401 /* Strip the prepended error numbers ("#nnn ") from error and warning |
| 2791 * messages before passing them to the error or warning handler. | 3402 * messages before passing them to the error or warning handler. |
| 2792 */ | 3403 */ |
| 2793 #ifdef PNG_ERROR_NUMBERS_SUPPORTED | 3404 #ifdef PNG_ERROR_NUMBERS_SUPPORTED |
| 2794 PNG_EXPORT(185, void, png_set_strip_error_numbers, (png_structrp png_ptr, | 3405 PNG_EXPORT(185, |
| 2795 png_uint_32 strip_mode)); | 3406 void, |
| 3407 png_set_strip_error_numbers, | |
| 3408 (png_structrp png_ptr, png_uint_32 strip_mode)); | |
| 2796 #endif | 3409 #endif |
| 2797 | 3410 |
| 2798 /* Added in libpng-1.2.6 */ | 3411 /* Added in libpng-1.2.6 */ |
| 2799 #ifdef PNG_SET_USER_LIMITS_SUPPORTED | 3412 #ifdef PNG_SET_USER_LIMITS_SUPPORTED |
| 2800 PNG_EXPORT(186, void, png_set_user_limits, (png_structrp png_ptr, | 3413 PNG_EXPORT(186, |
| 2801 png_uint_32 user_width_max, png_uint_32 user_height_max)); | 3414 void, |
| 2802 PNG_EXPORT(187, png_uint_32, png_get_user_width_max, | 3415 png_set_user_limits, |
| 2803 (png_const_structrp png_ptr)); | 3416 (png_structrp png_ptr, |
| 2804 PNG_EXPORT(188, png_uint_32, png_get_user_height_max, | 3417 png_uint_32 user_width_max, |
| 2805 (png_const_structrp png_ptr)); | 3418 png_uint_32 user_height_max)); |
| 3419 PNG_EXPORT(187, | |
| 3420 png_uint_32, | |
| 3421 png_get_user_width_max, | |
| 3422 (png_const_structrp png_ptr)); | |
| 3423 PNG_EXPORT(188, | |
| 3424 png_uint_32, | |
| 3425 png_get_user_height_max, | |
| 3426 (png_const_structrp png_ptr)); | |
| 2806 /* Added in libpng-1.4.0 */ | 3427 /* Added in libpng-1.4.0 */ |
| 2807 PNG_EXPORT(189, void, png_set_chunk_cache_max, (png_structrp png_ptr, | 3428 PNG_EXPORT(189, |
| 2808 png_uint_32 user_chunk_cache_max)); | 3429 void, |
| 2809 PNG_EXPORT(190, png_uint_32, png_get_chunk_cache_max, | 3430 png_set_chunk_cache_max, |
| 2810 (png_const_structrp png_ptr)); | 3431 (png_structrp png_ptr, png_uint_32 user_chunk_cache_max)); |
| 3432 PNG_EXPORT(190, | |
| 3433 png_uint_32, | |
| 3434 png_get_chunk_cache_max, | |
| 3435 (png_const_structrp png_ptr)); | |
| 2811 /* Added in libpng-1.4.1 */ | 3436 /* Added in libpng-1.4.1 */ |
| 2812 PNG_EXPORT(191, void, png_set_chunk_malloc_max, (png_structrp png_ptr, | 3437 PNG_EXPORT(191, |
| 2813 png_alloc_size_t user_chunk_cache_max)); | 3438 void, |
| 2814 PNG_EXPORT(192, png_alloc_size_t, png_get_chunk_malloc_max, | 3439 png_set_chunk_malloc_max, |
| 2815 (png_const_structrp png_ptr)); | 3440 (png_structrp png_ptr, png_alloc_size_t user_chunk_cache_max)); |
| 3441 PNG_EXPORT(192, | |
| 3442 png_alloc_size_t, | |
| 3443 png_get_chunk_malloc_max, | |
| 3444 (png_const_structrp png_ptr)); | |
| 2816 #endif | 3445 #endif |
| 2817 | 3446 |
| 2818 #if defined(PNG_INCH_CONVERSIONS_SUPPORTED) | 3447 #if defined(PNG_INCH_CONVERSIONS_SUPPORTED) |
| 2819 PNG_EXPORT(193, png_uint_32, png_get_pixels_per_inch, | 3448 PNG_EXPORT(193, |
| 2820 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 3449 png_uint_32, |
| 2821 | 3450 png_get_pixels_per_inch, |
| 2822 PNG_EXPORT(194, png_uint_32, png_get_x_pixels_per_inch, | 3451 (png_const_structrp png_ptr, png_const_inforp info_ptr)); |
| 2823 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 3452 |
| 2824 | 3453 PNG_EXPORT(194, |
| 2825 PNG_EXPORT(195, png_uint_32, png_get_y_pixels_per_inch, | 3454 png_uint_32, |
| 2826 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | 3455 png_get_x_pixels_per_inch, |
| 2827 | 3456 (png_const_structrp png_ptr, png_const_inforp info_ptr)); |
| 2828 PNG_FP_EXPORT(196, float, png_get_x_offset_inches, | 3457 |
| 2829 (png_const_structrp png_ptr, png_const_inforp info_ptr)) | 3458 PNG_EXPORT(195, |
| 3459 png_uint_32, | |
| 3460 png_get_y_pixels_per_inch, | |
| 3461 (png_const_structrp png_ptr, png_const_inforp info_ptr)); | |
| 3462 | |
| 3463 PNG_FP_EXPORT(196, | |
| 3464 float, | |
| 3465 png_get_x_offset_inches, | |
| 3466 (png_const_structrp png_ptr, png_const_inforp info_ptr)) | |
| 2830 #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ | 3467 #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ |
| 2831 PNG_FIXED_EXPORT(211, png_fixed_point, png_get_x_offset_inches_fixed, | 3468 PNG_FIXED_EXPORT(211, |
| 2832 (png_const_structrp png_ptr, png_const_inforp info_ptr)) | 3469 png_fixed_point, |
| 2833 #endif | 3470 png_get_x_offset_inches_fixed, |
| 2834 | 3471 (png_const_structrp png_ptr, png_const_inforp info_ptr)) |
| 2835 PNG_FP_EXPORT(197, float, png_get_y_offset_inches, (png_const_structrp png_ptr, | 3472 #endif |
| 2836 png_const_inforp info_ptr)) | 3473 |
| 3474 PNG_FP_EXPORT(197, | |
| 3475 float, | |
| 3476 png_get_y_offset_inches, | |
| 3477 (png_const_structrp png_ptr, png_const_inforp info_ptr)) | |
| 2837 #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ | 3478 #ifdef PNG_FIXED_POINT_SUPPORTED /* otherwise not implemented. */ |
| 2838 PNG_FIXED_EXPORT(212, png_fixed_point, png_get_y_offset_inches_fixed, | 3479 PNG_FIXED_EXPORT(212, |
| 2839 (png_const_structrp png_ptr, png_const_inforp info_ptr)) | 3480 png_fixed_point, |
| 2840 #endif | 3481 png_get_y_offset_inches_fixed, |
| 2841 | 3482 (png_const_structrp png_ptr, png_const_inforp info_ptr)) |
| 2842 # ifdef PNG_pHYs_SUPPORTED | 3483 #endif |
| 2843 PNG_EXPORT(198, png_uint_32, png_get_pHYs_dpi, (png_const_structrp png_ptr, | 3484 |
| 2844 png_const_inforp info_ptr, png_uint_32 *res_x, png_uint_32 *res_y, | 3485 #ifdef PNG_pHYs_SUPPORTED |
| 2845 int *unit_type)); | 3486 PNG_EXPORT(198, |
| 2846 # endif /* PNG_pHYs_SUPPORTED */ | 3487 png_uint_32, |
| 2847 #endif /* PNG_INCH_CONVERSIONS_SUPPORTED */ | 3488 png_get_pHYs_dpi, |
| 3489 (png_const_structrp png_ptr, | |
| 3490 png_const_inforp info_ptr, | |
| 3491 png_uint_32* res_x, | |
| 3492 png_uint_32* res_y, | |
| 3493 int* unit_type)); | |
| 3494 #endif /* PNG_pHYs_SUPPORTED */ | |
| 3495 #endif /* PNG_INCH_CONVERSIONS_SUPPORTED */ | |
| 2848 | 3496 |
| 2849 /* Added in libpng-1.4.0 */ | 3497 /* Added in libpng-1.4.0 */ |
| 2850 #ifdef PNG_IO_STATE_SUPPORTED | 3498 #ifdef PNG_IO_STATE_SUPPORTED |
| 2851 PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_const_structrp png_ptr)); | 3499 PNG_EXPORT(199, png_uint_32, png_get_io_state, (png_const_structrp png_ptr)); |
| 2852 | 3500 |
| 2853 /* Removed from libpng 1.6; use png_get_io_chunk_type. */ | 3501 /* Removed from libpng 1.6; use png_get_io_chunk_type. */ |
| 2854 PNG_REMOVED(200, png_const_bytep, png_get_io_chunk_name, (png_structrp png_ptr), | 3502 PNG_REMOVED(200, |
| 2855 PNG_DEPRECATED) | 3503 png_const_bytep, |
| 2856 | 3504 png_get_io_chunk_name, |
| 2857 PNG_EXPORT(216, png_uint_32, png_get_io_chunk_type, | 3505 (png_structrp png_ptr), |
| 2858 (png_const_structrp png_ptr)); | 3506 PNG_DEPRECATED) |
| 3507 | |
| 3508 PNG_EXPORT(216, | |
| 3509 png_uint_32, | |
| 3510 png_get_io_chunk_type, | |
| 3511 (png_const_structrp png_ptr)); | |
| 2859 | 3512 |
| 2860 /* The flags returned by png_get_io_state() are the following: */ | 3513 /* The flags returned by png_get_io_state() are the following: */ |
| 2861 # define PNG_IO_NONE 0x0000 /* no I/O at this moment */ | 3514 #define PNG_IO_NONE 0x0000 /* no I/O at this moment */ |
| 2862 # define PNG_IO_READING 0x0001 /* currently reading */ | 3515 #define PNG_IO_READING 0x0001 /* currently reading */ |
| 2863 # define PNG_IO_WRITING 0x0002 /* currently writing */ | 3516 #define PNG_IO_WRITING 0x0002 /* currently writing */ |
| 2864 # define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */ | 3517 #define PNG_IO_SIGNATURE 0x0010 /* currently at the file signature */ |
| 2865 # define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */ | 3518 #define PNG_IO_CHUNK_HDR 0x0020 /* currently at the chunk header */ |
| 2866 # define PNG_IO_CHUNK_DATA 0x0040 /* currently at the chunk data */ | 3519 #define PNG_IO_CHUNK_DATA 0x0040 /* currently at the chunk data */ |
| 2867 # define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */ | 3520 #define PNG_IO_CHUNK_CRC 0x0080 /* currently at the chunk crc */ |
| 2868 # define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */ | 3521 #define PNG_IO_MASK_OP 0x000f /* current operation: reading/writing */ |
| 2869 # define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */ | 3522 #define PNG_IO_MASK_LOC 0x00f0 /* current location: sig/hdr/data/crc */ |
| 2870 #endif /* ?PNG_IO_STATE_SUPPORTED */ | 3523 #endif /* ?PNG_IO_STATE_SUPPORTED */ |
| 2871 | 3524 |
| 2872 /* Interlace support. The following macros are always defined so that if | 3525 /* Interlace support. The following macros are always defined so that if |
| 2873 * libpng interlace handling is turned off the macros may be used to handle | 3526 * libpng interlace handling is turned off the macros may be used to handle |
| 2874 * interlaced images within the application. | 3527 * interlaced images within the application. |
| 2875 */ | 3528 */ |
| 2876 #define PNG_INTERLACE_ADAM7_PASSES 7 | 3529 #define PNG_INTERLACE_ADAM7_PASSES 7 |
| 2877 | 3530 |
| 2878 /* Two macros to return the first row and first column of the original, | 3531 /* Two macros to return the first row and first column of the original, |
| 2879 * full, image which appears in a given pass. 'pass' is in the range 0 | 3532 * full, image which appears in a given pass. 'pass' is in the range 0 |
| 2880 * to 6 and the result is in the range 0 to 7. | 3533 * to 6 and the result is in the range 0 to 7. |
| 2881 */ | 3534 */ |
| 2882 #define PNG_PASS_START_ROW(pass) (((1&~(pass))<<(3-((pass)>>1)))&7) | 3535 #define PNG_PASS_START_ROW(pass) (((1 & ~(pass)) << (3 - ((pass) >> 1))) & 7) |
| 2883 #define PNG_PASS_START_COL(pass) (((1& (pass))<<(3-(((pass)+1)>>1)))&7) | 3536 #define PNG_PASS_START_COL(pass) \ |
| 3537 (((1 & (pass)) << (3 - (((pass) + 1) >> 1))) & 7) | |
| 2884 | 3538 |
| 2885 /* A macro to return the offset between pixels in the output row for a pair of | 3539 /* A macro to return the offset between pixels in the output row for a pair of |
| 2886 * pixels in the input - effectively the inverse of the 'COL_SHIFT' macro that | 3540 * pixels in the input - effectively the inverse of the 'COL_SHIFT' macro that |
| 2887 * follows. Note that ROW_OFFSET is the offset from one row to the next whereas | 3541 * follows. Note that ROW_OFFSET is the offset from one row to the next whereas |
| 2888 * COL_OFFSET is from one column to the next, within a row. | 3542 * COL_OFFSET is from one column to the next, within a row. |
| 2889 */ | 3543 */ |
| 2890 #define PNG_PASS_ROW_OFFSET(pass) ((pass)>2?(8>>(((pass)-1)>>1)):8) | 3544 #define PNG_PASS_ROW_OFFSET(pass) ((pass) > 2 ? (8 >> (((pass)-1) >> 1)) : 8) |
| 2891 #define PNG_PASS_COL_OFFSET(pass) (1<<((7-(pass))>>1)) | 3545 #define PNG_PASS_COL_OFFSET(pass) (1 << ((7 - (pass)) >> 1)) |
| 2892 | 3546 |
| 2893 /* Two macros to help evaluate the number of rows or columns in each | 3547 /* Two macros to help evaluate the number of rows or columns in each |
| 2894 * pass. This is expressed as a shift - effectively log2 of the number or | 3548 * pass. This is expressed as a shift - effectively log2 of the number or |
| 2895 * rows or columns in each 8x8 tile of the original image. | 3549 * rows or columns in each 8x8 tile of the original image. |
| 2896 */ | 3550 */ |
| 2897 #define PNG_PASS_ROW_SHIFT(pass) ((pass)>2?(8-(pass))>>1:3) | 3551 #define PNG_PASS_ROW_SHIFT(pass) ((pass) > 2 ? (8 - (pass)) >> 1 : 3) |
| 2898 #define PNG_PASS_COL_SHIFT(pass) ((pass)>1?(7-(pass))>>1:3) | 3552 #define PNG_PASS_COL_SHIFT(pass) ((pass) > 1 ? (7 - (pass)) >> 1 : 3) |
| 2899 | 3553 |
| 2900 /* Hence two macros to determine the number of rows or columns in a given | 3554 /* Hence two macros to determine the number of rows or columns in a given |
| 2901 * pass of an image given its height or width. In fact these macros may | 3555 * pass of an image given its height or width. In fact these macros may |
| 2902 * return non-zero even though the sub-image is empty, because the other | 3556 * return non-zero even though the sub-image is empty, because the other |
| 2903 * dimension may be empty for a small image. | 3557 * dimension may be empty for a small image. |
| 2904 */ | 3558 */ |
| 2905 #define PNG_PASS_ROWS(height, pass) (((height)+(((1<<PNG_PASS_ROW_SHIFT(pass))\ | 3559 #define PNG_PASS_ROWS(height, pass) \ |
| 2906 -1)-PNG_PASS_START_ROW(pass)))>>PNG_PASS_ROW_SHIFT(pass)) | 3560 (((height) + \ |
| 2907 #define PNG_PASS_COLS(width, pass) (((width)+(((1<<PNG_PASS_COL_SHIFT(pass))\ | 3561 (((1 << PNG_PASS_ROW_SHIFT(pass)) - 1) - PNG_PASS_START_ROW(pass))) >> \ |
| 2908 -1)-PNG_PASS_START_COL(pass)))>>PNG_PASS_COL_SHIFT(pass)) | 3562 PNG_PASS_ROW_SHIFT(pass)) |
| 3563 #define PNG_PASS_COLS(width, pass) \ | |
| 3564 (((width) + \ | |
| 3565 (((1 << PNG_PASS_COL_SHIFT(pass)) - 1) - PNG_PASS_START_COL(pass))) >> \ | |
| 3566 PNG_PASS_COL_SHIFT(pass)) | |
| 2909 | 3567 |
| 2910 /* For the reader row callbacks (both progressive and sequential) it is | 3568 /* For the reader row callbacks (both progressive and sequential) it is |
| 2911 * necessary to find the row in the output image given a row in an interlaced | 3569 * necessary to find the row in the output image given a row in an interlaced |
| 2912 * image, so two more macros: | 3570 * image, so two more macros: |
| 2913 */ | 3571 */ |
| 2914 #define PNG_ROW_FROM_PASS_ROW(y_in, pass) \ | 3572 #define PNG_ROW_FROM_PASS_ROW(y_in, pass) \ |
| 2915 (((y_in)<<PNG_PASS_ROW_SHIFT(pass))+PNG_PASS_START_ROW(pass)) | 3573 (((y_in) << PNG_PASS_ROW_SHIFT(pass)) + PNG_PASS_START_ROW(pass)) |
| 2916 #define PNG_COL_FROM_PASS_COL(x_in, pass) \ | 3574 #define PNG_COL_FROM_PASS_COL(x_in, pass) \ |
| 2917 (((x_in)<<PNG_PASS_COL_SHIFT(pass))+PNG_PASS_START_COL(pass)) | 3575 (((x_in) << PNG_PASS_COL_SHIFT(pass)) + PNG_PASS_START_COL(pass)) |
| 2918 | 3576 |
| 2919 /* Two macros which return a boolean (0 or 1) saying whether the given row | 3577 /* Two macros which return a boolean (0 or 1) saying whether the given row |
| 2920 * or column is in a particular pass. These use a common utility macro that | 3578 * or column is in a particular pass. These use a common utility macro that |
| 2921 * returns a mask for a given pass - the offset 'off' selects the row or | 3579 * returns a mask for a given pass - the offset 'off' selects the row or |
| 2922 * column version. The mask has the appropriate bit set for each column in | 3580 * column version. The mask has the appropriate bit set for each column in |
| 2923 * the tile. | 3581 * the tile. |
| 2924 */ | 3582 */ |
| 2925 #define PNG_PASS_MASK(pass,off) ( \ | 3583 #define PNG_PASS_MASK(pass, off) \ |
| 2926 ((0x110145AF>>(((7-(off))-(pass))<<2)) & 0xF) | \ | 3584 (((0x110145AF >> (((7 - (off)) - (pass)) << 2)) & 0xF) | \ |
| 2927 ((0x01145AF0>>(((7-(off))-(pass))<<2)) & 0xF0)) | 3585 ((0x01145AF0 >> (((7 - (off)) - (pass)) << 2)) & 0xF0)) |
| 2928 | 3586 |
| 2929 #define PNG_ROW_IN_INTERLACE_PASS(y, pass) \ | 3587 #define PNG_ROW_IN_INTERLACE_PASS(y, pass) \ |
| 2930 ((PNG_PASS_MASK(pass,0) >> ((y)&7)) & 1) | 3588 ((PNG_PASS_MASK(pass, 0) >> ((y)&7)) & 1) |
| 2931 #define PNG_COL_IN_INTERLACE_PASS(x, pass) \ | 3589 #define PNG_COL_IN_INTERLACE_PASS(x, pass) \ |
| 2932 ((PNG_PASS_MASK(pass,1) >> ((x)&7)) & 1) | 3590 ((PNG_PASS_MASK(pass, 1) >> ((x)&7)) & 1) |
| 2933 | 3591 |
| 2934 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED | 3592 #ifdef PNG_READ_COMPOSITE_NODIV_SUPPORTED |
| 2935 /* With these routines we avoid an integer divide, which will be slower on | 3593 /* With these routines we avoid an integer divide, which will be slower on |
| 2936 * most machines. However, it does take more operations than the corresponding | 3594 * most machines. However, it does take more operations than the corresponding |
| 2937 * divide method, so it may be slower on a few RISC systems. There are two | 3595 * divide method, so it may be slower on a few RISC systems. There are two |
| 2938 * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. | 3596 * shifts (by 8 or 16 bits) and an addition, versus a single integer divide. |
| 2939 * | 3597 * |
| 2940 * Note that the rounding factors are NOT supposed to be the same! 128 and | 3598 * Note that the rounding factors are NOT supposed to be the same! 128 and |
| 2941 * 32768 are correct for the NODIV code; 127 and 32767 are correct for the | 3599 * 32768 are correct for the NODIV code; 127 and 32767 are correct for the |
| 2942 * standard method. | 3600 * standard method. |
| 2943 * | 3601 * |
| 2944 * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] | 3602 * [Optimized code by Greg Roelofs and Mark Adler...blame us for bugs. :-) ] |
| 2945 */ | 3603 */ |
| 2946 | 3604 |
| 2947 /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ | 3605 /* fg and bg should be in `gamma 1.0' space; alpha is the opacity */ |
| 2948 | 3606 |
| 2949 # define png_composite(composite, fg, alpha, bg) \ | 3607 #define png_composite(composite, fg, alpha, bg) \ |
| 2950 { png_uint_16 temp = (png_uint_16)((png_uint_16)(fg) \ | 3608 { \ |
| 2951 * (png_uint_16)(alpha) \ | 3609 png_uint_16 temp = (png_uint_16)( \ |
| 2952 + (png_uint_16)(bg)*(png_uint_16)(255 \ | 3610 (png_uint_16)(fg) * (png_uint_16)(alpha) + \ |
| 2953 - (png_uint_16)(alpha)) + 128); \ | 3611 (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + 128); \ |
| 2954 (composite) = (png_byte)((temp + (temp >> 8)) >> 8); } | 3612 (composite) = (png_byte)((temp + (temp >> 8)) >> 8); \ |
| 3613 } | |
| 2955 | 3614 |
| 2956 # define png_composite_16(composite, fg, alpha, bg) \ | 3615 #define png_composite_16(composite, fg, alpha, bg) \ |
| 2957 { png_uint_32 temp = (png_uint_32)((png_uint_32)(fg) \ | 3616 { \ |
| 2958 * (png_uint_32)(alpha) \ | 3617 png_uint_32 temp = (png_uint_32)( \ |
| 2959 + (png_uint_32)(bg)*(65535 \ | 3618 (png_uint_32)(fg) * (png_uint_32)(alpha) + \ |
| 2960 - (png_uint_32)(alpha)) + 32768); \ | 3619 (png_uint_32)(bg) * (65535 - (png_uint_32)(alpha)) + 32768); \ |
| 2961 (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); } | 3620 (composite) = (png_uint_16)((temp + (temp >> 16)) >> 16); \ |
| 3621 } | |
| 2962 | 3622 |
| 2963 #else /* Standard method using integer division */ | 3623 #else /* Standard method using integer division */ |
| 2964 | 3624 |
| 2965 # define png_composite(composite, fg, alpha, bg) \ | 3625 #define png_composite(composite, fg, alpha, bg) \ |
| 2966 (composite) = (png_byte)(((png_uint_16)(fg) * (png_uint_16)(alpha) + \ | 3626 (composite) = (png_byte)( \ |
| 2967 (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + \ | 3627 ((png_uint_16)(fg) * (png_uint_16)(alpha) + \ |
| 2968 127) / 255) | 3628 (png_uint_16)(bg) * (png_uint_16)(255 - (png_uint_16)(alpha)) + 127) / \ |
| 3629 255) | |
| 2969 | 3630 |
| 2970 # define png_composite_16(composite, fg, alpha, bg) \ | 3631 #define png_composite_16(composite, fg, alpha, bg) \ |
| 2971 (composite) = (png_uint_16)(((png_uint_32)(fg) * (png_uint_32)(alpha) + \ | 3632 (composite) = (png_uint_16)( \ |
| 2972 (png_uint_32)(bg)*(png_uint_32)(65535 - (png_uint_32)(alpha)) + \ | 3633 ((png_uint_32)(fg) * (png_uint_32)(alpha) + \ |
| 2973 32767) / 65535) | 3634 (png_uint_32)(bg) * (png_uint_32)(65535 - (png_uint_32)(alpha)) + \ |
| 3635 32767) / \ | |
| 3636 65535) | |
| 2974 #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ | 3637 #endif /* PNG_READ_COMPOSITE_NODIV_SUPPORTED */ |
| 2975 | 3638 |
| 2976 #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED | 3639 #ifdef PNG_READ_INT_FUNCTIONS_SUPPORTED |
| 2977 PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf)); | 3640 PNG_EXPORT(201, png_uint_32, png_get_uint_32, (png_const_bytep buf)); |
| 2978 PNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf)); | 3641 PNG_EXPORT(202, png_uint_16, png_get_uint_16, (png_const_bytep buf)); |
| 2979 PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf)); | 3642 PNG_EXPORT(203, png_int_32, png_get_int_32, (png_const_bytep buf)); |
| 2980 #endif | 3643 #endif |
| 2981 | 3644 |
| 2982 PNG_EXPORT(204, png_uint_32, png_get_uint_31, (png_const_structrp png_ptr, | 3645 PNG_EXPORT(204, |
| 2983 png_const_bytep buf)); | 3646 png_uint_32, |
| 3647 png_get_uint_31, | |
| 3648 (png_const_structrp png_ptr, png_const_bytep buf)); | |
| 2984 /* No png_get_int_16 -- may be added if there's a real need for it. */ | 3649 /* No png_get_int_16 -- may be added if there's a real need for it. */ |
| 2985 | 3650 |
| 2986 /* Place a 32-bit number into a buffer in PNG byte order (big-endian). */ | 3651 /* Place a 32-bit number into a buffer in PNG byte order (big-endian). */ |
| 2987 #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED | 3652 #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED |
| 2988 PNG_EXPORT(205, void, png_save_uint_32, (png_bytep buf, png_uint_32 i)); | 3653 PNG_EXPORT(205, void, png_save_uint_32, (png_bytep buf, png_uint_32 i)); |
| 2989 #endif | 3654 #endif |
| 2990 #ifdef PNG_SAVE_INT_32_SUPPORTED | 3655 #ifdef PNG_SAVE_INT_32_SUPPORTED |
| 2991 PNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i)); | 3656 PNG_EXPORT(206, void, png_save_int_32, (png_bytep buf, png_int_32 i)); |
| 2992 #endif | 3657 #endif |
| 2993 | 3658 |
| 2994 /* Place a 16-bit number into a buffer in PNG byte order. | 3659 /* Place a 16-bit number into a buffer in PNG byte order. |
| 2995 * The parameter is declared unsigned int, not png_uint_16, | 3660 * The parameter is declared unsigned int, not png_uint_16, |
| 2996 * just to avoid potential problems on pre-ANSI C compilers. | 3661 * just to avoid potential problems on pre-ANSI C compilers. |
| 2997 */ | 3662 */ |
| 2998 #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED | 3663 #ifdef PNG_WRITE_INT_FUNCTIONS_SUPPORTED |
| 2999 PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); | 3664 PNG_EXPORT(207, void, png_save_uint_16, (png_bytep buf, unsigned int i)); |
| 3000 /* No png_save_int_16 -- may be added if there's a real need for it. */ | 3665 /* No png_save_int_16 -- may be added if there's a real need for it. */ |
| 3001 #endif | 3666 #endif |
| 3002 | 3667 |
| 3003 #ifdef PNG_USE_READ_MACROS | 3668 #ifdef PNG_USE_READ_MACROS |
| 3004 /* Inline macros to do direct reads of bytes from the input buffer. | 3669 /* Inline macros to do direct reads of bytes from the input buffer. |
| 3005 * The png_get_int_32() routine assumes we are using two's complement | 3670 * The png_get_int_32() routine assumes we are using two's complement |
| 3006 * format for negative values, which is almost certainly true. | 3671 * format for negative values, which is almost certainly true. |
| 3007 */ | 3672 */ |
| 3008 # define PNG_get_uint_32(buf) \ | 3673 #define PNG_get_uint_32(buf) \ |
| 3009 (((png_uint_32)(*(buf)) << 24) + \ | 3674 (((png_uint_32)(*(buf)) << 24) + ((png_uint_32)(*((buf) + 1)) << 16) + \ |
| 3010 ((png_uint_32)(*((buf) + 1)) << 16) + \ | 3675 ((png_uint_32)(*((buf) + 2)) << 8) + ((png_uint_32)(*((buf) + 3)))) |
| 3011 ((png_uint_32)(*((buf) + 2)) << 8) + \ | |
| 3012 ((png_uint_32)(*((buf) + 3)))) | |
| 3013 | 3676 |
| 3014 /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the | 3677 /* From libpng-1.4.0 until 1.4.4, the png_get_uint_16 macro (but not the |
| 3015 * function) incorrectly returned a value of type png_uint_32. | 3678 * function) incorrectly returned a value of type png_uint_32. |
| 3016 */ | 3679 */ |
| 3017 # define PNG_get_uint_16(buf) \ | 3680 #define PNG_get_uint_16(buf) \ |
| 3018 ((png_uint_16) \ | 3681 ((png_uint_16)(((unsigned int)(*(buf)) << 8) + \ |
| 3019 (((unsigned int)(*(buf)) << 8) + \ | 3682 ((unsigned int)(*((buf) + 1))))) |
| 3020 ((unsigned int)(*((buf) + 1))))) | |
| 3021 | 3683 |
| 3022 # define PNG_get_int_32(buf) \ | 3684 #define PNG_get_int_32(buf) \ |
| 3023 ((png_int_32)((*(buf) & 0x80) \ | 3685 ((png_int_32)( \ |
| 3024 ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \ | 3686 (*(buf)&0x80) \ |
| 3025 : (png_int_32)png_get_uint_32(buf))) | 3687 ? -((png_int_32)((png_get_uint_32(buf) ^ 0xffffffffL) + 1)) \ |
| 3688 : (png_int_32)png_get_uint_32(buf))) | |
| 3026 | 3689 |
| 3027 /* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h, | 3690 /* If PNG_PREFIX is defined the same thing as below happens in pnglibconf.h, |
| 3028 * but defining a macro name prefixed with PNG_PREFIX. | 3691 * but defining a macro name prefixed with PNG_PREFIX. |
| 3029 */ | 3692 */ |
| 3030 # ifndef PNG_PREFIX | 3693 #ifndef PNG_PREFIX |
| 3031 # define png_get_uint_32(buf) PNG_get_uint_32(buf) | 3694 #define png_get_uint_32(buf) PNG_get_uint_32(buf) |
| 3032 # define png_get_uint_16(buf) PNG_get_uint_16(buf) | 3695 #define png_get_uint_16(buf) PNG_get_uint_16(buf) |
| 3033 # define png_get_int_32(buf) PNG_get_int_32(buf) | 3696 #define png_get_int_32(buf) PNG_get_int_32(buf) |
| 3034 # endif | 3697 #endif |
| 3035 #else | 3698 #else |
| 3036 # ifdef PNG_PREFIX | 3699 #ifdef PNG_PREFIX |
| 3037 /* No macros; revert to the (redefined) function */ | 3700 /* No macros; revert to the (redefined) function */ |
| 3038 # define PNG_get_uint_32 (png_get_uint_32) | 3701 #define PNG_get_uint_32 (png_get_uint_32) |
| 3039 # define PNG_get_uint_16 (png_get_uint_16) | 3702 #define PNG_get_uint_16 (png_get_uint_16) |
| 3040 # define PNG_get_int_32 (png_get_int_32) | 3703 #define PNG_get_int_32 (png_get_int_32) |
| 3041 # endif | 3704 #endif |
| 3042 #endif | 3705 #endif |
| 3043 | 3706 |
| 3044 /******************************************************************************* | 3707 /******************************************************************************* |
| 3045 * SIMPLIFIED API | 3708 * SIMPLIFIED API |
| 3046 ******************************************************************************* | 3709 ******************************************************************************* |
| 3047 * | 3710 * |
| 3048 * Please read the documentation in libpng-manual.txt (TODO: write said | 3711 * Please read the documentation in libpng-manual.txt (TODO: write said |
| 3049 * documentation) if you don't understand what follows. | 3712 * documentation) if you don't understand what follows. |
| 3050 * | 3713 * |
| 3051 * The simplified API hides the details of both libpng and the PNG file format | 3714 * The simplified API hides the details of both libpng and the PNG file format |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 3081 * the 'format' member to the format of the image samples. | 3744 * the 'format' member to the format of the image samples. |
| 3082 * 3) Call the appropriate png_image_write... function with a pointer to the | 3745 * 3) Call the appropriate png_image_write... function with a pointer to the |
| 3083 * image and, if necessary, the color-map to write the PNG data. | 3746 * image and, if necessary, the color-map to write the PNG data. |
| 3084 * | 3747 * |
| 3085 * png_image is a structure that describes the in-memory format of an image | 3748 * png_image is a structure that describes the in-memory format of an image |
| 3086 * when it is being read or defines the in-memory format of an image that you | 3749 * when it is being read or defines the in-memory format of an image that you |
| 3087 * need to write: | 3750 * need to write: |
| 3088 */ | 3751 */ |
| 3089 #define PNG_IMAGE_VERSION 1 | 3752 #define PNG_IMAGE_VERSION 1 |
| 3090 | 3753 |
| 3091 typedef struct png_control *png_controlp; | 3754 typedef struct png_control* png_controlp; |
| 3092 typedef struct | 3755 typedef struct { |
| 3093 { | 3756 png_controlp opaque; /* Initialize to NULL, free with png_image_free */ |
| 3094 png_controlp opaque; /* Initialize to NULL, free with png_image_free */ | 3757 png_uint_32 version; /* Set to PNG_IMAGE_VERSION */ |
| 3095 png_uint_32 version; /* Set to PNG_IMAGE_VERSION */ | 3758 png_uint_32 width; /* Image width in pixels (columns) */ |
| 3096 png_uint_32 width; /* Image width in pixels (columns) */ | 3759 png_uint_32 height; /* Image height in pixels (rows) */ |
| 3097 png_uint_32 height; /* Image height in pixels (rows) */ | 3760 png_uint_32 format; /* Image format as defined below */ |
| 3098 png_uint_32 format; /* Image format as defined below */ | 3761 png_uint_32 flags; /* A bit mask containing informational flags */ |
| 3099 png_uint_32 flags; /* A bit mask containing informational flags */ | 3762 png_uint_32 colormap_entries; |
| 3100 png_uint_32 colormap_entries; | 3763 /* Number of entries in the color-map */ |
| 3101 /* Number of entries in the color-map */ | |
| 3102 | 3764 |
| 3103 /* In the event of an error or warning the following field will be set to a | 3765 /* In the event of an error or warning the following field will be set to a |
| 3104 * non-zero value and the 'message' field will contain a '\0' terminated | 3766 * non-zero value and the 'message' field will contain a '\0' terminated |
| 3105 * string with the libpng error or warning message. If both warnings and | 3767 * string with the libpng error or warning message. If both warnings and |
| 3106 * an error were encountered, only the error is recorded. If there | 3768 * an error were encountered, only the error is recorded. If there |
| 3107 * are multiple warnings, only the first one is recorded. | 3769 * are multiple warnings, only the first one is recorded. |
| 3108 * | 3770 * |
| 3109 * The upper 30 bits of this value are reserved, the low two bits contain | 3771 * The upper 30 bits of this value are reserved, the low two bits contain |
| 3110 * a value as follows: | 3772 * a value as follows: |
| 3111 */ | 3773 */ |
| 3112 # define PNG_IMAGE_WARNING 1 | 3774 #define PNG_IMAGE_WARNING 1 |
| 3113 # define PNG_IMAGE_ERROR 2 | 3775 #define PNG_IMAGE_ERROR 2 |
| 3114 /* | 3776 /* |
| 3115 * The result is a two bit code such that a value more than 1 indicates | 3777 * The result is a two bit code such that a value more than 1 indicates |
| 3116 * a failure in the API just called: | 3778 * a failure in the API just called: |
| 3117 * | 3779 * |
| 3118 * 0 - no warning or error | 3780 * 0 - no warning or error |
| 3119 * 1 - warning | 3781 * 1 - warning |
| 3120 * 2 - error | 3782 * 2 - error |
| 3121 * 3 - error preceded by warning | 3783 * 3 - error preceded by warning |
| 3122 */ | 3784 */ |
| 3123 # define PNG_IMAGE_FAILED(png_cntrl) ((((png_cntrl).warning_or_error)&0x03)>1) | 3785 #define PNG_IMAGE_FAILED(png_cntrl) \ |
| 3786 ((((png_cntrl).warning_or_error) & 0x03) > 1) | |
| 3124 | 3787 |
| 3125 png_uint_32 warning_or_error; | 3788 png_uint_32 warning_or_error; |
| 3126 | 3789 |
| 3127 char message[64]; | 3790 char message[64]; |
| 3128 } png_image, *png_imagep; | 3791 } png_image, *png_imagep; |
| 3129 | 3792 |
| 3130 /* The samples of the image have one to four channels whose components have | 3793 /* The samples of the image have one to four channels whose components have |
| 3131 * original values in the range 0 to 1.0: | 3794 * original values in the range 0 to 1.0: |
| 3132 * | 3795 * |
| 3133 * 1: A single gray or luminance channel (G). | 3796 * 1: A single gray or luminance channel (G). |
| 3134 * 2: A gray/luminance channel and an alpha channel (GA). | 3797 * 2: A gray/luminance channel and an alpha channel (GA). |
| 3135 * 3: Three red, green, blue color channels (RGB). | 3798 * 3: Three red, green, blue color channels (RGB). |
| 3136 * 4: Three color channels and an alpha channel (RGBA). | 3799 * 4: Three color channels and an alpha channel (RGBA). |
| 3137 * | 3800 * |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3188 * NOTE: libpng can be built with particular features disabled, if you see | 3851 * NOTE: libpng can be built with particular features disabled, if you see |
| 3189 * compiler errors because the definition of one of the following flags has been | 3852 * compiler errors because the definition of one of the following flags has been |
| 3190 * compiled out it is because libpng does not have the required support. It is | 3853 * compiled out it is because libpng does not have the required support. It is |
| 3191 * possible, however, for the libpng configuration to enable the format on just | 3854 * possible, however, for the libpng configuration to enable the format on just |
| 3192 * read or just write; in that case you may see an error at run time. You can | 3855 * read or just write; in that case you may see an error at run time. You can |
| 3193 * guard against this by checking for the definition of the appropriate | 3856 * guard against this by checking for the definition of the appropriate |
| 3194 * "_SUPPORTED" macro, one of: | 3857 * "_SUPPORTED" macro, one of: |
| 3195 * | 3858 * |
| 3196 * PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED | 3859 * PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED |
| 3197 */ | 3860 */ |
| 3198 #define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */ | 3861 #define PNG_FORMAT_FLAG_ALPHA 0x01U /* format with an alpha channel */ |
| 3199 #define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */ | 3862 #define PNG_FORMAT_FLAG_COLOR 0x02U /* color format: otherwise grayscale */ |
| 3200 #define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2 byte channels else 1 byte */ | 3863 #define PNG_FORMAT_FLAG_LINEAR 0x04U /* 2 byte channels else 1 byte */ |
| 3201 #define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */ | 3864 #define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */ |
| 3202 | 3865 |
| 3203 #ifdef PNG_FORMAT_BGR_SUPPORTED | 3866 #ifdef PNG_FORMAT_BGR_SUPPORTED |
| 3204 # define PNG_FORMAT_FLAG_BGR 0x10U /* BGR colors, else order is RGB */ | 3867 #define PNG_FORMAT_FLAG_BGR 0x10U /* BGR colors, else order is RGB */ |
| 3205 #endif | 3868 #endif |
| 3206 | 3869 |
| 3207 #ifdef PNG_FORMAT_AFIRST_SUPPORTED | 3870 #ifdef PNG_FORMAT_AFIRST_SUPPORTED |
| 3208 # define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */ | 3871 #define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */ |
| 3209 #endif | 3872 #endif |
| 3210 | 3873 |
| 3211 /* Commonly used formats have predefined macros. | 3874 /* Commonly used formats have predefined macros. |
| 3212 * | 3875 * |
| 3213 * First the single byte (sRGB) formats: | 3876 * First the single byte (sRGB) formats: |
| 3214 */ | 3877 */ |
| 3215 #define PNG_FORMAT_GRAY 0 | 3878 #define PNG_FORMAT_GRAY 0 |
| 3216 #define PNG_FORMAT_GA PNG_FORMAT_FLAG_ALPHA | 3879 #define PNG_FORMAT_GA PNG_FORMAT_FLAG_ALPHA |
| 3217 #define PNG_FORMAT_AG (PNG_FORMAT_GA|PNG_FORMAT_FLAG_AFIRST) | 3880 #define PNG_FORMAT_AG (PNG_FORMAT_GA | PNG_FORMAT_FLAG_AFIRST) |
| 3218 #define PNG_FORMAT_RGB PNG_FORMAT_FLAG_COLOR | 3881 #define PNG_FORMAT_RGB PNG_FORMAT_FLAG_COLOR |
| 3219 #define PNG_FORMAT_BGR (PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_BGR) | 3882 #define PNG_FORMAT_BGR (PNG_FORMAT_FLAG_COLOR | PNG_FORMAT_FLAG_BGR) |
| 3220 #define PNG_FORMAT_RGBA (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_ALPHA) | 3883 #define PNG_FORMAT_RGBA (PNG_FORMAT_RGB | PNG_FORMAT_FLAG_ALPHA) |
| 3221 #define PNG_FORMAT_ARGB (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_AFIRST) | 3884 #define PNG_FORMAT_ARGB (PNG_FORMAT_RGBA | PNG_FORMAT_FLAG_AFIRST) |
| 3222 #define PNG_FORMAT_BGRA (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_ALPHA) | 3885 #define PNG_FORMAT_BGRA (PNG_FORMAT_BGR | PNG_FORMAT_FLAG_ALPHA) |
| 3223 #define PNG_FORMAT_ABGR (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_AFIRST) | 3886 #define PNG_FORMAT_ABGR (PNG_FORMAT_BGRA | PNG_FORMAT_FLAG_AFIRST) |
| 3224 | 3887 |
| 3225 /* Then the linear 2-byte formats. When naming these "Y" is used to | 3888 /* Then the linear 2-byte formats. When naming these "Y" is used to |
| 3226 * indicate a luminance (gray) channel. | 3889 * indicate a luminance (gray) channel. |
| 3227 */ | 3890 */ |
| 3228 #define PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR | 3891 #define PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR |
| 3229 #define PNG_FORMAT_LINEAR_Y_ALPHA (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_ALPHA) | 3892 #define PNG_FORMAT_LINEAR_Y_ALPHA \ |
| 3230 #define PNG_FORMAT_LINEAR_RGB (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR) | 3893 (PNG_FORMAT_FLAG_LINEAR | PNG_FORMAT_FLAG_ALPHA) |
| 3894 #define PNG_FORMAT_LINEAR_RGB (PNG_FORMAT_FLAG_LINEAR | PNG_FORMAT_FLAG_COLOR) | |
| 3231 #define PNG_FORMAT_LINEAR_RGB_ALPHA \ | 3895 #define PNG_FORMAT_LINEAR_RGB_ALPHA \ |
| 3232 (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA) | 3896 (PNG_FORMAT_FLAG_LINEAR | PNG_FORMAT_FLAG_COLOR | PNG_FORMAT_FLAG_ALPHA) |
| 3233 | 3897 |
| 3234 /* With color-mapped formats the image data is one byte for each pixel, the byte | 3898 /* With color-mapped formats the image data is one byte for each pixel, the byte |
| 3235 * is an index into the color-map which is formatted as above. To obtain a | 3899 * is an index into the color-map which is formatted as above. To obtain a |
| 3236 * color-mapped format it is sufficient just to add the PNG_FOMAT_FLAG_COLORMAP | 3900 * color-mapped format it is sufficient just to add the PNG_FOMAT_FLAG_COLORMAP |
| 3237 * to one of the above definitions, or you can use one of the definitions below. | 3901 * to one of the above definitions, or you can use one of the definitions below. |
| 3238 */ | 3902 */ |
| 3239 #define PNG_FORMAT_RGB_COLORMAP (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_COLORMAP) | 3903 #define PNG_FORMAT_RGB_COLORMAP (PNG_FORMAT_RGB | PNG_FORMAT_FLAG_COLORMAP) |
| 3240 #define PNG_FORMAT_BGR_COLORMAP (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_COLORMAP) | 3904 #define PNG_FORMAT_BGR_COLORMAP (PNG_FORMAT_BGR | PNG_FORMAT_FLAG_COLORMAP) |
| 3241 #define PNG_FORMAT_RGBA_COLORMAP (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_COLORMAP) | 3905 #define PNG_FORMAT_RGBA_COLORMAP (PNG_FORMAT_RGBA | PNG_FORMAT_FLAG_COLORMAP) |
| 3242 #define PNG_FORMAT_ARGB_COLORMAP (PNG_FORMAT_ARGB|PNG_FORMAT_FLAG_COLORMAP) | 3906 #define PNG_FORMAT_ARGB_COLORMAP (PNG_FORMAT_ARGB | PNG_FORMAT_FLAG_COLORMAP) |
| 3243 #define PNG_FORMAT_BGRA_COLORMAP (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_COLORMAP) | 3907 #define PNG_FORMAT_BGRA_COLORMAP (PNG_FORMAT_BGRA | PNG_FORMAT_FLAG_COLORMAP) |
| 3244 #define PNG_FORMAT_ABGR_COLORMAP (PNG_FORMAT_ABGR|PNG_FORMAT_FLAG_COLORMAP) | 3908 #define PNG_FORMAT_ABGR_COLORMAP (PNG_FORMAT_ABGR | PNG_FORMAT_FLAG_COLORMAP) |
| 3245 | 3909 |
| 3246 /* PNG_IMAGE macros | 3910 /* PNG_IMAGE macros |
| 3247 * | 3911 * |
| 3248 * These are convenience macros to derive information from a png_image | 3912 * These are convenience macros to derive information from a png_image |
| 3249 * structure. The PNG_IMAGE_SAMPLE_ macros return values appropriate to the | 3913 * structure. The PNG_IMAGE_SAMPLE_ macros return values appropriate to the |
| 3250 * actual image sample values - either the entries in the color-map or the | 3914 * actual image sample values - either the entries in the color-map or the |
| 3251 * pixels in the image. The PNG_IMAGE_PIXEL_ macros return corresponding values | 3915 * pixels in the image. The PNG_IMAGE_PIXEL_ macros return corresponding values |
| 3252 * for the pixels and will always return 1 for color-mapped formats. The | 3916 * for the pixels and will always return 1 for color-mapped formats. The |
| 3253 * remaining macros return information about the rows in the image and the | 3917 * remaining macros return information about the rows in the image and the |
| 3254 * complete image. | 3918 * complete image. |
| 3255 * | 3919 * |
| 3256 * NOTE: All the macros that take a png_image::format parameter are compile time | 3920 * NOTE: All the macros that take a png_image::format parameter are compile time |
| 3257 * constants if the format parameter is, itself, a constant. Therefore these | 3921 * constants if the format parameter is, itself, a constant. Therefore these |
| 3258 * macros can be used in array declarations and case labels where required. | 3922 * macros can be used in array declarations and case labels where required. |
| 3259 * Similarly the macros are also pre-processor constants (sizeof is not used) so | 3923 * Similarly the macros are also pre-processor constants (sizeof is not used) so |
| 3260 * they can be used in #if tests. | 3924 * they can be used in #if tests. |
| 3261 * | 3925 * |
| 3262 * First the information about the samples. | 3926 * First the information about the samples. |
| 3263 */ | 3927 */ |
| 3264 #define PNG_IMAGE_SAMPLE_CHANNELS(fmt)\ | 3928 #define PNG_IMAGE_SAMPLE_CHANNELS(fmt) \ |
| 3265 (((fmt)&(PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_ALPHA))+1) | 3929 (((fmt) & (PNG_FORMAT_FLAG_COLOR | PNG_FORMAT_FLAG_ALPHA)) + 1) |
| 3266 /* Return the total number of channels in a given format: 1..4 */ | 3930 /* Return the total number of channels in a given format: 1..4 */ |
| 3267 | 3931 |
| 3268 #define PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt)\ | 3932 #define PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt) \ |
| 3269 ((((fmt) & PNG_FORMAT_FLAG_LINEAR) >> 2)+1) | 3933 ((((fmt)&PNG_FORMAT_FLAG_LINEAR) >> 2) + 1) |
| 3270 /* Return the size in bytes of a single component of a pixel or color-map | 3934 /* Return the size in bytes of a single component of a pixel or color-map |
| 3271 * entry (as appropriate) in the image: 1 or 2. | 3935 * entry (as appropriate) in the image: 1 or 2. |
| 3272 */ | 3936 */ |
| 3273 | 3937 |
| 3274 #define PNG_IMAGE_SAMPLE_SIZE(fmt)\ | 3938 #define PNG_IMAGE_SAMPLE_SIZE(fmt) \ |
| 3275 (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt)) | 3939 (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * PNG_IMAGE_SAMPLE_COMPONENT_SIZE(fmt)) |
| 3276 /* This is the size of the sample data for one sample. If the image is | 3940 /* This is the size of the sample data for one sample. If the image is |
| 3277 * color-mapped it is the size of one color-map entry (and image pixels are | 3941 * color-mapped it is the size of one color-map entry (and image pixels are |
| 3278 * one byte in size), otherwise it is the size of one image pixel. | 3942 * one byte in size), otherwise it is the size of one image pixel. |
| 3279 */ | 3943 */ |
| 3280 | 3944 |
| 3281 #define PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(fmt)\ | 3945 #define PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(fmt) \ |
| 3282 (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * 256) | 3946 (PNG_IMAGE_SAMPLE_CHANNELS(fmt) * 256) |
| 3283 /* The maximum size of the color-map required by the format expressed in a | 3947 /* The maximum size of the color-map required by the format expressed in a |
| 3284 * count of components. This can be used to compile-time allocate a | 3948 * count of components. This can be used to compile-time allocate a |
| 3285 * color-map: | 3949 * color-map: |
| 3286 * | 3950 * |
| 3287 * png_uint_16 colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(linear_fmt)]; | 3951 * png_uint_16 colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(linear_fmt)]; |
| 3288 * | 3952 * |
| 3289 * png_byte colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(sRGB_fmt)]; | 3953 * png_byte colormap[PNG_IMAGE_MAXIMUM_COLORMAP_COMPONENTS(sRGB_fmt)]; |
| 3290 * | 3954 * |
| 3291 * Alternatively use the PNG_IMAGE_COLORMAP_SIZE macro below to use the | 3955 * Alternatively use the PNG_IMAGE_COLORMAP_SIZE macro below to use the |
| 3292 * information from one of the png_image_begin_read_ APIs and dynamically | 3956 * information from one of the png_image_begin_read_ APIs and dynamically |
| 3293 * allocate the required memory. | 3957 * allocate the required memory. |
| 3294 */ | 3958 */ |
| 3295 | 3959 |
| 3296 /* Corresponding information about the pixels */ | 3960 /* Corresponding information about the pixels */ |
| 3297 #define PNG_IMAGE_PIXEL_(test,fmt)\ | 3961 #define PNG_IMAGE_PIXEL_(test, fmt) \ |
| 3298 (((fmt)&PNG_FORMAT_FLAG_COLORMAP)?1:test(fmt)) | 3962 (((fmt)&PNG_FORMAT_FLAG_COLORMAP) ? 1 : test(fmt)) |
| 3299 | 3963 |
| 3300 #define PNG_IMAGE_PIXEL_CHANNELS(fmt)\ | 3964 #define PNG_IMAGE_PIXEL_CHANNELS(fmt) \ |
| 3301 PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_CHANNELS,fmt) | 3965 PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_CHANNELS, fmt) |
| 3302 /* The number of separate channels (components) in a pixel; 1 for a | 3966 /* The number of separate channels (components) in a pixel; 1 for a |
| 3303 * color-mapped image. | 3967 * color-mapped image. |
| 3304 */ | 3968 */ |
| 3305 | 3969 |
| 3306 #define PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt)\ | 3970 #define PNG_IMAGE_PIXEL_COMPONENT_SIZE(fmt) \ |
| 3307 PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_COMPONENT_SIZE,fmt) | 3971 PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_COMPONENT_SIZE, fmt) |
| 3308 /* The size, in bytes, of each component in a pixel; 1 for a color-mapped | 3972 /* The size, in bytes, of each component in a pixel; 1 for a color-mapped |
| 3309 * image. | 3973 * image. |
| 3310 */ | 3974 */ |
| 3311 | 3975 |
| 3312 #define PNG_IMAGE_PIXEL_SIZE(fmt) PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_SIZE,fmt) | 3976 #define PNG_IMAGE_PIXEL_SIZE(fmt) PNG_IMAGE_PIXEL_(PNG_IMAGE_SAMPLE_SIZE, fmt) |
| 3313 /* The size, in bytes, of a complete pixel; 1 for a color-mapped image. */ | 3977 /* The size, in bytes, of a complete pixel; 1 for a color-mapped image. */ |
| 3314 | 3978 |
| 3315 /* Information about the whole row, or whole image */ | 3979 /* Information about the whole row, or whole image */ |
| 3316 #define PNG_IMAGE_ROW_STRIDE(image)\ | 3980 #define PNG_IMAGE_ROW_STRIDE(image) \ |
| 3317 (PNG_IMAGE_PIXEL_CHANNELS((image).format) * (image).width) | 3981 (PNG_IMAGE_PIXEL_CHANNELS((image).format) * (image).width) |
| 3318 /* Return the total number of components in a single row of the image; this | 3982 /* Return the total number of components in a single row of the image; this |
| 3319 * is the minimum 'row stride', the minimum count of components between each | 3983 * is the minimum 'row stride', the minimum count of components between each |
| 3320 * row. For a color-mapped image this is the minimum number of bytes in a | 3984 * row. For a color-mapped image this is the minimum number of bytes in a |
| 3321 * row. | 3985 * row. |
| 3322 */ | 3986 */ |
| 3323 | 3987 |
| 3324 #define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\ | 3988 #define PNG_IMAGE_BUFFER_SIZE(image, row_stride) \ |
| 3325 (PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride)) | 3989 (PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format) * (image).height * \ |
| 3326 /* Return the size, in bytes, of an image buffer given a png_image and a row | 3990 (row_stride)) |
| 3327 * stride - the number of components to leave space for in each row. | 3991 /* Return the size, in bytes, of an image buffer given a png_image and a row |
| 3328 */ | 3992 * stride - the number of components to leave space for in each row. |
| 3993 */ | |
| 3329 | 3994 |
| 3330 #define PNG_IMAGE_SIZE(image)\ | 3995 #define PNG_IMAGE_SIZE(image) \ |
| 3331 PNG_IMAGE_BUFFER_SIZE(image, PNG_IMAGE_ROW_STRIDE(image)) | 3996 PNG_IMAGE_BUFFER_SIZE(image, PNG_IMAGE_ROW_STRIDE(image)) |
| 3332 /* Return the size, in bytes, of the image in memory given just a png_image; | 3997 /* Return the size, in bytes, of the image in memory given just a png_image; |
| 3333 * the row stride is the minimum stride required for the image. | 3998 * the row stride is the minimum stride required for the image. |
| 3334 */ | 3999 */ |
| 3335 | 4000 |
| 3336 #define PNG_IMAGE_COLORMAP_SIZE(image)\ | 4001 #define PNG_IMAGE_COLORMAP_SIZE(image) \ |
| 3337 (PNG_IMAGE_SAMPLE_SIZE((image).format) * (image).colormap_entries) | 4002 (PNG_IMAGE_SAMPLE_SIZE((image).format) * (image).colormap_entries) |
| 3338 /* Return the size, in bytes, of the color-map of this image. If the image | 4003 /* Return the size, in bytes, of the color-map of this image. If the image |
| 3339 * format is not a color-map format this will return a size sufficient for | 4004 * format is not a color-map format this will return a size sufficient for |
| 3340 * 256 entries in the given format; check PNG_FORMAT_FLAG_COLORMAP if | 4005 * 256 entries in the given format; check PNG_FORMAT_FLAG_COLORMAP if |
| 3341 * you don't want to allocate a color-map in this case. | 4006 * you don't want to allocate a color-map in this case. |
| 3342 */ | 4007 */ |
| 3343 | 4008 |
| 3344 /* PNG_IMAGE_FLAG_* | 4009 /* PNG_IMAGE_FLAG_* |
| 3345 * | 4010 * |
| 3346 * Flags containing additional information about the image are held in the | 4011 * Flags containing additional information about the image are held in the |
| 3347 * 'flags' field of png_image. | 4012 * 'flags' field of png_image. |
| 3348 */ | 4013 */ |
| 3349 #define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01 | 4014 #define PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB 0x01 |
| 3350 /* This indicates the the RGB values of the in-memory bitmap do not | 4015 /* This indicates the the RGB values of the in-memory bitmap do not |
| 3351 * correspond to the red, green and blue end-points defined by sRGB. | 4016 * correspond to the red, green and blue end-points defined by sRGB. |
| 3352 */ | 4017 */ |
| 3353 | 4018 |
| 3354 #define PNG_IMAGE_FLAG_FAST 0x02 | 4019 #define PNG_IMAGE_FLAG_FAST 0x02 |
| 3355 /* On write emphasise speed over compression; the resultant PNG file will be | 4020 /* On write emphasise speed over compression; the resultant PNG file will be |
| 3356 * larger but will be produced significantly faster, particular for large | 4021 * larger but will be produced significantly faster, particular for large |
| 3357 * images. Do not use this option for images which will be distributed, only | 4022 * images. Do not use this option for images which will be distributed, only |
| 3358 * used it when producing intermediate files that will be read back in | 4023 * used it when producing intermediate files that will be read back in |
| 3359 * repeatedly. For a typical 24-bit image the option will double the read | 4024 * repeatedly. For a typical 24-bit image the option will double the read |
| 3360 * speed at the cost of increasing the image size by 25%, however for many | 4025 * speed at the cost of increasing the image size by 25%, however for many |
| 3361 * more compressible images the PNG file can be 10 times larger with only a | 4026 * more compressible images the PNG file can be 10 times larger with only a |
| 3362 * slight speed gain. | 4027 * slight speed gain. |
| 3363 */ | 4028 */ |
| 3364 | 4029 |
| 3365 #define PNG_IMAGE_FLAG_16BIT_sRGB 0x04 | 4030 #define PNG_IMAGE_FLAG_16BIT_sRGB 0x04 |
| 3366 /* On read if the image is a 16-bit per component image and there is no gAMA | 4031 /* On read if the image is a 16-bit per component image and there is no gAMA |
| 3367 * or sRGB chunk assume that the components are sRGB encoded. Notice that | 4032 * or sRGB chunk assume that the components are sRGB encoded. Notice that |
| 3368 * images output by the simplified API always have gamma information; setting | 4033 * images output by the simplified API always have gamma information; setting |
| 3369 * this flag only affects the interpretation of 16-bit images from an | 4034 * this flag only affects the interpretation of 16-bit images from an |
| 3370 * external source. It is recommended that the application expose this flag | 4035 * external source. It is recommended that the application expose this flag |
| 3371 * to the user; the user can normally easily recognize the difference between | 4036 * to the user; the user can normally easily recognize the difference between |
| 3372 * linear and sRGB encoding. This flag has no effect on write - the data | 4037 * linear and sRGB encoding. This flag has no effect on write - the data |
| 3373 * passed to the write APIs must have the correct encoding (as defined | 4038 * passed to the write APIs must have the correct encoding (as defined |
| 3374 * above.) | 4039 * above.) |
| 3375 * | 4040 * |
| 3376 * If the flag is not set (the default) input 16-bit per component data is | 4041 * If the flag is not set (the default) input 16-bit per component data is |
| 3377 * assumed to be linear. | 4042 * assumed to be linear. |
| 3378 * | 4043 * |
| 3379 * NOTE: the flag can only be set after the png_image_begin_read_ call, | 4044 * NOTE: the flag can only be set after the png_image_begin_read_ call, |
| 3380 * because that call initializes the 'flags' field. | 4045 * because that call initializes the 'flags' field. |
| 3381 */ | 4046 */ |
| 3382 | 4047 |
| 3383 #ifdef PNG_SIMPLIFIED_READ_SUPPORTED | 4048 #ifdef PNG_SIMPLIFIED_READ_SUPPORTED |
| 3384 /* READ APIs | 4049 /* READ APIs |
| 3385 * --------- | 4050 * --------- |
| 3386 * | 4051 * |
| 3387 * The png_image passed to the read APIs must have been initialized by setting | 4052 * The png_image passed to the read APIs must have been initialized by setting |
| 3388 * the png_controlp field 'opaque' to NULL (or, safer, memset the whole thing.) | 4053 * the png_controlp field 'opaque' to NULL (or, safer, memset the whole thing.) |
| 3389 */ | 4054 */ |
| 3390 #ifdef PNG_STDIO_SUPPORTED | 4055 #ifdef PNG_STDIO_SUPPORTED |
| 3391 PNG_EXPORT(234, int, png_image_begin_read_from_file, (png_imagep image, | 4056 PNG_EXPORT(234, |
| 3392 const char *file_name)); | 4057 int, |
| 3393 /* The named file is opened for read and the image header is filled in | 4058 png_image_begin_read_from_file, |
| 3394 * from the PNG header in the file. | 4059 (png_imagep image, const char* file_name)); |
| 3395 */ | 4060 /* The named file is opened for read and the image header is filled in |
| 4061 * from the PNG header in the file. | |
| 4062 */ | |
| 3396 | 4063 |
| 3397 PNG_EXPORT(235, int, png_image_begin_read_from_stdio, (png_imagep image, | 4064 PNG_EXPORT(235, |
| 3398 FILE* file)); | 4065 int, |
| 3399 /* The PNG header is read from the stdio FILE object. */ | 4066 png_image_begin_read_from_stdio, |
| 4067 (png_imagep image, FILE* file)); | |
| 4068 /* The PNG header is read from the stdio FILE object. */ | |
| 3400 #endif /* PNG_STDIO_SUPPORTED */ | 4069 #endif /* PNG_STDIO_SUPPORTED */ |
| 3401 | 4070 |
| 3402 PNG_EXPORT(236, int, png_image_begin_read_from_memory, (png_imagep image, | 4071 PNG_EXPORT(236, |
| 3403 png_const_voidp memory, png_size_t size)); | 4072 int, |
| 3404 /* The PNG header is read from the given memory buffer. */ | 4073 png_image_begin_read_from_memory, |
| 4074 (png_imagep image, png_const_voidp memory, png_size_t size)); | |
| 4075 /* The PNG header is read from the given memory buffer. */ | |
| 3405 | 4076 |
| 3406 PNG_EXPORT(237, int, png_image_finish_read, (png_imagep image, | 4077 PNG_EXPORT(237, |
| 3407 png_const_colorp background, void *buffer, png_int_32 row_stride, | 4078 int, |
| 3408 void *colormap)); | 4079 png_image_finish_read, |
| 3409 /* Finish reading the image into the supplied buffer and clean up the | 4080 (png_imagep image, |
| 3410 * png_image structure. | 4081 png_const_colorp background, |
| 3411 * | 4082 void* buffer, |
| 3412 * row_stride is the step, in byte or 2-byte units as appropriate, | 4083 png_int_32 row_stride, |
| 3413 * between adjacent rows. A positive stride indicates that the top-most row | 4084 void* colormap)); |
| 3414 * is first in the buffer - the normal top-down arrangement. A negative | 4085 /* Finish reading the image into the supplied buffer and clean up the |
| 3415 * stride indicates that the bottom-most row is first in the buffer. | 4086 * png_image structure. |
| 3416 * | 4087 * |
| 3417 * background need only be supplied if an alpha channel must be removed from | 4088 * row_stride is the step, in byte or 2-byte units as appropriate, |
| 3418 * a png_byte format and the removal is to be done by compositing on a solid | 4089 * between adjacent rows. A positive stride indicates that the top-most row |
| 3419 * color; otherwise it may be NULL and any composition will be done directly | 4090 * is first in the buffer - the normal top-down arrangement. A negative |
| 3420 * onto the buffer. The value is an sRGB color to use for the background, | 4091 * stride indicates that the bottom-most row is first in the buffer. |
| 3421 * for grayscale output the green channel is used. | 4092 * |
| 3422 * | 4093 * background need only be supplied if an alpha channel must be removed from |
| 3423 * background must be supplied when an alpha channel must be removed from a | 4094 * a png_byte format and the removal is to be done by compositing on a solid |
| 3424 * single byte color-mapped output format, in other words if: | 4095 * color; otherwise it may be NULL and any composition will be done directly |
| 3425 * | 4096 * onto the buffer. The value is an sRGB color to use for the background, |
| 3426 * 1) The original format from png_image_begin_read_from_* had | 4097 * for grayscale output the green channel is used. |
| 3427 * PNG_FORMAT_FLAG_ALPHA set. | 4098 * |
| 3428 * 2) The format set by the application does not. | 4099 * background must be supplied when an alpha channel must be removed from a |
| 3429 * 3) The format set by the application has PNG_FORMAT_FLAG_COLORMAP set and | 4100 * single byte color-mapped output format, in other words if: |
| 3430 * PNG_FORMAT_FLAG_LINEAR *not* set. | 4101 * |
| 3431 * | 4102 * 1) The original format from png_image_begin_read_from_* had |
| 3432 * For linear output removing the alpha channel is always done by compositing | 4103 * PNG_FORMAT_FLAG_ALPHA set. |
| 3433 * on black and background is ignored. | 4104 * 2) The format set by the application does not. |
| 3434 * | 4105 * 3) The format set by the application has PNG_FORMAT_FLAG_COLORMAP set and |
| 3435 * colormap must be supplied when PNG_FORMAT_FLAG_COLORMAP is set. It must | 4106 * PNG_FORMAT_FLAG_LINEAR *not* set. |
| 3436 * be at least the size (in bytes) returned by PNG_IMAGE_COLORMAP_SIZE. | 4107 * |
| 3437 * image->colormap_entries will be updated to the actual number of entries | 4108 * For linear output removing the alpha channel is always done by compositing |
| 3438 * written to the colormap; this may be less than the original value. | 4109 * on black and background is ignored. |
| 3439 */ | 4110 * |
| 4111 * colormap must be supplied when PNG_FORMAT_FLAG_COLORMAP is set. It must | |
| 4112 * be at least the size (in bytes) returned by PNG_IMAGE_COLORMAP_SIZE. | |
| 4113 * image->colormap_entries will be updated to the actual number of entries | |
| 4114 * written to the colormap; this may be less than the original value. | |
| 4115 */ | |
| 3440 | 4116 |
| 3441 PNG_EXPORT(238, void, png_image_free, (png_imagep image)); | 4117 PNG_EXPORT(238, void, png_image_free, (png_imagep image)); |
| 3442 /* Free any data allocated by libpng in image->opaque, setting the pointer to | 4118 /* Free any data allocated by libpng in image->opaque, setting the pointer to |
| 3443 * NULL. May be called at any time after the structure is initialized. | 4119 * NULL. May be called at any time after the structure is initialized. |
| 3444 */ | 4120 */ |
| 3445 #endif /* PNG_SIMPLIFIED_READ_SUPPORTED */ | 4121 #endif /* PNG_SIMPLIFIED_READ_SUPPORTED */ |
| 3446 | 4122 |
| 3447 #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED | 4123 #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED |
| 3448 #ifdef PNG_STDIO_SUPPORTED | 4124 #ifdef PNG_STDIO_SUPPORTED |
| 3449 /* WRITE APIS | 4125 /* WRITE APIS |
| 3450 * ---------- | 4126 * ---------- |
| 3451 * For write you must initialize a png_image structure to describe the image to | 4127 * For write you must initialize a png_image structure to describe the image to |
| 3452 * be written. To do this use memset to set the whole structure to 0 then | 4128 * be written. To do this use memset to set the whole structure to 0 then |
| 3453 * initialize fields describing your image. | 4129 * initialize fields describing your image. |
| 3454 * | 4130 * |
| 3455 * version: must be set to PNG_IMAGE_VERSION | 4131 * version: must be set to PNG_IMAGE_VERSION |
| 3456 * opaque: must be initialized to NULL | 4132 * opaque: must be initialized to NULL |
| 3457 * width: image width in pixels | 4133 * width: image width in pixels |
| 3458 * height: image height in rows | 4134 * height: image height in rows |
| 3459 * format: the format of the data (image and color-map) you wish to write | 4135 * format: the format of the data (image and color-map) you wish to write |
| 3460 * flags: set to 0 unless one of the defined flags applies; set | 4136 * flags: set to 0 unless one of the defined flags applies; set |
| 3461 * PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB for color format images where the RGB | 4137 * PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB for color format images where the RGB |
| 3462 * values do not correspond to the colors in sRGB. | 4138 * values do not correspond to the colors in sRGB. |
| 3463 * colormap_entries: set to the number of entries in the color-map (0 to 256) | 4139 * colormap_entries: set to the number of entries in the color-map (0 to 256) |
| 3464 */ | 4140 */ |
| 3465 PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image, | 4141 PNG_EXPORT(239, |
| 3466 const char *file, int convert_to_8bit, const void *buffer, | 4142 int, |
| 3467 png_int_32 row_stride, const void *colormap)); | 4143 png_image_write_to_file, |
| 3468 /* Write the image to the named file. */ | 4144 (png_imagep image, |
| 4145 const char* file, | |
| 4146 int convert_to_8bit, | |
| 4147 const void* buffer, | |
| 4148 png_int_32 row_stride, | |
| 4149 const void* colormap)); | |
| 4150 /* Write the image to the named file. */ | |
| 3469 | 4151 |
| 3470 PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file, | 4152 PNG_EXPORT(240, |
| 3471 int convert_to_8_bit, const void *buffer, png_int_32 row_stride, | 4153 int, |
| 3472 const void *colormap)); | 4154 png_image_write_to_stdio, |
| 3473 /* Write the image to the given (FILE*). */ | 4155 (png_imagep image, |
| 4156 FILE* file, | |
| 4157 int convert_to_8_bit, | |
| 4158 const void* buffer, | |
| 4159 png_int_32 row_stride, | |
| 4160 const void* colormap)); | |
| 4161 /* Write the image to the given (FILE*). */ | |
| 3474 | 4162 |
| 3475 /* With both write APIs if image is in one of the linear formats with 16-bit | 4163 /* With both write APIs if image is in one of the linear formats with 16-bit |
| 3476 * data then setting convert_to_8_bit will cause the output to be an 8-bit PNG | 4164 * data then setting convert_to_8_bit will cause the output to be an 8-bit PNG |
| 3477 * gamma encoded according to the sRGB specification, otherwise a 16-bit linear | 4165 * gamma encoded according to the sRGB specification, otherwise a 16-bit linear |
| 3478 * encoded PNG file is written. | 4166 * encoded PNG file is written. |
| 3479 * | 4167 * |
| 3480 * With color-mapped data formats the colormap parameter point to a color-map | 4168 * With color-mapped data formats the colormap parameter point to a color-map |
| 3481 * with at least image->colormap_entries encoded in the specified format. If | 4169 * with at least image->colormap_entries encoded in the specified format. If |
| 3482 * the format is linear the written PNG color-map will be converted to sRGB | 4170 * the format is linear the written PNG color-map will be converted to sRGB |
| 3483 * regardless of the convert_to_8_bit flag. | 4171 * regardless of the convert_to_8_bit flag. |
| 3484 * | 4172 * |
| 3485 * With all APIs row_stride is handled as in the read APIs - it is the spacing | 4173 * With all APIs row_stride is handled as in the read APIs - it is the spacing |
| 3486 * from one row to the next in component sized units (1 or 2 bytes) and if | 4174 * from one row to the next in component sized units (1 or 2 bytes) and if |
| 3487 * negative indicates a bottom-up row layout in the buffer. | 4175 * negative indicates a bottom-up row layout in the buffer. |
| 3488 * | 4176 * |
| 3489 * Note that the write API does not support interlacing or sub-8-bit pixels. | 4177 * Note that the write API does not support interlacing or sub-8-bit pixels. |
| 3490 */ | 4178 */ |
| 3491 #endif /* PNG_STDIO_SUPPORTED */ | 4179 #endif /* PNG_STDIO_SUPPORTED */ |
| 3492 #endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */ | 4180 #endif /* PNG_SIMPLIFIED_WRITE_SUPPORTED */ |
| 3493 /******************************************************************************* | 4181 /******************************************************************************* |
| 3494 * END OF SIMPLIFIED API | 4182 * END OF SIMPLIFIED API |
| 3495 ******************************************************************************/ | 4183 ******************************************************************************/ |
| 3496 | 4184 |
| 3497 #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED | 4185 #ifdef PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED |
| 3498 PNG_EXPORT(242, void, png_set_check_for_invalid_index, | 4186 PNG_EXPORT(242, |
| 3499 (png_structrp png_ptr, int allowed)); | 4187 void, |
| 3500 # ifdef PNG_GET_PALETTE_MAX_SUPPORTED | 4188 png_set_check_for_invalid_index, |
| 3501 PNG_EXPORT(243, int, png_get_palette_max, (png_const_structp png_ptr, | 4189 (png_structrp png_ptr, int allowed)); |
| 3502 png_const_infop info_ptr)); | 4190 #ifdef PNG_GET_PALETTE_MAX_SUPPORTED |
| 3503 # endif | 4191 PNG_EXPORT(243, |
| 4192 int, | |
| 4193 png_get_palette_max, | |
| 4194 (png_const_structp png_ptr, png_const_infop info_ptr)); | |
| 4195 #endif | |
| 3504 #endif /* CHECK_FOR_INVALID_INDEX */ | 4196 #endif /* CHECK_FOR_INVALID_INDEX */ |
| 3505 | 4197 |
| 3506 /******************************************************************************* | 4198 /******************************************************************************* |
| 3507 * IMPLEMENTATION OPTIONS | 4199 * IMPLEMENTATION OPTIONS |
| 3508 ******************************************************************************* | 4200 ******************************************************************************* |
| 3509 * | 4201 * |
| 3510 * Support for arbitrary implementation-specific optimizations. The API allows | 4202 * Support for arbitrary implementation-specific optimizations. The API allows |
| 3511 * particular options to be turned on or off. 'Option' is the number of the | 4203 * particular options to be turned on or off. 'Option' is the number of the |
| 3512 * option and 'onoff' is 0 (off) or non-0 (on). The value returned is given | 4204 * option and 'onoff' is 0 (off) or non-0 (on). The value returned is given |
| 3513 * by the PNG_OPTION_ defines below. | 4205 * by the PNG_OPTION_ defines below. |
| 3514 * | 4206 * |
| 3515 * HARDWARE: normally hardware capabilites, such as the Intel SSE instructions, | 4207 * HARDWARE: normally hardware capabilites, such as the Intel SSE instructions, |
| 3516 * are detected at run time, however sometimes it may be impossible | 4208 * are detected at run time, however sometimes it may be impossible |
| 3517 * to do this in user mode, in which case it is necessary to discover | 4209 * to do this in user mode, in which case it is necessary to discover |
| 3518 * the capabilities in an OS specific way. Such capabilities are | 4210 * the capabilities in an OS specific way. Such capabilities are |
| 3519 * listed here when libpng has support for them and must be turned | 4211 * listed here when libpng has support for them and must be turned |
| 3520 * ON by the application if present. | 4212 * ON by the application if present. |
| 3521 * | 4213 * |
| 3522 * SOFTWARE: sometimes software optimizations actually result in performance | 4214 * SOFTWARE: sometimes software optimizations actually result in performance |
| 3523 * decrease on some architectures or systems, or with some sets of | 4215 * decrease on some architectures or systems, or with some sets of |
| 3524 * PNG images. 'Software' options allow such optimizations to be | 4216 * PNG images. 'Software' options allow such optimizations to be |
| 3525 * selected at run time. | 4217 * selected at run time. |
| 3526 */ | 4218 */ |
| 3527 #ifdef PNG_SET_OPTION_SUPPORTED | 4219 #ifdef PNG_SET_OPTION_SUPPORTED |
| 3528 #ifdef PNG_ARM_NEON_API_SUPPORTED | 4220 #ifdef PNG_ARM_NEON_API_SUPPORTED |
| 3529 # define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */ | 4221 #define PNG_ARM_NEON 0 /* HARDWARE: ARM Neon SIMD instructions supported */ |
| 3530 #endif | 4222 #endif |
| 3531 #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */ | 4223 #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */ |
| 3532 #define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */ | 4224 #define PNG_OPTION_NEXT 4 /* Next option - numbers must be even */ |
| 3533 | 4225 |
| 3534 /* Return values: NOTE: there are four values and 'off' is *not* zero */ | 4226 /* Return values: NOTE: there are four values and 'off' is *not* zero */ |
| 3535 #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ | 4227 #define PNG_OPTION_UNSET 0 /* Unset - defaults to off */ |
| 3536 #define PNG_OPTION_INVALID 1 /* Option number out of range */ | 4228 #define PNG_OPTION_INVALID 1 /* Option number out of range */ |
| 3537 #define PNG_OPTION_OFF 2 | 4229 #define PNG_OPTION_OFF 2 |
| 3538 #define PNG_OPTION_ON 3 | 4230 #define PNG_OPTION_ON 3 |
| 3539 | 4231 |
| 3540 PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option, | 4232 PNG_EXPORT(244, |
| 3541 int onoff)); | 4233 int, |
| 4234 png_set_option, | |
| 4235 (png_structrp png_ptr, int option, int onoff)); | |
| 3542 #endif | 4236 #endif |
| 3543 | 4237 |
| 3544 /******************************************************************************* | 4238 /******************************************************************************* |
| 3545 * END OF HARDWARE OPTIONS | 4239 * END OF HARDWARE OPTIONS |
| 3546 ******************************************************************************/ | 4240 ******************************************************************************/ |
| 3547 | 4241 |
| 3548 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project | 4242 /* Maintainer: Put new public prototypes here ^, in libpng.3, and project |
| 3549 * defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt | 4243 * defs, scripts/pnglibconf.h, and scripts/pnglibconf.h.prebuilt |
| 3550 */ | 4244 */ |
| 3551 | 4245 |
| 3552 /* The last ordinal number (this is the *last* one already used; the next | 4246 /* The last ordinal number (this is the *last* one already used; the next |
| 3553 * one to use is one more than this.) Maintainer, remember to add an entry to | 4247 * one to use is one more than this.) Maintainer, remember to add an entry to |
| 3554 * scripts/symbols.def as well. | 4248 * scripts/symbols.def as well. |
| 3555 */ | 4249 */ |
| 3556 #ifdef PNG_EXPORT_LAST_ORDINAL | 4250 #ifdef PNG_EXPORT_LAST_ORDINAL |
| 3557 PNG_EXPORT_LAST_ORDINAL(244); | 4251 PNG_EXPORT_LAST_ORDINAL(244); |
| 3558 #endif | 4252 #endif |
| 3559 | 4253 |
| 3560 #ifdef __cplusplus | 4254 #ifdef __cplusplus |
| 3561 } | 4255 } |
| 3562 #endif | 4256 #endif |
| 3563 | 4257 |
| 3564 #endif /* PNG_VERSION_INFO_ONLY */ | 4258 #endif /* PNG_VERSION_INFO_ONLY */ |
| 3565 /* Do not put anything past this line */ | 4259 /* Do not put anything past this line */ |
| 3566 #endif /* PNG_H */ | 4260 #endif /* PNG_H */ |
| OLD | NEW |