Method TryGetCicpColorSpaceExact
- Namespace
- PaintDotNet.Imaging
- Assembly
- PaintDotNet.Windows.Core.dll
TryGetCicpColorSpaceExact(IColorContext, out CicpColorSpace)
Tries to determine the CICP color information for the given ICC color profile, but only when that
CICP is an exact substitute for the profile — that is, either when the color profile has
a cicp tag, or when synthesizing a profile back from the CICP reproduces the original exactly.
public static bool TryGetCicpColorSpaceExact(this IColorContext colorContext, out CicpColorSpace cicpColorSpace)
Parameters
colorContextIColorContextcicpColorSpaceCicpColorSpace
Returns
- bool
trueand the CICP color information if it exactly describes the profile; otherwisefalse.
Remarks
This is the stricter counterpart of TryGetCicpColorSpace(IColorContext, out CicpColorSpace).
That method respects the cicp tag, but if there is no cicp tag then it reports the CICP
that best describes the profile, which may be an approximation (its primaries and transfer are
matched to the nearest known code points). When the cicp tag is not present, this method
additionally verifies the match by round-tripping the candidate CICP back to an ICC profile via
CreateColorContext(IImagingFactory, CicpColorSpace) and comparing
it to the original, succeeding only if the two are equal.
Use this whenever the CICP may be honored in preference to, or instead of, the embedded ICC profile on
load — for example when writing the AVIF nclx box or the PNG cICP chunk. (The exact
precedence when both are present is format- and decoder-dependent; requiring an exact match sidesteps
that entirely, since a CICP that reproduces the profile cannot conflict with it.) Emitting CICP that is
only approximately right could then silently replace the profile with a slightly different one,
potentially shifting color values and discarding anything the profile carried that CICP cannot express:
a tone curve or primaries that are slightly off from a built-in or synthesized profile, extra metadata,
the rendering intent, and so on. Requiring an exact match guarantees the substitution is lossless.