Skip to main content

ColorAuthority

Enum ColorAuthority 

Source
pub enum ColorAuthority {
    Icc,
    Cicp,
}
Expand description

Which color metadata a CMS should prefer when building transforms.

When both ICC and CICP are present, this determines which one the CMS uses. When only one is present, it is used regardless of this flag — the authority controls precedence, not exclusivity.

Codec contract: codecs should set this to match the data they actually provide. Setting Icc without populating icc_profile (or Cicp without cicp) is a codec bug. Implementations may fall back to the other field when the authoritative one is absent, but are not required to — they may also treat the mismatch as an error or assume sRGB.

ColorContext::as_profile_source implements a lenient resolution: preferred field → other field → None. Stricter consumers can inspect the authority and the fields directly.

The codec sets this during decode based on the format’s specification:

  • JPEG, WebP, TIFF: Icc (ICC is the only color signal)
  • PNG 3rd Ed: Cicp when cICP chunk present, Icc when only iCCP
  • AVIF/MIAF: Icc when ICC colr box present, Cicp otherwise
  • HEIC/HEIF: Cicp when nclx colr box present, Icc otherwise
  • JPEG XL: Cicp when enum encoding (want_icc=false), Icc when embedded ICC

Both icc_profile and cicp may be populated regardless of this flag — the non-authoritative field is preserved for metadata roundtripping.

This is distinct from ColorProvenance which records how the source described its color (for re-encoding decisions). ColorAuthority says which field the CMS should prefer for building transforms.

Variants§

§

Icc

ICC profile bytes take precedence for CMS transforms.

The CMS should parse icc_profile and use its TRC curves directly. Any CICP tag embedded inside the ICC should NOT override the TRC (i.e., allow_use_cicp_transfer: false in moxcms terms).

Codecs should only set this when icc_profile is populated. Lenient consumers may fall back to cicp if ICC is absent.

§

Cicp

CICP codes take precedence for CMS transforms.

The CMS should build a source profile from the cicp field (e.g., ColorProfile::new_from_cicp() in moxcms). The ICC profile, if present, is for backwards-compatible metadata roundtripping only.

Codecs should only set this when cicp is populated. Lenient consumers may fall back to icc_profile if CICP is absent.

Trait Implementations§

Source§

impl Clone for ColorAuthority

Source§

fn clone(&self) -> ColorAuthority

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for ColorAuthority

Source§

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

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

impl Default for ColorAuthority

Source§

fn default() -> ColorAuthority

Returns the “default value” for a type. Read more
Source§

impl Hash for ColorAuthority

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for ColorAuthority

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for ColorAuthority

Source§

impl Eq for ColorAuthority

Source§

impl StructuralPartialEq for ColorAuthority

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.