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:
Cicpwhen cICP chunk present,Iccwhen only iCCP - AVIF/MIAF:
Iccwhen ICC colr box present,Cicpotherwise - HEIC/HEIF:
Cicpwhen nclx colr box present,Iccotherwise - JPEG XL:
Cicpwhen enum encoding (want_icc=false),Iccwhen 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
impl Clone for ColorAuthority
Source§fn clone(&self) -> ColorAuthority
fn clone(&self) -> ColorAuthority
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more