#[non_exhaustive]pub enum SynthesizedIcc {
Profile(Cow<'static, [u8]>),
NotNeeded,
IccDbDisabled,
Unsupported,
}Expand description
Outcome of SynthesizedIcc::for_cicp — what ICC profile (if any) to embed for a
CICP color description, and why there are no bytes when there aren’t.
The point is to make lowering an IccDisposition::SynthesizeFrom explicit:
an implementer can tell apart “got bytes”, “no profile needed”, “we’d need a
CMS for this one”, and “even the CMS couldn’t” — instead of an ambiguous
Option that conflates them.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Profile(Cow<'static, [u8]>)
A profile is available — embed these bytes. From
SynthesizedIcc::for_cicp this is always Cow::Borrowed: either a
bundled &'static const, or a zero-copy slice of a decoded bundle group
held in a 'static cache (no allocation per call). Cow::Owned remains
part of the type for callers that construct their own outcomes.
NotNeeded
No ICC is needed: the CICP is the universally-assumed sRGB / BT.709 default, so omitting a profile loses nothing.
In the encode pipeline this shouldn’t occur — resolve_color_emit never
asks to synthesize for sRGB (its synth_worthwhile test excludes it) — but
it’s surfaced explicitly rather than masquerading as a missing profile.
IccDbDisabled
The requested assigned H.273 pair is covered by the icc-db bundle, which is
disabled in this build (and no curated compact fallback exists for it).
Note that enabling a transform backend (cms-moxcms / cms-lcms) does not
synthesize export bytes here — enable the icc-db feature to serve the full grid.
Unassigned / reserved code points, CIE XYZ RGB (CP=10), and HLG (TC=18)
always return Unsupported regardless of icc-db.
Unsupported
This export path cannot supply a qualified profile for the CICP.
This includes unsupported/reserved code points, CIE XYZ RGB (CP=10), and HLG
without a rendering target. Preserve native CICP where the container permits it;
an ICC-only caller must report the limitation or explicitly convert to a supported output.
Implementations§
Source§impl SynthesizedIcc
impl SynthesizedIcc
Sourcepub fn for_cicp(cicp: Cicp) -> Self
pub fn for_cicp(cicp: Cicp) -> Self
The profile to embed for cicp, by transfer and primaries together.
The input supplies color primaries and transfer only. Matrix coefficients
and signal range describe coded samples and are not applied by synthesis.
The returned RGB profile describes samples after the caller has decoded
the matrix and expanded range. It must not be attached to raw YCbCr or
limited-range code values as though synthesis had converted them.
See the variants and precision caveats for supported combinations.
HLG returns Unsupported without a rendering target.
Sourcepub fn for_gray_cicp(cicp: Cicp) -> Self
pub fn for_gray_cicp(cicp: Cicp) -> Self
The GRAY-class counterpart of for_cicp, for gray images: containers such as
PNG refuse an RGB profile on a gray image.
As with for_cicp, the caller must first decode coded matrix/range;
synthesis describes color and does not transform sample values.
Trait Implementations§
Source§impl Clone for SynthesizedIcc
impl Clone for SynthesizedIcc
Source§fn clone(&self) -> SynthesizedIcc
fn clone(&self) -> SynthesizedIcc
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more