/* pngstruct.h - header file for PNG reference library * * Copyright (c) 2018-2022 Cosmin Truta * Copyright (c) 1998-2002,2004,2006-2018 Glenn Randers-Pehrson * Copyright (c) 1996-1997 Andreas Dilger * Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc. * * This code is released under the libpng license. * For conditions of distribution and use, see the disclaimer * and license in png.h */ /* The structure that holds the information to read and write PNG files. * The only people who need to care about what is inside of this are the * people who will be modifying the library for their own special needs. * It should NOT be accessed directly by an application. */ #ifndef PNGSTRUCT_H #define PNGSTRUCT_H /* zlib.h defines the structure z_stream, an instance of which is included * in this structure and is required for decompressing the LZ compressed * data in PNG files. */ #ifndef ZLIB_CONST /* We must ensure that zlib uses 'const' in declarations. */ #define ZLIB_CONST #endif #include "zlib.h" #ifdef const /* zlib.h sometimes #defines const to nothing, undo this. */ # undef const #endif /* zlib.h has mediocre z_const use before 1.2.6, this stuff is for compatibility * with older builds. */ #if ZLIB_VERNUM < 0x1260 #define PNGZ_MSG_CAST … #define PNGZ_INPUT_CAST … #else #define PNGZ_MSG_CAST(s) … #define PNGZ_INPUT_CAST(b) … #endif /* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib * can handle at once. This type need be no larger than 16 bits (so maximum of * 65535), this define allows us to discover how big it is, but limited by the * maximum for size_t. The value can be overridden in a library build * (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably * lower value (e.g. 255 works). A lower value may help memory usage (slightly) * and may even improve performance on some systems (and degrade it on others.) */ #ifndef ZLIB_IO_MAX #define ZLIB_IO_MAX … #endif #ifdef PNG_WRITE_SUPPORTED /* The type of a compression buffer list used by the write code. */ png_compression_bufferp; #define PNG_COMPRESSION_BUFFER_SIZE(pp) … #endif /* Colorspace support; structures used in png_struct, png_info and in internal * functions to hold and communicate information about the color space. * * PNG_COLORSPACE_SUPPORTED is only required if the application will perform * colorspace corrections, otherwise all the colorspace information can be * skipped and the size of libpng can be reduced (significantly) by compiling * out the colorspace support. */ #ifdef PNG_COLORSPACE_SUPPORTED /* The chromaticities of the red, green and blue colorants and the chromaticity * of the corresponding white point (i.e. of rgb(1.0,1.0,1.0)). */ png_xy; /* The same data as above but encoded as CIE XYZ values. When this data comes * from chromaticities the sum of the Y values is assumed to be 1.0 */ png_XYZ; #endif /* COLORSPACE */ #if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED) /* A colorspace is all the above plus, potentially, profile information; * however at present libpng does not use the profile internally so it is only * stored in the png_info struct (if iCCP is supported.) The rendering intent * is retained here and is checked. * * The file gamma encoding information is also stored here and gamma correction * is done by libpng, whereas color correction must currently be done by the * application. */ png_colorspacerp; png_const_colorspacerp; /* General flags for the 'flags' field */ #define PNG_COLORSPACE_HAVE_GAMMA … #define PNG_COLORSPACE_HAVE_ENDPOINTS … #define PNG_COLORSPACE_HAVE_INTENT … #define PNG_COLORSPACE_FROM_gAMA … #define PNG_COLORSPACE_FROM_cHRM … #define PNG_COLORSPACE_FROM_sRGB … #define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB … #define PNG_COLORSPACE_MATCHES_sRGB … #define PNG_COLORSPACE_INVALID … #define PNG_COLORSPACE_CANCEL(flags) … #endif /* COLORSPACE || GAMMA */ struct png_struct_def { … }; #endif /* PNGSTRUCT_H */