Skip to main content

SynthesizedIcc

Enum SynthesizedIcc 

Source
#[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
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
§

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

Source

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.

Source

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

Source§

fn clone(&self) -> SynthesizedIcc

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for SynthesizedIcc

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for SynthesizedIcc

Source§

impl PartialEq for SynthesizedIcc

Source§

fn eq(&self, other: &SynthesizedIcc) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for SynthesizedIcc

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.