summaryrefslogtreecommitdiff
path: root/png/pnginfo.h
diff options
context:
space:
mode:
Diffstat (limited to 'png/pnginfo.h')
-rw-r--r--png/pnginfo.h104
1 files changed, 50 insertions, 54 deletions
diff --git a/png/pnginfo.h b/png/pnginfo.h
index 1f98dedc4..584a42f95 100644
--- a/png/pnginfo.h
+++ b/png/pnginfo.h
@@ -1,7 +1,6 @@
-
-/* pnginfo.h - header file for PNG reference library
+/* pnginfo.h - internal structures for libpng
*
- * Copyright (c) 2018 Cosmin Truta
+ * Copyright (c) 2018-2025 Cosmin Truta
* Copyright (c) 1998-2002,2004,2006-2013,2018 Glenn Randers-Pehrson
* Copyright (c) 1996-1997 Andreas Dilger
* Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.
@@ -11,43 +10,20 @@
* and license in png.h
*/
- /* png_info is a structure that holds the information in a PNG file so
- * that the application can find out the characteristics of the image.
- * If you are reading the file, this structure will tell you what is
- * in the PNG file. If you are writing the file, fill in the information
- * you want to put into the PNG file, using png_set_*() functions, then
- * call png_write_info().
- *
- * The names chosen should be very close to the PNG specification, so
- * consult that document for information about the meaning of each field.
- *
- * With libpng < 0.95, it was only possible to directly set and read the
- * the values in the png_info_struct, which meant that the contents and
- * order of the values had to remain fixed. With libpng 0.95 and later,
- * however, there are now functions that abstract the contents of
- * png_info_struct from the application, so this makes it easier to use
- * libpng with dynamic libraries, and even makes it possible to use
- * libraries that don't have all of the libpng ancillary chunk-handing
- * functionality. In libpng-1.5.0 this was moved into a separate private
- * file that is not visible to applications.
+#ifndef PNGPRIV_H
+# error This file must not be included by applications; please include <png.h>
+#endif
+
+/* INTERNAL, PRIVATE definition of a PNG.
*
- * The following members may have allocated storage attached that should be
- * cleaned up before the structure is discarded: palette, trans, text,
- * pcal_purpose, pcal_units, pcal_params, hist, iccp_name, iccp_profile,
- * splt_palettes, scal_unit, row_pointers, and unknowns. By default, these
- * are automatically freed when the info structure is deallocated, if they were
- * allocated internally by libpng. This behavior can be changed by means
- * of the png_data_freer() function.
+ * png_info is a modifiable description of a PNG datastream. The fields inside
+ * this structure are accessed through png_get_<CHUNK>() functions and modified
+ * using png_set_<CHUNK>() functions.
*
- * More allocation details: all the chunk-reading functions that
- * change these members go through the corresponding png_set_*
- * functions. A function to clear these members is available: see
- * png_free_data(). The png_set_* functions do not depend on being
- * able to point info structure members to any of the storage they are
- * passed (they make their own copies), EXCEPT that the png_set_text
- * functions use the same storage passed to them in the text_ptr or
- * itxt_ptr structure argument, and the png_set_rows and png_set_unknowns
- * functions do not make their own copies.
+ * Some functions in libpng do directly access members of png_info. However,
+ * this should be avoided. png_struct objects contain members which hold
+ * caches, sometimes optimised, of the values from png_info objects, and
+ * png_info is not passed to the functions which read and write image data.
*/
#ifndef PNGINFO_H
#define PNGINFO_H
@@ -87,18 +63,12 @@ struct png_info_def
* and initialize the appropriate fields below.
*/
-#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
- /* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
- * defined. When COLORSPACE is switched on all the colorspace-defining
- * chunks should be enabled, when GAMMA is switched on all the gamma-defining
- * chunks should be enabled. If this is not done it becomes possible to read
- * inconsistent PNG files and assign a probably incorrect interpretation to
- * the information. (In other words, by carefully choosing which chunks to
- * recognize the system configuration can select an interpretation for PNG
- * files containing ambiguous data and this will result in inconsistent
- * behavior between different libpng builds!)
- */
- png_colorspace colorspace;
+#ifdef PNG_cICP_SUPPORTED
+ /* cICP chunk data */
+ png_byte cicp_colour_primaries;
+ png_byte cicp_transfer_function;
+ png_byte cicp_matrix_coefficients;
+ png_byte cicp_video_full_range_flag;
#endif
#ifdef PNG_iCCP_SUPPORTED
@@ -108,6 +78,24 @@ struct png_info_def
png_uint_32 iccp_proflen; /* ICC profile data length */
#endif
+#ifdef PNG_cLLI_SUPPORTED
+ png_uint_32 maxCLL; /* cd/m2 (nits) * 10,000 */
+ png_uint_32 maxFALL;
+#endif
+
+#ifdef PNG_mDCV_SUPPORTED
+ png_uint_16 mastering_red_x; /* CIE (xy) x * 50,000 */
+ png_uint_16 mastering_red_y;
+ png_uint_16 mastering_green_x;
+ png_uint_16 mastering_green_y;
+ png_uint_16 mastering_blue_x;
+ png_uint_16 mastering_blue_y;
+ png_uint_16 mastering_white_x;
+ png_uint_16 mastering_white_y;
+ png_uint_32 mastering_maxDL; /* cd/m2 (nits) * 10,000 */
+ png_uint_32 mastering_minDL;
+#endif
+
#ifdef PNG_TEXT_SUPPORTED
/* The tEXt, and zTXt chunks contain human-readable textual data in
* uncompressed, compressed, and optionally compressed forms, respectively.
@@ -186,11 +174,8 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
#endif
#ifdef PNG_eXIf_SUPPORTED
- int num_exif; /* Added at libpng-1.6.31 */
+ png_uint_32 num_exif; /* Added at libpng-1.6.31 */
png_bytep exif;
-# ifdef PNG_READ_eXIf_SUPPORTED
- png_bytep eXIf_buf; /* Added at libpng-1.6.32 */
-# endif
#endif
#ifdef PNG_hIST_SUPPORTED
@@ -263,5 +248,16 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
png_bytepp row_pointers; /* the image bits */
#endif
+#ifdef PNG_cHRM_SUPPORTED
+ png_xy cHRM;
+#endif
+
+#ifdef PNG_gAMA_SUPPORTED
+ png_fixed_point gamma;
+#endif
+
+#ifdef PNG_sRGB_SUPPORTED
+ int rendering_intent;
+#endif
};
#endif /* PNGINFO_H */