Method TryGetCicpColorSpace
- Namespace
- PaintDotNet.Imaging
- Assembly
- PaintDotNet.Windows.Core.dll
TryGetCicpColorSpace(IColorContext, out CicpColorSpace)
Tries to determine the CICP color information that best describes the given ICC color profile.
This is the inverse of CreateColorContext(IImagingFactory, CicpColorSpace):
it derives the values for e.g. a PNG cICP chunk (or AVIF nclx) from a profile.
public static bool TryGetCicpColorSpace(this IColorContext colorContext, out CicpColorSpace cicpColorSpace)
Parameters
colorContextIColorContextcicpColorSpaceCicpColorSpace
Returns
- bool
trueand the CICP color information if it could be determined; otherwisefalse.
Remarks
Detection proceeds from most to least authoritative: an embedded ICC cicp tag is honored
verbatim; otherwise an RGB matrix/TRC profile is reconstructed by matching its colorants to a known
set of primaries and its transfer curve to a known transfer function. Profiles whose primaries or
transfer cannot be recognized (e.g. Adobe RGB, ProPhoto RGB, CMYK, grayscale, or LUT-only profiles)
yield false.
Except where an embedded cicp tag specifies otherwise, the result always has
MatrixCoefficients of Identity
and VideoFullRangeFlag of Full,
since an ICC profile describes full-range RGB.