< prev index next >

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

Print this page

        

*** 27,48 **** * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * ! * libpng version 1.6.20, December 3, 2015 * ! * Copyright (c) 1998-2015 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * This code is released under the libpng license (See LICENSE, below) * * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger ! * libpng versions 0.97, January 1998, through 1.6.20, December 3, 2015: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ /* --- 27,48 ---- * This file is available under and governed by the GNU General Public * License version 2 only, as published by the Free Software Foundation. * However, the following notice accompanied the original version of this * file and, per its terms, should not be removed: * ! * libpng version 1.6.23, June 9, 2016 * ! * Copyright (c) 1998-2002,2004,2006-2016 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * This code is released under the libpng license (See LICENSE, below) * * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89, June 1996, through 0.96, May 1997: Andreas Dilger ! * libpng versions 0.97, January 1998, through 1.6.23, June 9, 2016: * Glenn Randers-Pehrson. * See also "Contributing Authors", below. */ /*
*** 51,62 **** * If you modify libpng you may insert additional notices immediately following * this sentence. * * This code is released under the libpng license. * ! * libpng versions 1.0.7, July 1, 2000, through 1.6.20, December 3, 2015, are ! * Copyright (c) 2000-2002, 2004, 2006-2015 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals * added to the list of Contributing Authors: * * Simon-Pierre Cadieux --- 51,66 ---- * If you modify libpng you may insert additional notices immediately following * this sentence. * * This code is released under the libpng license. * ! * Some files in the "contrib" directory and some configure-generated ! * files that are distributed with libpng have other copyright owners and ! * are released under other open source licenses. ! * ! * libpng versions 1.0.7, July 1, 2000 through 1.6.23, June 9, 2016 are ! * Copyright (c) 2000-2002, 2004, 2006-2016 Glenn Randers-Pehrson, are * derived from libpng-1.0.6, and are distributed according to the same * disclaimer and license as libpng-1.0.6 with the following individuals * added to the list of Contributing Authors: * * Simon-Pierre Cadieux
*** 73,92 **** --- 77,103 ---- * efforts or the library will fulfill any of your particular purposes * or needs. This library is provided with all faults, and the entire * risk of satisfactory quality, performance, accuracy, and effort is with * the user. * + * Some files in the "contrib" directory have other copyright owners and + * are released under other open source licenses. + * + * * libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, are * Copyright (c) 1998-2000 Glenn Randers-Pehrson, are derived from * libpng-0.96, and are distributed according to the same disclaimer and * license as libpng-0.96, with the following individuals added to the list * of Contributing Authors: * * Tom Lane * Glenn Randers-Pehrson * Willem van Schaik * + * Some files in the "scripts" directory have different copyright owners + * but are also released under this license. + * * libpng versions 0.89, June 1996, through 0.96, May 1997, are * Copyright (c) 1996-1997 Andreas Dilger, are derived from libpng-0.88, * and are distributed according to the same disclaimer and license as * libpng-0.88, with the following individuals added to the list of * Contributing Authors:
*** 96,105 **** --- 107,119 ---- * Sam Bushell * Magnus Holmgren * Greg Roelofs * Tom Tanner * + * Some files in the "scripts" directory have other copyright owners + * but are released under this license. + * * libpng versions 0.5, May 1995, through 0.88, January 1996, are * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * For the purposes of this copyright and license, "Contributing Authors" * is defined as the following set of individuals:
*** 135,144 **** --- 149,181 ---- * supporting the PNG file format in commercial products. If you use this * source code in a product, acknowledgment is not required but would be * appreciated. * * END OF COPYRIGHT NOTICE, DISCLAIMER, and LICENSE. + * + * TRADEMARK: + * + * The name "libpng" has not been registered by the Copyright owner + * as a trademark in any jurisdiction. However, because libpng has + * been distributed and maintained world-wide, continually since 1995, + * the Copyright owner claims "common-law trademark protection" in any + * jurisdiction where common-law trademark is recognized. + * + * OSI CERTIFICATION: + * + * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is + * a certification mark of the Open Source Initiative. OSI has not addressed + * the additional disclaimers inserted at version 1.0.7. + * + * EXPORT CONTROL: + * + * The Copyright owner believes that the Export Control Classification + * Number (ECCN) for libpng is EAR99, which means not subject to export + * controls or International Traffic in Arms Regulations (ITAR) because + * it is open source, publicly available software, that does not contain + * any encryption software. See the EAR, paragraphs 734.3(b)(3) and + * 734.7(b). */ /* * A "png_get_copyright" function is available, for convenient use in "about" * boxes and the like:
*** 148,163 **** * Also, the PNG logo (in PNG format, of course) is supplied in the * files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31). */ /* - * Libpng is OSI Certified Open Source Software. OSI Certified Open Source is - * a certification mark of the Open Source Initiative. OSI has not addressed - * the additional disclaimers inserted at version 1.0.7. - */ - - /* * The contributing authors would like to thank all those who helped * with testing, bug fixes, and patience. This wouldn't have been * possible without all of you. * * Thanks to Frank J. T. Wojcik for helping with the documentation. --- 185,194 ----
*** 208,222 **** * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) * 1.0.7 1 10007 (still compatible) * ... * 1.0.19 10 10019 10.so.0.19[.0] * ... ! * 1.2.53 13 10253 12.so.0.53[.0] * ... ! * 1.5.23 15 10523 15.so.15.23[.0] * ... ! * 1.6.20 16 10620 16.so.16.20[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The * PNG_LIBPNG_VER macro, which is not used within libpng but is available --- 239,253 ---- * 1.0.7rc1-2 1 10007 2.1.0.7rc1-2 (binary compatible) * 1.0.7 1 10007 (still compatible) * ... * 1.0.19 10 10019 10.so.0.19[.0] * ... ! * 1.2.56 13 10256 12.so.0.56[.0] * ... ! * 1.5.27 15 10527 15.so.15.27[.0] * ... ! * 1.6.23 16 10623 16.so.16.23[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be * used for changes in backward compatibility, as it is intended. The * PNG_LIBPNG_VER macro, which is not used within libpng but is available
*** 240,256 **** /* * Y2K compliance in libpng: * ========================= * ! * December 3, 2015 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and ! * upward through 1.6.20 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer * that will hold years up to 65535. The other, which is deprecated, * holds the date in text format, and will hold years up to 9999. --- 271,287 ---- /* * Y2K compliance in libpng: * ========================= * ! * June 9, 2016 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and ! * upward through 1.6.23 are Y2K compliant. It is my belief that * earlier versions were also Y2K compliant. * * Libpng only has two year fields. One is a 2-byte unsigned integer * that will hold years up to 65535. The other, which is deprecated, * holds the date in text format, and will hold years up to 9999.
*** 308,328 **** * If you just need to read a PNG file and don't want to read the documentation * skip to the end of this file and read the section entitled 'simplified API'. */ /* Version information for png.h - this should match the version in png.c */ ! #define PNG_LIBPNG_VER_STRING "1.6.20" #define PNG_HEADER_VERSION_STRING \ ! " libpng version 1.6.20 - December 3, 2015\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 ! #define PNG_LIBPNG_VER_RELEASE 20 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ --- 339,359 ---- * If you just need to read a PNG file and don't want to read the documentation * skip to the end of this file and read the section entitled 'simplified API'. */ /* Version information for png.h - this should match the version in png.c */ ! #define PNG_LIBPNG_VER_STRING "1.6.23" #define PNG_HEADER_VERSION_STRING \ ! " libpng version 1.6.23 - June 9, 2016\n" #define PNG_LIBPNG_VER_SONUM 16 #define PNG_LIBPNG_VER_DLLNUM 16 /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 6 ! #define PNG_LIBPNG_VER_RELEASE 23 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */
*** 349,359 **** * We must not include leading zeros. * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ ! #define PNG_LIBPNG_VER 10620 /* 1.6.20 */ /* Library configuration: these options cannot be changed after * the library has been built. */ #ifndef PNGLCONF_H --- 380,390 ---- * We must not include leading zeros. * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ ! #define PNG_LIBPNG_VER 10623 /* 1.6.23 */ /* Library configuration: these options cannot be changed after * the library has been built. */ #ifndef PNGLCONF_H
*** 459,469 **** */ /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ ! typedef char* png_libpng_version_1_6_20; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * * png_struct is the cache of information used while reading or writing a single * PNG file. One of these is always required, although the simplified API --- 490,500 ---- */ /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ ! typedef char* png_libpng_version_1_6_23; /* Basic control structions. Read libpng-manual.txt or libpng.3 for more info. * * png_struct is the cache of information used while reading or writing a single * PNG file. One of these is always required, although the simplified API
*** 760,787 **** /* These determine if an ancillary chunk's data has been successfully read * from the PNG header, or if the application has filled in the corresponding * data in the info_struct to be written into the output file. The values * of the PNG_INFO_<chunk> defines should NOT be changed. */ ! #define PNG_INFO_gAMA 0x0001 ! #define PNG_INFO_sBIT 0x0002 ! #define PNG_INFO_cHRM 0x0004 ! #define PNG_INFO_PLTE 0x0008 ! #define PNG_INFO_tRNS 0x0010 ! #define PNG_INFO_bKGD 0x0020 ! #define PNG_INFO_hIST 0x0040 ! #define PNG_INFO_pHYs 0x0080 ! #define PNG_INFO_oFFs 0x0100 ! #define PNG_INFO_tIME 0x0200 ! #define PNG_INFO_pCAL 0x0400 ! #define PNG_INFO_sRGB 0x0800 /* GR-P, 0.96a */ ! #define PNG_INFO_iCCP 0x1000 /* ESR, 1.0.6 */ ! #define PNG_INFO_sPLT 0x2000 /* ESR, 1.0.6 */ ! #define PNG_INFO_sCAL 0x4000 /* ESR, 1.0.6 */ ! #if INT_MAX >= 0x8000 /* else this might break */ ! #define PNG_INFO_IDAT 0x8000 /* ESR, 1.0.6 */ ! #endif /* This is used for the transformation routines, as some of them * change these values for the row. It also should enable using * the routines for other purposes. */ --- 791,816 ---- /* These determine if an ancillary chunk's data has been successfully read * from the PNG header, or if the application has filled in the corresponding * data in the info_struct to be written into the output file. The values * of the PNG_INFO_<chunk> defines should NOT be changed. */ ! #define PNG_INFO_gAMA 0x0001U ! #define PNG_INFO_sBIT 0x0002U ! #define PNG_INFO_cHRM 0x0004U ! #define PNG_INFO_PLTE 0x0008U ! #define PNG_INFO_tRNS 0x0010U ! #define PNG_INFO_bKGD 0x0020U ! #define PNG_INFO_hIST 0x0040U ! #define PNG_INFO_pHYs 0x0080U ! #define PNG_INFO_oFFs 0x0100U ! #define PNG_INFO_tIME 0x0200U ! #define PNG_INFO_pCAL 0x0400U ! #define PNG_INFO_sRGB 0x0800U /* GR-P, 0.96a */ ! #define PNG_INFO_iCCP 0x1000U /* ESR, 1.0.6 */ ! #define PNG_INFO_sPLT 0x2000U /* ESR, 1.0.6 */ ! #define PNG_INFO_sCAL 0x4000U /* ESR, 1.0.6 */ ! #define PNG_INFO_IDAT 0x8000U /* ESR, 1.0.6 */ /* This is used for the transformation routines, as some of them * change these values for the row. It also should enable using * the routines for other purposes. */
*** 1348,1358 **** /* Scale a 16-bit depth file down to 8-bit, accurately. */ PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr)); #endif #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED ! #define PNG_READ_16_TO_8 SUPPORTED /* Name prior to 1.5.4 */ /* Strip the second byte of information from a 16-bit depth file. */ PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr)); #endif #ifdef PNG_READ_QUANTIZE_SUPPORTED --- 1377,1387 ---- /* Scale a 16-bit depth file down to 8-bit, accurately. */ PNG_EXPORT(229, void, png_set_scale_16, (png_structrp png_ptr)); #endif #ifdef PNG_READ_STRIP_16_TO_8_SUPPORTED ! #define PNG_READ_16_TO_8_SUPPORTED /* Name prior to 1.5.4 */ /* Strip the second byte of information from a 16-bit depth file. */ PNG_EXPORT(48, void, png_set_strip_16, (png_structrp png_ptr)); #endif #ifdef PNG_READ_QUANTIZE_SUPPORTED
*** 1499,1510 **** #define PNG_FILTER_NONE 0x08 #define PNG_FILTER_SUB 0x10 #define PNG_FILTER_UP 0x20 #define PNG_FILTER_AVG 0x40 #define PNG_FILTER_PAETH 0x80 ! #define PNG_ALL_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP | \ ! PNG_FILTER_AVG | PNG_FILTER_PAETH) /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. * These defines should NOT be changed. */ #define PNG_FILTER_VALUE_NONE 0 --- 1528,1539 ---- #define PNG_FILTER_NONE 0x08 #define PNG_FILTER_SUB 0x10 #define PNG_FILTER_UP 0x20 #define PNG_FILTER_AVG 0x40 #define PNG_FILTER_PAETH 0x80 ! #define PNG_FAST_FILTERS (PNG_FILTER_NONE | PNG_FILTER_SUB | PNG_FILTER_UP) ! #define PNG_ALL_FILTERS (PNG_FAST_FILTERS | PNG_FILTER_AVG | PNG_FILTER_PAETH) /* Filter values (not flags) - used in pngwrite.c, pngwutil.c for now. * These defines should NOT be changed. */ #define PNG_FILTER_VALUE_NONE 0
*** 1777,1801 **** /* Assignments for png_data_freer */ #define PNG_DESTROY_WILL_FREE_DATA 1 #define PNG_SET_WILL_FREE_DATA 1 #define PNG_USER_WILL_FREE_DATA 2 /* Flags for png_ptr->free_me and info_ptr->free_me */ ! #define PNG_FREE_HIST 0x0008 ! #define PNG_FREE_ICCP 0x0010 ! #define PNG_FREE_SPLT 0x0020 ! #define PNG_FREE_ROWS 0x0040 ! #define PNG_FREE_PCAL 0x0080 ! #define PNG_FREE_SCAL 0x0100 #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED ! # define PNG_FREE_UNKN 0x0200 #endif ! /* PNG_FREE_LIST 0x0400 removed in 1.6.0 because it is ignored */ ! #define PNG_FREE_PLTE 0x1000 ! #define PNG_FREE_TRNS 0x2000 ! #define PNG_FREE_TEXT 0x4000 ! #define PNG_FREE_ALL 0x7fff ! #define PNG_FREE_MUL 0x4220 /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ #ifdef PNG_USER_MEM_SUPPORTED PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr, png_alloc_size_t size), PNG_ALLOCATED PNG_DEPRECATED); PNG_EXPORTA(101, void, png_free_default, (png_const_structrp png_ptr, --- 1806,1830 ---- /* Assignments for png_data_freer */ #define PNG_DESTROY_WILL_FREE_DATA 1 #define PNG_SET_WILL_FREE_DATA 1 #define PNG_USER_WILL_FREE_DATA 2 /* Flags for png_ptr->free_me and info_ptr->free_me */ ! #define PNG_FREE_HIST 0x0008U ! #define PNG_FREE_ICCP 0x0010U ! #define PNG_FREE_SPLT 0x0020U ! #define PNG_FREE_ROWS 0x0040U ! #define PNG_FREE_PCAL 0x0080U ! #define PNG_FREE_SCAL 0x0100U #ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED ! # define PNG_FREE_UNKN 0x0200U #endif ! /* PNG_FREE_LIST 0x0400U removed in 1.6.0 because it is ignored */ ! #define PNG_FREE_PLTE 0x1000U ! #define PNG_FREE_TRNS 0x2000U ! #define PNG_FREE_TEXT 0x4000U ! #define PNG_FREE_ALL 0x7fffU ! #define PNG_FREE_MUL 0x4220U /* PNG_FREE_SPLT|PNG_FREE_TEXT|PNG_FREE_UNKN */ #ifdef PNG_USER_MEM_SUPPORTED PNG_EXPORTA(100, png_voidp, png_malloc_default, (png_const_structrp png_ptr, png_alloc_size_t size), PNG_ALLOCATED PNG_DEPRECATED); PNG_EXPORTA(101, void, png_free_default, (png_const_structrp png_ptr,
*** 2915,2930 **** --- 2944,2966 ---- (PNG_IMAGE_PIXEL_CHANNELS((image).format) * (image).width) /* Return the total number of components in a single row of the image; this * is the minimum 'row stride', the minimum count of components between each * row. For a color-mapped image this is the minimum number of bytes in a * row. + * + * WARNING: this macro overflows for some images with more than one component + * and very large image widths. libpng will refuse to process an image where + * this macro would overflow. */ #define PNG_IMAGE_BUFFER_SIZE(image, row_stride)\ (PNG_IMAGE_PIXEL_COMPONENT_SIZE((image).format)*(image).height*(row_stride)) /* Return the size, in bytes, of an image buffer given a png_image and a row * stride - the number of components to leave space for in each row. + * + * WARNING: this macro overflows a 32-bit integer for some large PNG images, + * libpng will refuse to process an image where such an overflow would occur. */ #define PNG_IMAGE_SIZE(image)\ PNG_IMAGE_BUFFER_SIZE(image, PNG_IMAGE_ROW_STRIDE(image)) /* Return the size, in bytes, of the image in memory given just a png_image;
*** 3041,3051 **** * NULL. May be called at any time after the structure is initialized. */ #endif /* SIMPLIFIED_READ */ #ifdef PNG_SIMPLIFIED_WRITE_SUPPORTED - #ifdef PNG_STDIO_SUPPORTED /* WRITE APIS * ---------- * For write you must initialize a png_image structure to describe the image to * be written. To do this use memset to set the whole structure to 0 then * initialize fields describing your image. --- 3077,3086 ----
*** 3058,3078 **** * flags: set to 0 unless one of the defined flags applies; set * PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB for color format images where the RGB * values do not correspond to the colors in sRGB. * colormap_entries: set to the number of entries in the color-map (0 to 256) */ PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image, const char *file, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap)); /* Write the image to the named file. */ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file, int convert_to_8_bit, const void *buffer, png_int_32 row_stride, const void *colormap)); /* Write the image to the given (FILE*). */ ! /* With both write APIs if image is in one of the linear formats with 16-bit * data then setting convert_to_8_bit will cause the output to be an 8-bit PNG * gamma encoded according to the sRGB specification, otherwise a 16-bit linear * encoded PNG file is written. * * With color-mapped data formats the colormap parameter point to a color-map --- 3093,3115 ---- * flags: set to 0 unless one of the defined flags applies; set * PNG_IMAGE_FLAG_COLORSPACE_NOT_sRGB for color format images where the RGB * values do not correspond to the colors in sRGB. * colormap_entries: set to the number of entries in the color-map (0 to 256) */ + #ifdef PNG_SIMPLIFIED_WRITE_STDIO_SUPPORTED PNG_EXPORT(239, int, png_image_write_to_file, (png_imagep image, const char *file, int convert_to_8bit, const void *buffer, png_int_32 row_stride, const void *colormap)); /* Write the image to the named file. */ PNG_EXPORT(240, int, png_image_write_to_stdio, (png_imagep image, FILE *file, int convert_to_8_bit, const void *buffer, png_int_32 row_stride, const void *colormap)); /* Write the image to the given (FILE*). */ + #endif /* SIMPLIFIED_WRITE_STDIO */ ! /* With all write APIs if image is in one of the linear formats with 16-bit * data then setting convert_to_8_bit will cause the output to be an 8-bit PNG * gamma encoded according to the sRGB specification, otherwise a 16-bit linear * encoded PNG file is written. * * With color-mapped data formats the colormap parameter point to a color-map
*** 3080,3096 **** * the format is linear the written PNG color-map will be converted to sRGB * regardless of the convert_to_8_bit flag. * * With all APIs row_stride is handled as in the read APIs - it is the spacing * from one row to the next in component sized units (1 or 2 bytes) and if ! * negative indicates a bottom-up row layout in the buffer. If row_stride is zero, ! * libpng will calculate it for you from the image width and number of channels. ! * ! * Note that the write API does not support interlacing, sub-8-bit pixels, indexed ! * PNG (color_type 3) or most ancillary chunks. */ - #endif /* STDIO */ #endif /* SIMPLIFIED_WRITE */ /******************************************************************************* * END OF SIMPLIFIED API ******************************************************************************/ #endif /* SIMPLIFIED_{READ|WRITE} */ --- 3117,3223 ---- * the format is linear the written PNG color-map will be converted to sRGB * regardless of the convert_to_8_bit flag. * * With all APIs row_stride is handled as in the read APIs - it is the spacing * from one row to the next in component sized units (1 or 2 bytes) and if ! * negative indicates a bottom-up row layout in the buffer. If row_stride is ! * zero, libpng will calculate it for you from the image width and number of ! * channels. ! * ! * Note that the write API does not support interlacing, sub-8-bit pixels or ! * most ancillary chunks. If you need to write text chunks (e.g. for copyright ! * notices) you need to use one of the other APIs. ! */ ! ! PNG_EXPORT(245, int, png_image_write_to_memory, (png_imagep image, void *memory, ! png_alloc_size_t * PNG_RESTRICT memory_bytes, int convert_to_8_bit, ! const void *buffer, png_int_32 row_stride, const void *colormap)); ! /* Write the image to the given memory buffer. The function both writes the ! * whole PNG data stream to *memory and updates *memory_bytes with the count ! * of bytes written. ! * ! * 'memory' may be NULL. In this case *memory_bytes is not read however on ! * success the number of bytes which would have been written will still be ! * stored in *memory_bytes. On failure *memory_bytes will contain 0. ! * ! * If 'memory' is not NULL it must point to memory[*memory_bytes] of ! * writeable memory. ! * ! * If the function returns success memory[*memory_bytes] (if 'memory' is not ! * NULL) contains the written PNG data. *memory_bytes will always be less ! * than or equal to the original value. ! * ! * If the function returns false and *memory_bytes was not changed an error ! * occured during write. If *memory_bytes was changed, or is not 0 if ! * 'memory' was NULL, the write would have succeeded but for the memory ! * buffer being too small. *memory_bytes contains the required number of ! * bytes and will be bigger that the original value. ! */ ! ! #define png_image_write_get_memory_size(image, size, convert_to_8_bit, buffer,\ ! row_stride, colormap)\ ! png_image_write_to_memory(&(image), 0, &(size), convert_to_8_bit, buffer,\ ! row_stride, colormap) ! /* Return the amount of memory in 'size' required to compress this image. ! * The png_image structure 'image' must be filled in as in the above ! * function and must not be changed before the actual write call, the buffer ! * and all other parameters must also be identical to that in the final ! * write call. The 'size' variable need not be initialized. ! * ! * NOTE: the macro returns true/false, if false is returned 'size' will be ! * set to zero and the write failed and probably will fail if tried again. ! */ ! ! /* You can pre-allocate the buffer by making sure it is of sufficient size ! * regardless of the amount of compression achieved. The buffer size will ! * always be bigger than the original image and it will never be filled. The ! * following macros are provided to assist in allocating the buffer. ! */ ! #define PNG_IMAGE_DATA_SIZE(image) (PNG_IMAGE_SIZE(image)+(image).height) ! /* The number of uncompressed bytes in the PNG byte encoding of the image; ! * uncompressing the PNG IDAT data will give this number of bytes. ! * ! * NOTE: while PNG_IMAGE_SIZE cannot overflow for an image in memory this ! * macro can because of the extra bytes used in the PNG byte encoding. You ! * need to avoid this macro if your image size approaches 2^30 in width or ! * height. The same goes for the remainder of these macros; they all produce ! * bigger numbers than the actual in-memory image size. ! */ ! #ifndef PNG_ZLIB_MAX_SIZE ! # define PNG_ZLIB_MAX_SIZE(b) ((b)+(((b)+7U)>>3)+(((b)+63U)>>6)+11U) ! /* An upper bound on the number of compressed bytes given 'b' uncompressed ! * bytes. This is based on deflateBounds() in zlib; different ! * implementations of zlib compression may conceivably produce more data so ! * if your zlib implementation is not zlib itself redefine this macro ! * appropriately. ! */ ! #endif ! ! #define PNG_IMAGE_COMPRESSED_SIZE_MAX(image)\ ! PNG_ZLIB_MAX_SIZE((png_alloc_size_t)PNG_IMAGE_DATA_SIZE(image)) ! /* An upper bound on the size of the data in the PNG IDAT chunks. */ ! ! #define PNG_IMAGE_PNG_SIZE_MAX_(image, image_size)\ ! ((8U/*sig*/+25U/*IHDR*/+16U/*gAMA*/+44U/*cHRM*/+12U/*IEND*/+\ ! (((image).format&PNG_FORMAT_FLAG_COLORMAP)?/*colormap: PLTE, tRNS*/\ ! 12U+3U*(image).colormap_entries/*PLTE data*/+\ ! (((image).format&PNG_FORMAT_FLAG_ALPHA)?\ ! 12U/*tRNS*/+(image).colormap_entries:0U):0U)+\ ! 12U)+(12U*((image_size)/PNG_ZBUF_SIZE))/*IDAT*/+(image_size)) ! /* A helper for the following macro; if your compiler cannot handle the ! * following macro use this one with the result of ! * PNG_IMAGE_COMPRESSED_SIZE_MAX(image) as the second argument (most ! * compilers should handle this just fine.) ! */ ! ! #define PNG_IMAGE_PNG_SIZE_MAX(image)\ ! PNG_IMAGE_PNG_SIZE_MAX_(image, PNG_IMAGE_COMPRESSED_SIZE_MAX(image)) ! /* An upper bound on the total length of the PNG data stream for 'image'. ! * The result is of type png_alloc_size_t, on 32-bit systems this may ! * overflow even though PNG_IMAGE_DATA_SIZE does not overflow; the write will ! * run out of buffer space but return a corrected size which should work. */ #endif /* SIMPLIFIED_WRITE */ /******************************************************************************* * END OF SIMPLIFIED API ******************************************************************************/ #endif /* SIMPLIFIED_{READ|WRITE} */
*** 3144,3154 **** /* The last ordinal number (this is the *last* one already used; the next * one to use is one more than this.) */ #ifdef PNG_EXPORT_LAST_ORDINAL ! PNG_EXPORT_LAST_ORDINAL(244); #endif #ifdef __cplusplus } #endif --- 3271,3281 ---- /* The last ordinal number (this is the *last* one already used; the next * one to use is one more than this.) */ #ifdef PNG_EXPORT_LAST_ORDINAL ! PNG_EXPORT_LAST_ORDINAL(245); #endif #ifdef __cplusplus } #endif
< prev index next >