@@ -25,6 +25,70 @@ class PngColorType {
2525
2626enum PngFilterType { none, sub, up, average, paeth }
2727
28+ /// Colour information for the image from a cICP chunk, also known as
29+ /// "Coding-independent code points" (CICP).
30+ ///
31+ /// The values are defined by ITU-T H.273. Presence of a cICP chunk signals
32+ /// that the image pixel data uses the specified colour space (typically
33+ /// Display P3 or BT.2020) instead of the default sRGB assumed by older
34+ /// decoders.
35+ ///
36+ /// See <https://www.w3.org/TR/png-3/#cICP-chunk>.
37+ class PngCicpData {
38+ /// Colour primaries, as defined in ITU-T H.273 Table 2.
39+ ///
40+ /// Common values:
41+ /// - 1 = BT.709 / sRGB
42+ /// - 9 = BT.2020
43+ /// - 12 = Display P3
44+ final int colourPrimaries;
45+
46+ /// Transfer characteristics, as defined in ITU-T H.273 Table 3.
47+ ///
48+ /// Common values:
49+ /// - 1 = BT.709 (≈ sRGB)
50+ /// - 13 = sRGB / Display P3
51+ /// - 16 = ST 2084 (PQ, HDR)
52+ final int transferCharacteristics;
53+
54+ /// Matrix coefficients, as defined in ITU-T H.273 Table 4.
55+ ///
56+ /// For still images this MUST be 0 (identity / RGB).
57+ final int matrixCoefficients;
58+
59+ /// Video full range flag.
60+ ///
61+ /// 0 = narrow / limited range (16–235).
62+ /// 1 = full range (0–255).
63+ final int videoFullRangeFlag;
64+
65+ const PngCicpData ({
66+ required this .colourPrimaries,
67+ required this .transferCharacteristics,
68+ required this .matrixCoefficients,
69+ required this .videoFullRangeFlag,
70+ });
71+
72+ @override
73+ int get hashCode => Object .hash (colourPrimaries, transferCharacteristics,
74+ matrixCoefficients, videoFullRangeFlag);
75+
76+ @override
77+ bool operator == (Object other) =>
78+ other is PngCicpData &&
79+ other.colourPrimaries == colourPrimaries &&
80+ other.transferCharacteristics == transferCharacteristics &&
81+ other.matrixCoefficients == matrixCoefficients &&
82+ other.videoFullRangeFlag == videoFullRangeFlag;
83+
84+ @override
85+ String toString () => 'PngCicpData('
86+ 'primaries=$colourPrimaries , '
87+ 'transfer=$transferCharacteristics , '
88+ 'matrix=$matrixCoefficients , '
89+ 'fullRange=$videoFullRangeFlag )' ;
90+ }
91+
2892/// The intended physical pixel size of the image.
2993/// See <https://www.w3.org/TR/png-3/#11pHYs>.
3094class PngPhysicalPixelDimensions {
@@ -90,6 +154,7 @@ class PngInfo implements DecodeInfo {
90154 Uint8List ? iccpData;
91155 Map <String , String > textData = {};
92156 PngPhysicalPixelDimensions ? pixelDimensions;
157+ PngCicpData ? cicpData;
93158
94159 // APNG extensions
95160 @override
0 commit comments