< prev index next >

src/java.desktop/share/native/libsplashscreen/libpng/png.h

Print this page




  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 /* png.h - header file for PNG reference library
  26  *
  27  * This file is available under and governed by the GNU General Public
  28  * License version 2 only, as published by the Free Software Foundation.
  29  * However, the following notice accompanied the original version of this
  30  * file and, per its terms, should not be removed:
  31  *
  32  * libpng version 1.6.28, January 5, 2017
  33  *
  34  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  35  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  36  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  37  *
  38  * This code is released under the libpng license (See LICENSE, below)
  39  *
  40  * Authors and maintainers:
  41  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  42  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
  43  *   libpng versions 0.97, January 1998, through 1.6.28, January 5, 2017:
  44  *     Glenn Randers-Pehrson.
  45  *   See also "Contributing Authors", below.
  46  */
  47 
  48 /*
  49  * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
  50  *
  51  * If you modify libpng you may insert additional notices immediately following
  52  * this sentence.
  53  *
  54  * This code is released under the libpng license.
  55  *
  56  * libpng versions 1.0.7, July 1, 2000 through 1.6.28, January 5, 2017 are
  57  * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
  58  * derived from libpng-1.0.6, and are distributed according to the same
  59  * disclaimer and license as libpng-1.0.6 with the following individuals
  60  * added to the list of Contributing Authors:
  61  *
  62  *    Simon-Pierre Cadieux
  63  *    Eric S. Raymond
  64  *    Mans Rullgard
  65  *    Cosmin Truta
  66  *    Gilles Vollant
  67  *    James Yu
  68  *    Mandar Sahastrabuddhe


  69  *
  70  * and with the following additions to the disclaimer:
  71  *
  72  *    There is no warranty against interference with your enjoyment of the
  73  *    library or against infringement.  There is no warranty that our
  74  *    efforts or the library will fulfill any of your particular purposes
  75  *    or needs.  This library is provided with all faults, and the entire
  76  *    risk of satisfactory quality, performance, accuracy, and effort is with
  77  *    the user.
  78  *
  79  * Some files in the "contrib" directory and some configure-generated
  80  * files that are distributed with libpng have other copyright owners and
  81  * are released under other open source licenses.
  82  *
  83  * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
  84  * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
  85  * libpng-0.96, and are distributed according to the same disclaimer and
  86  * license as libpng-0.96, with the following individuals added to the list
  87  * of Contributing Authors:
  88  *


 218  *    1.0.3a-d                      10004
 219  *    1.0.4                         10004
 220  *    1.0.4a-f                      10005
 221  *    1.0.5 (+ 2 patches)           10005
 222  *    1.0.5a-d                      10006
 223  *    1.0.5e-r                      10100 (not source compatible)
 224  *    1.0.5s-v                      10006 (not binary compatible)
 225  *    1.0.6 (+ 3 patches)           10006 (still binary incompatible)
 226  *    1.0.6d-f                      10007 (still binary incompatible)
 227  *    1.0.6g                        10007
 228  *    1.0.6h                        10007  10.6h (testing xy.z so-numbering)
 229  *    1.0.6i                        10007  10.6i
 230  *    1.0.6j                        10007  2.1.0.6j (incompatible with 1.0.0)
 231  *    1.0.7beta11-14        DLLNUM  10007  2.1.0.7beta11-14 (binary compatible)
 232  *    1.0.7beta15-18           1    10007  2.1.0.7beta15-18 (binary compatible)
 233  *    1.0.7rc1-2               1    10007  2.1.0.7rc1-2 (binary compatible)
 234  *    1.0.7                    1    10007  (still compatible)
 235  *    ...
 236  *    1.0.19                  10    10019  10.so.0.19[.0]
 237  *    ...
 238  *    1.2.57                  13    10257  12.so.0.57[.0]
 239  *    ...
 240  *    1.5.28                  15    10527  15.so.15.28[.0]
 241  *    ...
 242  *    1.6.28                  16    10628  16.so.16.28[.0]
 243  *
 244  *    Henceforth the source version will match the shared-library major
 245  *    and minor numbers; the shared-library major version number will be
 246  *    used for changes in backward compatibility, as it is intended.  The
 247  *    PNG_LIBPNG_VER macro, which is not used within libpng but is available
 248  *    for applications, is an unsigned integer of the form xyyzz corresponding
 249  *    to the source version x.y.z (leading zeros in y and z).  Beta versions
 250  *    were given the previous public release number plus a letter, until
 251  *    version 1.0.6j; from then on they were given the upcoming public
 252  *    release number plus "betaNN" or "rcNN".
 253  *
 254  *    Binary incompatibility exists only when applications make direct access
 255  *    to the info_ptr or png_ptr members through png.h, and the compiled
 256  *    application is loaded with a different version of the library.
 257  *
 258  *    DLLNUM will change each time there are forward or backward changes
 259  *    in binary compatibility (e.g., when a new feature is added).
 260  *
 261  * See libpng.txt or libpng.3 for more information.  The PNG specification
 262  * is available as a W3C Recommendation and as an ISO Specification,
 263  * <http://www.w3.org/TR/2003/REC-PNG-20031110/
 264  */
 265 
 266 /*
 267  * Y2K compliance in libpng:
 268  * =========================
 269  *
 270  *    January 5, 2017
 271  *
 272  *    Since the PNG Development group is an ad-hoc body, we can't make
 273  *    an official declaration.
 274  *
 275  *    This is your unofficial assurance that libpng from version 0.71 and
 276  *    upward through 1.6.28 are Y2K compliant.  It is my belief that
 277  *    earlier versions were also Y2K compliant.
 278  *
 279  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
 280  *    that will hold years up to 65535.  The other, which is deprecated,
 281  *    holds the date in text format, and will hold years up to 9999.
 282  *
 283  *    The integer is
 284  *        "png_uint_16 year" in png_time_struct.
 285  *
 286  *    The string is
 287  *        "char time_buffer[29]" in png_struct.  This is no longer used
 288  *    in libpng-1.6.x and will be removed from libpng-1.7.0.
 289  *
 290  *    There are seven time-related functions:
 291  *        png.c: png_convert_to_rfc_1123_buffer() in png.c
 292  *          (formerly png_convert_to_rfc_1123() prior to libpng-1.5.x and
 293  *          png_convert_to_rfc_1152() in error prior to libpng-0.98)
 294  *        png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
 295  *        png_convert_from_time_t() in pngwrite.c
 296  *        png_get_tIME() in pngget.c


 318  *       Glenn Randers-Pehrson
 319  *       libpng maintainer
 320  *       PNG Development Group
 321  */
 322 
 323 #ifndef PNG_H
 324 #define PNG_H
 325 
 326 /* This is not the place to learn how to use libpng. The file libpng-manual.txt
 327  * describes how to use libpng, and the file example.c summarizes it
 328  * with some code on which to build.  This file is useful for looking
 329  * at the actual function definitions and structure components.  If that
 330  * file has been stripped from your copy of libpng, you can find it at
 331  * <http://www.libpng.org/pub/png/libpng-manual.txt>
 332  *
 333  * If you just need to read a PNG file and don't want to read the documentation
 334  * skip to the end of this file and read the section entitled 'simplified API'.
 335  */
 336 
 337 /* Version information for png.h - this should match the version in png.c */
 338 #define PNG_LIBPNG_VER_STRING "1.6.28"
 339 #define PNG_HEADER_VERSION_STRING " libpng version 1.6.28 - January 5, 2017\n"
 340 
 341 #define PNG_LIBPNG_VER_SONUM   16
 342 #define PNG_LIBPNG_VER_DLLNUM  16
 343 
 344 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 345 #define PNG_LIBPNG_VER_MAJOR   1
 346 #define PNG_LIBPNG_VER_MINOR   6
 347 #define PNG_LIBPNG_VER_RELEASE 28
 348 
 349 /* This should match the numeric part of the final component of
 350  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
 351  */
 352 
 353 #define PNG_LIBPNG_VER_BUILD  0
 354 
 355 /* Release Status */
 356 #define PNG_LIBPNG_BUILD_ALPHA    1
 357 #define PNG_LIBPNG_BUILD_BETA     2
 358 #define PNG_LIBPNG_BUILD_RC       3
 359 #define PNG_LIBPNG_BUILD_STABLE   4
 360 #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
 361 
 362 /* Release-Specific Flags */
 363 #define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with
 364                                        PNG_LIBPNG_BUILD_STABLE only */
 365 #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with
 366                                        PNG_LIBPNG_BUILD_SPECIAL */
 367 #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
 368                                        PNG_LIBPNG_BUILD_PRIVATE */
 369 
 370 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
 371 
 372 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
 373  * We must not include leading zeros.
 374  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
 375  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
 376  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
 377  */
 378 #define PNG_LIBPNG_VER 10628 /* 1.6.28 */
 379 
 380 /* Library configuration: these options cannot be changed after
 381  * the library has been built.
 382  */
 383 #ifndef PNGLCONF_H
 384 /* If pnglibconf.h is missing, you can
 385  * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
 386  */
 387 #   include "pnglibconf.h"
 388 #endif
 389 
 390 #ifndef PNG_VERSION_INFO_ONLY
 391 /* Machine specific configuration. */
 392 #  include "pngconf.h"
 393 #endif
 394 
 395 /*
 396  * Added at libpng-1.2.8
 397  *
 398  * Ref MSDN: Private as priority over Special


 468  * does not use division?
 469  *   PNG_READ_COMPOSITE_NODIV_SUPPORTED: use the 'no division'
 470  *      algorithm.
 471  *   PNG_NO_READ_COMPOSITE_NODIV: use the 'division' algorithm.
 472  *
 473  * How to handle benign errors if PNG_ALLOW_BENIGN_ERRORS is
 474  * false?
 475  *   PNG_ALLOW_BENIGN_ERRORS: map calls to the benign error
 476  *      APIs to png_warning.
 477  * Otherwise the calls are mapped to png_error.
 478  */
 479 
 480 /* Section 3: type definitions, including structures and compile time
 481  * constants.
 482  * See pngconf.h for base types that vary by machine/system
 483  */
 484 
 485 /* This triggers a compiler error in png.c, if png.c and png.h
 486  * do not agree upon the version number.
 487  */
 488 typedef char* png_libpng_version_1_6_28;
 489 
 490 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
 491  *
 492  * png_struct is the cache of information used while reading or writing a single
 493  * PNG file.  One of these is always required, although the simplified API
 494  * (below) hides the creation and destruction of it.
 495  */
 496 typedef struct png_struct_def png_struct;
 497 typedef const png_struct * png_const_structp;
 498 typedef png_struct * png_structp;
 499 typedef png_struct * * png_structpp;
 500 
 501 /* png_info contains information read from or to be written to a PNG file.  One
 502  * or more of these must exist while reading or creating a PNG file.  The
 503  * information is not used by libpng during read but is used to control what
 504  * gets written when a PNG file is created.  "png_get_" function calls read
 505  * information during read and "png_set_" functions calls write information
 506  * when creating a PNG.
 507  * been moved into a separate header file that is not accessible to
 508  * applications.  Read libpng-manual.txt or libpng.3 for more info.


 785  * from the PNG header, or if the application has filled in the corresponding
 786  * data in the info_struct to be written into the output file.  The values
 787  * of the PNG_INFO_<chunk> defines should NOT be changed.
 788  */
 789 #define PNG_INFO_gAMA 0x0001U
 790 #define PNG_INFO_sBIT 0x0002U
 791 #define PNG_INFO_cHRM 0x0004U
 792 #define PNG_INFO_PLTE 0x0008U
 793 #define PNG_INFO_tRNS 0x0010U
 794 #define PNG_INFO_bKGD 0x0020U
 795 #define PNG_INFO_hIST 0x0040U
 796 #define PNG_INFO_pHYs 0x0080U
 797 #define PNG_INFO_oFFs 0x0100U
 798 #define PNG_INFO_tIME 0x0200U
 799 #define PNG_INFO_pCAL 0x0400U
 800 #define PNG_INFO_sRGB 0x0800U  /* GR-P, 0.96a */
 801 #define PNG_INFO_iCCP 0x1000U  /* ESR, 1.0.6 */
 802 #define PNG_INFO_sPLT 0x2000U  /* ESR, 1.0.6 */
 803 #define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
 804 #define PNG_INFO_IDAT 0x8000U  /* ESR, 1.0.6 */

 805 
 806 /* This is used for the transformation routines, as some of them
 807  * change these values for the row.  It also should enable using
 808  * the routines for other purposes.
 809  */
 810 typedef struct png_row_info_struct
 811 {
 812    png_uint_32 width;    /* width of row */
 813    png_size_t rowbytes;  /* number of bytes in row */
 814    png_byte color_type;  /* color type of row */
 815    png_byte bit_depth;   /* bit depth of row */
 816    png_byte channels;    /* number of channels (1, 2, 3, or 4) */
 817    png_byte pixel_depth; /* bits per pixel (depth * channels) */
 818 } png_row_info;
 819 
 820 typedef png_row_info * png_row_infop;
 821 typedef png_row_info * * png_row_infopp;
 822 
 823 /* These are the function types for the I/O functions and for the functions
 824  * that allow the user to override the default I/O functions with his or her


1797     png_inforp info_ptr, int freer, png_uint_32 mask));
1798 
1799 /* Assignments for png_data_freer */
1800 #define PNG_DESTROY_WILL_FREE_DATA 1
1801 #define PNG_SET_WILL_FREE_DATA 1
1802 #define PNG_USER_WILL_FREE_DATA 2
1803 /* Flags for png_ptr->free_me and info_ptr->free_me */
1804 #define PNG_FREE_HIST 0x0008U
1805 #define PNG_FREE_ICCP 0x0010U
1806 #define PNG_FREE_SPLT 0x0020U
1807 #define PNG_FREE_ROWS 0x0040U
1808 #define PNG_FREE_PCAL 0x0080U
1809 #define PNG_FREE_SCAL 0x0100U
1810 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
1811 #  define PNG_FREE_UNKN 0x0200U
1812 #endif
1813 /*      PNG_FREE_LIST 0x0400U   removed in 1.6.0 because it is ignored */
1814 #define PNG_FREE_PLTE 0x1000U
1815 #define PNG_FREE_TRNS 0x2000U
1816 #define PNG_FREE_TEXT 0x4000U
1817 #define PNG_FREE_ALL  0x7fffU

1818 #define PNG_FREE_MUL  0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
1819 
1820 #ifdef PNG_USER_MEM_SUPPORTED
1821 PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr,
1822     png_alloc_size_t size), PNG_ALLOCATED PNG_DEPRECATED);
1823 PNG_EXPORTA(101, void, png_free_default, (png_const_structrp png_ptr,
1824     png_voidp ptr), PNG_DEPRECATED);
1825 #endif
1826 
1827 #ifdef PNG_ERROR_TEXT_SUPPORTED
1828 /* Fatal error in PNG image of libpng - can't continue */
1829 PNG_EXPORTA(102, void, png_error, (png_const_structrp png_ptr,
1830     png_const_charp error_message), PNG_NORETURN);
1831 
1832 /* The same, but the chunk name is prepended to the error string. */
1833 PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr,
1834     png_const_charp error_message), PNG_NORETURN);
1835 
1836 #else
1837 /* Fatal error in PNG image of libpng - can't continue */


2016     double white_x, double white_y, double red_x, double red_y, double green_x,
2017     double green_y, double blue_x, double blue_y))
2018 PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_const_structrp png_ptr,
2019     png_inforp info_ptr, double red_X, double red_Y, double red_Z,
2020     double green_X, double green_Y, double green_Z, double blue_X,
2021     double blue_Y, double blue_Z))
2022 PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_const_structrp png_ptr,
2023     png_inforp info_ptr, png_fixed_point int_white_x,
2024     png_fixed_point int_white_y, png_fixed_point int_red_x,
2025     png_fixed_point int_red_y, png_fixed_point int_green_x,
2026     png_fixed_point int_green_y, png_fixed_point int_blue_x,
2027     png_fixed_point int_blue_y))
2028 PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
2029     png_inforp info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y,
2030     png_fixed_point int_red_Z, png_fixed_point int_green_X,
2031     png_fixed_point int_green_Y, png_fixed_point int_green_Z,
2032     png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
2033     png_fixed_point int_blue_Z))
2034 #endif
2035 












2036 #ifdef PNG_gAMA_SUPPORTED
2037 PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
2038     png_const_inforp info_ptr, double *file_gamma))
2039 PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed,
2040     (png_const_structrp png_ptr, png_const_inforp info_ptr,
2041     png_fixed_point *int_file_gamma))
2042 #endif
2043 
2044 #ifdef PNG_gAMA_SUPPORTED
2045 PNG_FP_EXPORT(139, void, png_set_gAMA, (png_const_structrp png_ptr,
2046     png_inforp info_ptr, double file_gamma))
2047 PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr,
2048     png_inforp info_ptr, png_fixed_point int_file_gamma))
2049 #endif
2050 
2051 #ifdef PNG_hIST_SUPPORTED
2052 PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
2053     png_inforp info_ptr, png_uint_16p *hist));
2054 #endif
2055 
2056 #ifdef PNG_hIST_SUPPORTED
2057 PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr,
2058     png_inforp info_ptr, png_const_uint_16p hist));
2059 #endif
2060 
2061 PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_const_structrp png_ptr,
2062     png_const_inforp info_ptr, png_uint_32 *width, png_uint_32 *height,
2063     int *bit_depth, int *color_type, int *interlace_method,
2064     int *compression_method, int *filter_method));
2065 
2066 PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr,
2067     png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
2068     int color_type, int interlace_method, int compression_method,
2069     int filter_method));
2070 
2071 #ifdef PNG_oFFs_SUPPORTED
2072 PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr,
2073    png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
2074    int *unit_type));
2075 #endif
2076 


2762  * 4: Three color channels and an alpha channel (RGBA).
2763  *
2764  * The components are encoded in one of two ways:
2765  *
2766  * a) As a small integer, value 0..255, contained in a single byte.  For the
2767  * alpha channel the original value is simply value/255.  For the color or
2768  * luminance channels the value is encoded according to the sRGB specification
2769  * and matches the 8-bit format expected by typical display devices.
2770  *
2771  * The color/gray channels are not scaled (pre-multiplied) by the alpha
2772  * channel and are suitable for passing to color management software.
2773  *
2774  * b) As a value in the range 0..65535, contained in a 2-byte integer.  All
2775  * channels can be converted to the original value by dividing by 65535; all
2776  * channels are linear.  Color channels use the RGB encoding (RGB end-points) of
2777  * the sRGB specification.  This encoding is identified by the
2778  * PNG_FORMAT_FLAG_LINEAR flag below.
2779  *
2780  * When the simplified API needs to convert between sRGB and linear colorspaces,
2781  * the actual sRGB transfer curve defined in the sRGB specification (see the
2782  * article at http://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
2783  * approximation used elsewhere in libpng.
2784  *
2785  * When an alpha channel is present it is expected to denote pixel coverage
2786  * of the color or luminance channels and is returned as an associated alpha
2787  * channel: the color/gray channels are scaled (pre-multiplied) by the alpha
2788  * value.
2789  *
2790  * The samples are either contained directly in the image data, between 1 and 8
2791  * bytes per pixel according to the encoding, or are held in a color-map indexed
2792  * by bytes in the image data.  In the case of a color-map the color-map entries
2793  * are individual samples, encoded as above, and the image data has one byte per
2794  * pixel to select the relevant sample from the color-map.
2795  */
2796 
2797 /* PNG_FORMAT_*
2798  *
2799  * #defines to be used in png_image::format.  Each #define identifies a
2800  * particular layout of sample data and, if present, alpha values.  There are
2801  * separate defines for each of the two component encodings.
2802  *


2817  * possible, however, for the libpng configuration to enable the format on just
2818  * read or just write; in that case you may see an error at run time.  You can
2819  * guard against this by checking for the definition of the appropriate
2820  * "_SUPPORTED" macro, one of:
2821  *
2822  *    PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED
2823  */
2824 #define PNG_FORMAT_FLAG_ALPHA    0x01U /* format with an alpha channel */
2825 #define PNG_FORMAT_FLAG_COLOR    0x02U /* color format: otherwise grayscale */
2826 #define PNG_FORMAT_FLAG_LINEAR   0x04U /* 2-byte channels else 1-byte */
2827 #define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */
2828 
2829 #ifdef PNG_FORMAT_BGR_SUPPORTED
2830 #  define PNG_FORMAT_FLAG_BGR    0x10U /* BGR colors, else order is RGB */
2831 #endif
2832 
2833 #ifdef PNG_FORMAT_AFIRST_SUPPORTED
2834 #  define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */
2835 #endif
2836 


2837 /* Commonly used formats have predefined macros.
2838  *
2839  * First the single byte (sRGB) formats:
2840  */
2841 #define PNG_FORMAT_GRAY 0
2842 #define PNG_FORMAT_GA   PNG_FORMAT_FLAG_ALPHA
2843 #define PNG_FORMAT_AG   (PNG_FORMAT_GA|PNG_FORMAT_FLAG_AFIRST)
2844 #define PNG_FORMAT_RGB  PNG_FORMAT_FLAG_COLOR
2845 #define PNG_FORMAT_BGR  (PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_BGR)
2846 #define PNG_FORMAT_RGBA (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_ALPHA)
2847 #define PNG_FORMAT_ARGB (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_AFIRST)
2848 #define PNG_FORMAT_BGRA (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_ALPHA)
2849 #define PNG_FORMAT_ABGR (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_AFIRST)
2850 
2851 /* Then the linear 2-byte formats.  When naming these "Y" is used to
2852  * indicate a luminance (gray) channel.
2853  */
2854 #define PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR
2855 #define PNG_FORMAT_LINEAR_Y_ALPHA (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_ALPHA)
2856 #define PNG_FORMAT_LINEAR_RGB (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR)


3235  *           to do this in user mode, in which case it is necessary to discover
3236  *           the capabilities in an OS specific way.  Such capabilities are
3237  *           listed here when libpng has support for them and must be turned
3238  *           ON by the application if present.
3239  *
3240  * SOFTWARE: sometimes software optimizations actually result in performance
3241  *           decrease on some architectures or systems, or with some sets of
3242  *           PNG images.  'Software' options allow such optimizations to be
3243  *           selected at run time.
3244  */
3245 #ifdef PNG_SET_OPTION_SUPPORTED
3246 #ifdef PNG_ARM_NEON_API_SUPPORTED
3247 #  define PNG_ARM_NEON   0 /* HARDWARE: ARM Neon SIMD instructions supported */
3248 #endif
3249 #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
3250 #define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
3251 #ifdef PNG_MIPS_MSA_API_SUPPORTED
3252 #  define PNG_MIPS_MSA   6 /* HARDWARE: MIPS Msa SIMD instructions supported */
3253 #endif
3254 #define PNG_IGNORE_ADLER32 8
3255 #define PNG_OPTION_NEXT  10 /* Next option - numbers must be even */



3256 
3257 /* Return values: NOTE: there are four values and 'off' is *not* zero */
3258 #define PNG_OPTION_UNSET   0 /* Unset - defaults to off */
3259 #define PNG_OPTION_INVALID 1 /* Option number out of range */
3260 #define PNG_OPTION_OFF     2
3261 #define PNG_OPTION_ON      3
3262 
3263 PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
3264    int onoff));
3265 #endif /* SET_OPTION */
3266 
3267 /*******************************************************************************
3268  *  END OF HARDWARE AND SOFTWARE OPTIONS
3269  ******************************************************************************/
3270 
3271 /* Maintainer: Put new public prototypes here ^, in libpng.3, in project
3272  * defs, and in scripts/symbols.def.
3273  */
3274 
3275 /* The last ordinal number (this is the *last* one already used; the next
3276  * one to use is one more than this.)
3277  */
3278 #ifdef PNG_EXPORT_LAST_ORDINAL
3279   PNG_EXPORT_LAST_ORDINAL(245);
3280 #endif
3281 
3282 #ifdef __cplusplus
3283 }
3284 #endif
3285 
3286 #endif /* PNG_VERSION_INFO_ONLY */
3287 /* Do not put anything past this line */
3288 #endif /* PNG_H */


  12  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  13  * version 2 for more details (a copy is included in the LICENSE file that
  14  * accompanied this code).
  15  *
  16  * You should have received a copy of the GNU General Public License version
  17  * 2 along with this work; if not, write to the Free Software Foundation,
  18  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  19  *
  20  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  21  * or visit www.oracle.com if you need additional information or have any
  22  * questions.
  23  */
  24 
  25 /* png.h - header file for PNG reference library
  26  *
  27  * This file is available under and governed by the GNU General Public
  28  * License version 2 only, as published by the Free Software Foundation.
  29  * However, the following notice accompanied the original version of this
  30  * file and, per its terms, should not be removed:
  31  *
  32  * libpng version 1.6.34, September 29, 2017
  33  *
  34  * Copyright (c) 1998-2002,2004,2006-2017 Glenn Randers-Pehrson
  35  * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
  36  * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
  37  *
  38  * This code is released under the libpng license (See LICENSE, below)
  39  *
  40  * Authors and maintainers:
  41  *   libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat
  42  *   libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger
  43  *   libpng versions 0.97, January 1998, through 1.6.34, September 29, 2017:
  44  *     Glenn Randers-Pehrson.
  45  *   See also "Contributing Authors", below.
  46  */
  47 
  48 /*
  49  * COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
  50  *
  51  * If you modify libpng you may insert additional notices immediately following
  52  * this sentence.
  53  *
  54  * This code is released under the libpng license.
  55  *
  56  * libpng versions 1.0.7, July 1, 2000 through 1.6.34, September 29, 2017 are
  57  * Copyright (c) 2000-2002, 2004, 2006-2017 Glenn Randers-Pehrson, are
  58  * derived from libpng-1.0.6, and are distributed according to the same
  59  * disclaimer and license as libpng-1.0.6 with the following individuals
  60  * added to the list of Contributing Authors:
  61  *
  62  *    Simon-Pierre Cadieux
  63  *    Eric S. Raymond
  64  *    Mans Rullgard
  65  *    Cosmin Truta
  66  *    Gilles Vollant
  67  *    James Yu
  68  *    Mandar Sahastrabuddhe
  69  *    Google Inc.
  70  *    Vadim Barkov
  71  *
  72  * and with the following additions to the disclaimer:
  73  *
  74  *    There is no warranty against interference with your enjoyment of the
  75  *    library or against infringement.  There is no warranty that our
  76  *    efforts or the library will fulfill any of your particular purposes
  77  *    or needs.  This library is provided with all faults, and the entire
  78  *    risk of satisfactory quality, performance, accuracy, and effort is with
  79  *    the user.
  80  *
  81  * Some files in the "contrib" directory and some configure-generated
  82  * files that are distributed with libpng have other copyright owners and
  83  * are released under other open source licenses.
  84  *
  85  * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are
  86  * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from
  87  * libpng-0.96, and are distributed according to the same disclaimer and
  88  * license as libpng-0.96, with the following individuals added to the list
  89  * of Contributing Authors:
  90  *


 220  *    1.0.3a-d                      10004
 221  *    1.0.4                         10004
 222  *    1.0.4a-f                      10005
 223  *    1.0.5 (+ 2 patches)           10005
 224  *    1.0.5a-d                      10006
 225  *    1.0.5e-r                      10100 (not source compatible)
 226  *    1.0.5s-v                      10006 (not binary compatible)
 227  *    1.0.6 (+ 3 patches)           10006 (still binary incompatible)
 228  *    1.0.6d-f                      10007 (still binary incompatible)
 229  *    1.0.6g                        10007
 230  *    1.0.6h                        10007  10.6h (testing xy.z so-numbering)
 231  *    1.0.6i                        10007  10.6i
 232  *    1.0.6j                        10007  2.1.0.6j (incompatible with 1.0.0)
 233  *    1.0.7beta11-14        DLLNUM  10007  2.1.0.7beta11-14 (binary compatible)
 234  *    1.0.7beta15-18           1    10007  2.1.0.7beta15-18 (binary compatible)
 235  *    1.0.7rc1-2               1    10007  2.1.0.7rc1-2 (binary compatible)
 236  *    1.0.7                    1    10007  (still compatible)
 237  *    ...
 238  *    1.0.19                  10    10019  10.so.0.19[.0]
 239  *    ...
 240  *    1.2.59                  13    10257  12.so.0.59[.0]
 241  *    ...
 242  *    1.5.30                  15    10527  15.so.15.30[.0]
 243  *    ...
 244  *    1.6.34                  16    10633  16.so.16.34[.0]
 245  *
 246  *    Henceforth the source version will match the shared-library major
 247  *    and minor numbers; the shared-library major version number will be
 248  *    used for changes in backward compatibility, as it is intended.  The
 249  *    PNG_LIBPNG_VER macro, which is not used within libpng but is available
 250  *    for applications, is an unsigned integer of the form xyyzz corresponding
 251  *    to the source version x.y.z (leading zeros in y and z).  Beta versions
 252  *    were given the previous public release number plus a letter, until
 253  *    version 1.0.6j; from then on they were given the upcoming public
 254  *    release number plus "betaNN" or "rcNN".
 255  *
 256  *    Binary incompatibility exists only when applications make direct access
 257  *    to the info_ptr or png_ptr members through png.h, and the compiled
 258  *    application is loaded with a different version of the library.
 259  *
 260  *    DLLNUM will change each time there are forward or backward changes
 261  *    in binary compatibility (e.g., when a new feature is added).
 262  *
 263  * See libpng.txt or libpng.3 for more information.  The PNG specification
 264  * is available as a W3C Recommendation and as an ISO Specification,
 265  * <https://www.w3.org/TR/2003/REC-PNG-20031110/
 266  */
 267 
 268 /*
 269  * Y2K compliance in libpng:
 270  * =========================
 271  *
 272  *    September 29, 2017
 273  *
 274  *    Since the PNG Development group is an ad-hoc body, we can't make
 275  *    an official declaration.
 276  *
 277  *    This is your unofficial assurance that libpng from version 0.71 and
 278  *    upward through 1.6.34 are Y2K compliant.  It is my belief that
 279  *    earlier versions were also Y2K compliant.
 280  *
 281  *    Libpng only has two year fields.  One is a 2-byte unsigned integer
 282  *    that will hold years up to 65535.  The other, which is deprecated,
 283  *    holds the date in text format, and will hold years up to 9999.
 284  *
 285  *    The integer is
 286  *        "png_uint_16 year" in png_time_struct.
 287  *
 288  *    The string is
 289  *        "char time_buffer[29]" in png_struct.  This is no longer used
 290  *    in libpng-1.6.x and will be removed from libpng-1.7.0.
 291  *
 292  *    There are seven time-related functions:
 293  *        png.c: png_convert_to_rfc_1123_buffer() in png.c
 294  *          (formerly png_convert_to_rfc_1123() prior to libpng-1.5.x and
 295  *          png_convert_to_rfc_1152() in error prior to libpng-0.98)
 296  *        png_convert_from_struct_tm() in pngwrite.c, called in pngwrite.c
 297  *        png_convert_from_time_t() in pngwrite.c
 298  *        png_get_tIME() in pngget.c


 320  *       Glenn Randers-Pehrson
 321  *       libpng maintainer
 322  *       PNG Development Group
 323  */
 324 
 325 #ifndef PNG_H
 326 #define PNG_H
 327 
 328 /* This is not the place to learn how to use libpng. The file libpng-manual.txt
 329  * describes how to use libpng, and the file example.c summarizes it
 330  * with some code on which to build.  This file is useful for looking
 331  * at the actual function definitions and structure components.  If that
 332  * file has been stripped from your copy of libpng, you can find it at
 333  * <http://www.libpng.org/pub/png/libpng-manual.txt>
 334  *
 335  * If you just need to read a PNG file and don't want to read the documentation
 336  * skip to the end of this file and read the section entitled 'simplified API'.
 337  */
 338 
 339 /* Version information for png.h - this should match the version in png.c */
 340 #define PNG_LIBPNG_VER_STRING "1.6.34"
 341 #define PNG_HEADER_VERSION_STRING " libpng version 1.6.34 - September 29, 2017\n"
 342 
 343 #define PNG_LIBPNG_VER_SONUM   16
 344 #define PNG_LIBPNG_VER_DLLNUM  16
 345 
 346 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */
 347 #define PNG_LIBPNG_VER_MAJOR   1
 348 #define PNG_LIBPNG_VER_MINOR   6
 349 #define PNG_LIBPNG_VER_RELEASE 34
 350 
 351 /* This should match the numeric part of the final component of
 352  * PNG_LIBPNG_VER_STRING, omitting any leading zero:
 353  */
 354 
 355 #define PNG_LIBPNG_VER_BUILD  0
 356 
 357 /* Release Status */
 358 #define PNG_LIBPNG_BUILD_ALPHA    1
 359 #define PNG_LIBPNG_BUILD_BETA     2
 360 #define PNG_LIBPNG_BUILD_RC       3
 361 #define PNG_LIBPNG_BUILD_STABLE   4
 362 #define PNG_LIBPNG_BUILD_RELEASE_STATUS_MASK 7
 363 
 364 /* Release-Specific Flags */
 365 #define PNG_LIBPNG_BUILD_PATCH    8 /* Can be OR'ed with
 366                                        PNG_LIBPNG_BUILD_STABLE only */
 367 #define PNG_LIBPNG_BUILD_PRIVATE 16 /* Cannot be OR'ed with
 368                                        PNG_LIBPNG_BUILD_SPECIAL */
 369 #define PNG_LIBPNG_BUILD_SPECIAL 32 /* Cannot be OR'ed with
 370                                        PNG_LIBPNG_BUILD_PRIVATE */
 371 
 372 #define PNG_LIBPNG_BUILD_BASE_TYPE PNG_LIBPNG_BUILD_STABLE
 373 
 374 /* Careful here.  At one time, Guy wanted to use 082, but that would be octal.
 375  * We must not include leading zeros.
 376  * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only
 377  * version 1.0.0 was mis-numbered 100 instead of 10000).  From
 378  * version 1.0.1 it's    xxyyzz, where x=major, y=minor, z=release
 379  */
 380 #define PNG_LIBPNG_VER 10634 /* 1.6.34 */
 381 
 382 /* Library configuration: these options cannot be changed after
 383  * the library has been built.
 384  */
 385 #ifndef PNGLCONF_H
 386 /* If pnglibconf.h is missing, you can
 387  * copy scripts/pnglibconf.h.prebuilt to pnglibconf.h
 388  */
 389 #   include "pnglibconf.h"
 390 #endif
 391 
 392 #ifndef PNG_VERSION_INFO_ONLY
 393 /* Machine specific configuration. */
 394 #  include "pngconf.h"
 395 #endif
 396 
 397 /*
 398  * Added at libpng-1.2.8
 399  *
 400  * Ref MSDN: Private as priority over Special


 470  * does not use division?
 471  *   PNG_READ_COMPOSITE_NODIV_SUPPORTED: use the 'no division'
 472  *      algorithm.
 473  *   PNG_NO_READ_COMPOSITE_NODIV: use the 'division' algorithm.
 474  *
 475  * How to handle benign errors if PNG_ALLOW_BENIGN_ERRORS is
 476  * false?
 477  *   PNG_ALLOW_BENIGN_ERRORS: map calls to the benign error
 478  *      APIs to png_warning.
 479  * Otherwise the calls are mapped to png_error.
 480  */
 481 
 482 /* Section 3: type definitions, including structures and compile time
 483  * constants.
 484  * See pngconf.h for base types that vary by machine/system
 485  */
 486 
 487 /* This triggers a compiler error in png.c, if png.c and png.h
 488  * do not agree upon the version number.
 489  */
 490 typedef char* png_libpng_version_1_6_34;
 491 
 492 /* Basic control structions.  Read libpng-manual.txt or libpng.3 for more info.
 493  *
 494  * png_struct is the cache of information used while reading or writing a single
 495  * PNG file.  One of these is always required, although the simplified API
 496  * (below) hides the creation and destruction of it.
 497  */
 498 typedef struct png_struct_def png_struct;
 499 typedef const png_struct * png_const_structp;
 500 typedef png_struct * png_structp;
 501 typedef png_struct * * png_structpp;
 502 
 503 /* png_info contains information read from or to be written to a PNG file.  One
 504  * or more of these must exist while reading or creating a PNG file.  The
 505  * information is not used by libpng during read but is used to control what
 506  * gets written when a PNG file is created.  "png_get_" function calls read
 507  * information during read and "png_set_" functions calls write information
 508  * when creating a PNG.
 509  * been moved into a separate header file that is not accessible to
 510  * applications.  Read libpng-manual.txt or libpng.3 for more info.


 787  * from the PNG header, or if the application has filled in the corresponding
 788  * data in the info_struct to be written into the output file.  The values
 789  * of the PNG_INFO_<chunk> defines should NOT be changed.
 790  */
 791 #define PNG_INFO_gAMA 0x0001U
 792 #define PNG_INFO_sBIT 0x0002U
 793 #define PNG_INFO_cHRM 0x0004U
 794 #define PNG_INFO_PLTE 0x0008U
 795 #define PNG_INFO_tRNS 0x0010U
 796 #define PNG_INFO_bKGD 0x0020U
 797 #define PNG_INFO_hIST 0x0040U
 798 #define PNG_INFO_pHYs 0x0080U
 799 #define PNG_INFO_oFFs 0x0100U
 800 #define PNG_INFO_tIME 0x0200U
 801 #define PNG_INFO_pCAL 0x0400U
 802 #define PNG_INFO_sRGB 0x0800U  /* GR-P, 0.96a */
 803 #define PNG_INFO_iCCP 0x1000U  /* ESR, 1.0.6 */
 804 #define PNG_INFO_sPLT 0x2000U  /* ESR, 1.0.6 */
 805 #define PNG_INFO_sCAL 0x4000U  /* ESR, 1.0.6 */
 806 #define PNG_INFO_IDAT 0x8000U  /* ESR, 1.0.6 */
 807 #define PNG_INFO_eXIf 0x10000U /* GR-P, 1.6.31 */
 808 
 809 /* This is used for the transformation routines, as some of them
 810  * change these values for the row.  It also should enable using
 811  * the routines for other purposes.
 812  */
 813 typedef struct png_row_info_struct
 814 {
 815    png_uint_32 width;    /* width of row */
 816    png_size_t rowbytes;  /* number of bytes in row */
 817    png_byte color_type;  /* color type of row */
 818    png_byte bit_depth;   /* bit depth of row */
 819    png_byte channels;    /* number of channels (1, 2, 3, or 4) */
 820    png_byte pixel_depth; /* bits per pixel (depth * channels) */
 821 } png_row_info;
 822 
 823 typedef png_row_info * png_row_infop;
 824 typedef png_row_info * * png_row_infopp;
 825 
 826 /* These are the function types for the I/O functions and for the functions
 827  * that allow the user to override the default I/O functions with his or her


1800     png_inforp info_ptr, int freer, png_uint_32 mask));
1801 
1802 /* Assignments for png_data_freer */
1803 #define PNG_DESTROY_WILL_FREE_DATA 1
1804 #define PNG_SET_WILL_FREE_DATA 1
1805 #define PNG_USER_WILL_FREE_DATA 2
1806 /* Flags for png_ptr->free_me and info_ptr->free_me */
1807 #define PNG_FREE_HIST 0x0008U
1808 #define PNG_FREE_ICCP 0x0010U
1809 #define PNG_FREE_SPLT 0x0020U
1810 #define PNG_FREE_ROWS 0x0040U
1811 #define PNG_FREE_PCAL 0x0080U
1812 #define PNG_FREE_SCAL 0x0100U
1813 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
1814 #  define PNG_FREE_UNKN 0x0200U
1815 #endif
1816 /*      PNG_FREE_LIST 0x0400U   removed in 1.6.0 because it is ignored */
1817 #define PNG_FREE_PLTE 0x1000U
1818 #define PNG_FREE_TRNS 0x2000U
1819 #define PNG_FREE_TEXT 0x4000U
1820 #define PNG_FREE_EXIF 0x8000U /* Added at libpng-1.6.31 */
1821 #define PNG_FREE_ALL  0xffffU
1822 #define PNG_FREE_MUL  0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */
1823 
1824 #ifdef PNG_USER_MEM_SUPPORTED
1825 PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr,
1826     png_alloc_size_t size), PNG_ALLOCATED PNG_DEPRECATED);
1827 PNG_EXPORTA(101, void, png_free_default, (png_const_structrp png_ptr,
1828     png_voidp ptr), PNG_DEPRECATED);
1829 #endif
1830 
1831 #ifdef PNG_ERROR_TEXT_SUPPORTED
1832 /* Fatal error in PNG image of libpng - can't continue */
1833 PNG_EXPORTA(102, void, png_error, (png_const_structrp png_ptr,
1834     png_const_charp error_message), PNG_NORETURN);
1835 
1836 /* The same, but the chunk name is prepended to the error string. */
1837 PNG_EXPORTA(103, void, png_chunk_error, (png_const_structrp png_ptr,
1838     png_const_charp error_message), PNG_NORETURN);
1839 
1840 #else
1841 /* Fatal error in PNG image of libpng - can't continue */


2020     double white_x, double white_y, double red_x, double red_y, double green_x,
2021     double green_y, double blue_x, double blue_y))
2022 PNG_FP_EXPORT(232, void, png_set_cHRM_XYZ, (png_const_structrp png_ptr,
2023     png_inforp info_ptr, double red_X, double red_Y, double red_Z,
2024     double green_X, double green_Y, double green_Z, double blue_X,
2025     double blue_Y, double blue_Z))
2026 PNG_FIXED_EXPORT(136, void, png_set_cHRM_fixed, (png_const_structrp png_ptr,
2027     png_inforp info_ptr, png_fixed_point int_white_x,
2028     png_fixed_point int_white_y, png_fixed_point int_red_x,
2029     png_fixed_point int_red_y, png_fixed_point int_green_x,
2030     png_fixed_point int_green_y, png_fixed_point int_blue_x,
2031     png_fixed_point int_blue_y))
2032 PNG_FIXED_EXPORT(233, void, png_set_cHRM_XYZ_fixed, (png_const_structrp png_ptr,
2033     png_inforp info_ptr, png_fixed_point int_red_X, png_fixed_point int_red_Y,
2034     png_fixed_point int_red_Z, png_fixed_point int_green_X,
2035     png_fixed_point int_green_Y, png_fixed_point int_green_Z,
2036     png_fixed_point int_blue_X, png_fixed_point int_blue_Y,
2037     png_fixed_point int_blue_Z))
2038 #endif
2039 
2040 #ifdef PNG_eXIf_SUPPORTED
2041 PNG_EXPORT(246, png_uint_32, png_get_eXIf, (png_const_structrp png_ptr,
2042     png_inforp info_ptr, png_bytep *exif));
2043 PNG_EXPORT(247, void, png_set_eXIf, (png_const_structrp png_ptr,
2044     png_inforp info_ptr, const png_bytep exif));
2045 
2046 PNG_EXPORT(248, png_uint_32, png_get_eXIf_1, (png_const_structrp png_ptr,
2047     png_const_inforp info_ptr, png_uint_32 *num_exif, png_bytep *exif));
2048 PNG_EXPORT(249, void, png_set_eXIf_1, (png_const_structrp png_ptr,
2049     png_inforp info_ptr, const png_uint_32 num_exif, const png_bytep exif));
2050 #endif
2051 
2052 #ifdef PNG_gAMA_SUPPORTED
2053 PNG_FP_EXPORT(137, png_uint_32, png_get_gAMA, (png_const_structrp png_ptr,
2054     png_const_inforp info_ptr, double *file_gamma))
2055 PNG_FIXED_EXPORT(138, png_uint_32, png_get_gAMA_fixed,
2056     (png_const_structrp png_ptr, png_const_inforp info_ptr,
2057     png_fixed_point *int_file_gamma))
2058 #endif
2059 
2060 #ifdef PNG_gAMA_SUPPORTED
2061 PNG_FP_EXPORT(139, void, png_set_gAMA, (png_const_structrp png_ptr,
2062     png_inforp info_ptr, double file_gamma))
2063 PNG_FIXED_EXPORT(140, void, png_set_gAMA_fixed, (png_const_structrp png_ptr,
2064     png_inforp info_ptr, png_fixed_point int_file_gamma))
2065 #endif
2066 
2067 #ifdef PNG_hIST_SUPPORTED
2068 PNG_EXPORT(141, png_uint_32, png_get_hIST, (png_const_structrp png_ptr,
2069     png_inforp info_ptr, png_uint_16p *hist));



2070 PNG_EXPORT(142, void, png_set_hIST, (png_const_structrp png_ptr,
2071     png_inforp info_ptr, png_const_uint_16p hist));
2072 #endif
2073 
2074 PNG_EXPORT(143, png_uint_32, png_get_IHDR, (png_const_structrp png_ptr,
2075     png_const_inforp info_ptr, png_uint_32 *width, png_uint_32 *height,
2076     int *bit_depth, int *color_type, int *interlace_method,
2077     int *compression_method, int *filter_method));
2078 
2079 PNG_EXPORT(144, void, png_set_IHDR, (png_const_structrp png_ptr,
2080     png_inforp info_ptr, png_uint_32 width, png_uint_32 height, int bit_depth,
2081     int color_type, int interlace_method, int compression_method,
2082     int filter_method));
2083 
2084 #ifdef PNG_oFFs_SUPPORTED
2085 PNG_EXPORT(145, png_uint_32, png_get_oFFs, (png_const_structrp png_ptr,
2086    png_const_inforp info_ptr, png_int_32 *offset_x, png_int_32 *offset_y,
2087    int *unit_type));
2088 #endif
2089 


2775  * 4: Three color channels and an alpha channel (RGBA).
2776  *
2777  * The components are encoded in one of two ways:
2778  *
2779  * a) As a small integer, value 0..255, contained in a single byte.  For the
2780  * alpha channel the original value is simply value/255.  For the color or
2781  * luminance channels the value is encoded according to the sRGB specification
2782  * and matches the 8-bit format expected by typical display devices.
2783  *
2784  * The color/gray channels are not scaled (pre-multiplied) by the alpha
2785  * channel and are suitable for passing to color management software.
2786  *
2787  * b) As a value in the range 0..65535, contained in a 2-byte integer.  All
2788  * channels can be converted to the original value by dividing by 65535; all
2789  * channels are linear.  Color channels use the RGB encoding (RGB end-points) of
2790  * the sRGB specification.  This encoding is identified by the
2791  * PNG_FORMAT_FLAG_LINEAR flag below.
2792  *
2793  * When the simplified API needs to convert between sRGB and linear colorspaces,
2794  * the actual sRGB transfer curve defined in the sRGB specification (see the
2795  * article at https://en.wikipedia.org/wiki/SRGB) is used, not the gamma=1/2.2
2796  * approximation used elsewhere in libpng.
2797  *
2798  * When an alpha channel is present it is expected to denote pixel coverage
2799  * of the color or luminance channels and is returned as an associated alpha
2800  * channel: the color/gray channels are scaled (pre-multiplied) by the alpha
2801  * value.
2802  *
2803  * The samples are either contained directly in the image data, between 1 and 8
2804  * bytes per pixel according to the encoding, or are held in a color-map indexed
2805  * by bytes in the image data.  In the case of a color-map the color-map entries
2806  * are individual samples, encoded as above, and the image data has one byte per
2807  * pixel to select the relevant sample from the color-map.
2808  */
2809 
2810 /* PNG_FORMAT_*
2811  *
2812  * #defines to be used in png_image::format.  Each #define identifies a
2813  * particular layout of sample data and, if present, alpha values.  There are
2814  * separate defines for each of the two component encodings.
2815  *


2830  * possible, however, for the libpng configuration to enable the format on just
2831  * read or just write; in that case you may see an error at run time.  You can
2832  * guard against this by checking for the definition of the appropriate
2833  * "_SUPPORTED" macro, one of:
2834  *
2835  *    PNG_SIMPLIFIED_{READ,WRITE}_{BGR,AFIRST}_SUPPORTED
2836  */
2837 #define PNG_FORMAT_FLAG_ALPHA    0x01U /* format with an alpha channel */
2838 #define PNG_FORMAT_FLAG_COLOR    0x02U /* color format: otherwise grayscale */
2839 #define PNG_FORMAT_FLAG_LINEAR   0x04U /* 2-byte channels else 1-byte */
2840 #define PNG_FORMAT_FLAG_COLORMAP 0x08U /* image data is color-mapped */
2841 
2842 #ifdef PNG_FORMAT_BGR_SUPPORTED
2843 #  define PNG_FORMAT_FLAG_BGR    0x10U /* BGR colors, else order is RGB */
2844 #endif
2845 
2846 #ifdef PNG_FORMAT_AFIRST_SUPPORTED
2847 #  define PNG_FORMAT_FLAG_AFIRST 0x20U /* alpha channel comes first */
2848 #endif
2849 
2850 #define PNG_FORMAT_FLAG_ASSOCIATED_ALPHA 0x40U /* alpha channel is associated */
2851 
2852 /* Commonly used formats have predefined macros.
2853  *
2854  * First the single byte (sRGB) formats:
2855  */
2856 #define PNG_FORMAT_GRAY 0
2857 #define PNG_FORMAT_GA   PNG_FORMAT_FLAG_ALPHA
2858 #define PNG_FORMAT_AG   (PNG_FORMAT_GA|PNG_FORMAT_FLAG_AFIRST)
2859 #define PNG_FORMAT_RGB  PNG_FORMAT_FLAG_COLOR
2860 #define PNG_FORMAT_BGR  (PNG_FORMAT_FLAG_COLOR|PNG_FORMAT_FLAG_BGR)
2861 #define PNG_FORMAT_RGBA (PNG_FORMAT_RGB|PNG_FORMAT_FLAG_ALPHA)
2862 #define PNG_FORMAT_ARGB (PNG_FORMAT_RGBA|PNG_FORMAT_FLAG_AFIRST)
2863 #define PNG_FORMAT_BGRA (PNG_FORMAT_BGR|PNG_FORMAT_FLAG_ALPHA)
2864 #define PNG_FORMAT_ABGR (PNG_FORMAT_BGRA|PNG_FORMAT_FLAG_AFIRST)
2865 
2866 /* Then the linear 2-byte formats.  When naming these "Y" is used to
2867  * indicate a luminance (gray) channel.
2868  */
2869 #define PNG_FORMAT_LINEAR_Y PNG_FORMAT_FLAG_LINEAR
2870 #define PNG_FORMAT_LINEAR_Y_ALPHA (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_ALPHA)
2871 #define PNG_FORMAT_LINEAR_RGB (PNG_FORMAT_FLAG_LINEAR|PNG_FORMAT_FLAG_COLOR)


3250  *           to do this in user mode, in which case it is necessary to discover
3251  *           the capabilities in an OS specific way.  Such capabilities are
3252  *           listed here when libpng has support for them and must be turned
3253  *           ON by the application if present.
3254  *
3255  * SOFTWARE: sometimes software optimizations actually result in performance
3256  *           decrease on some architectures or systems, or with some sets of
3257  *           PNG images.  'Software' options allow such optimizations to be
3258  *           selected at run time.
3259  */
3260 #ifdef PNG_SET_OPTION_SUPPORTED
3261 #ifdef PNG_ARM_NEON_API_SUPPORTED
3262 #  define PNG_ARM_NEON   0 /* HARDWARE: ARM Neon SIMD instructions supported */
3263 #endif
3264 #define PNG_MAXIMUM_INFLATE_WINDOW 2 /* SOFTWARE: force maximum window */
3265 #define PNG_SKIP_sRGB_CHECK_PROFILE 4 /* SOFTWARE: Check ICC profile for sRGB */
3266 #ifdef PNG_MIPS_MSA_API_SUPPORTED
3267 #  define PNG_MIPS_MSA   6 /* HARDWARE: MIPS Msa SIMD instructions supported */
3268 #endif
3269 #define PNG_IGNORE_ADLER32 8
3270 #ifdef PNG_POWERPC_VSX_API_SUPPORTED
3271 #  define PNG_POWERPC_VSX   10 /* HARDWARE: PowerPC VSX SIMD instructions supported */
3272 #endif
3273 #define PNG_OPTION_NEXT  12 /* Next option - numbers must be even */
3274 
3275 /* Return values: NOTE: there are four values and 'off' is *not* zero */
3276 #define PNG_OPTION_UNSET   0 /* Unset - defaults to off */
3277 #define PNG_OPTION_INVALID 1 /* Option number out of range */
3278 #define PNG_OPTION_OFF     2
3279 #define PNG_OPTION_ON      3
3280 
3281 PNG_EXPORT(244, int, png_set_option, (png_structrp png_ptr, int option,
3282    int onoff));
3283 #endif /* SET_OPTION */
3284 
3285 /*******************************************************************************
3286  *  END OF HARDWARE AND SOFTWARE OPTIONS
3287  ******************************************************************************/
3288 
3289 /* Maintainer: Put new public prototypes here ^, in libpng.3, in project
3290  * defs, and in scripts/symbols.def.
3291  */
3292 
3293 /* The last ordinal number (this is the *last* one already used; the next
3294  * one to use is one more than this.)
3295  */
3296 #ifdef PNG_EXPORT_LAST_ORDINAL
3297   PNG_EXPORT_LAST_ORDINAL(249);
3298 #endif
3299 
3300 #ifdef __cplusplus
3301 }
3302 #endif
3303 
3304 #endif /* PNG_VERSION_INFO_ONLY */
3305 /* Do not put anything past this line */
3306 #endif /* PNG_H */
< prev index next >