#[non_exhaustive]pub struct ColorContext {
pub icc: Option<Arc<[u8]>>,
pub cicp: Option<Cicp>,
pub color_authority: ColorAuthority,
}Expand description
Color space metadata for pixel data.
Bundles ICC profile bytes and/or CICP parameters into a single
shareable context. Carried via Arc on pixel slices and pipeline
sources so color metadata travels with pixel data without per-strip
cloning overhead.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.icc: Option<Arc<[u8]>>Raw ICC profile bytes.
cicp: Option<Cicp>CICP parameters (ITU-T H.273).
Which field the CMS should treat as authoritative for transforms.
Implementations§
Source§impl ColorContext
impl ColorContext
Sourcepub fn from_cicp(cicp: Cicp) -> ColorContext
pub fn from_cicp(cicp: Cicp) -> ColorContext
Create from CICP parameters.
Sourcepub fn from_icc_and_cicp(icc: impl Into<Arc<[u8]>>, cicp: Cicp) -> ColorContext
pub fn from_icc_and_cicp(icc: impl Into<Arc<[u8]>>, cicp: Cicp) -> ColorContext
Create from both ICC and CICP.
Sourcepub fn as_profile_source(&self) -> Option<ColorProfileSource<'_>>
pub fn as_profile_source(&self) -> Option<ColorProfileSource<'_>>
Get a ColorProfileSource reference for CMS integration.
Returns a source based on ColorAuthority: when authority is Cicp,
returns CICP if present; when authority is Icc, returns ICC bytes if
present. In both cases, falls back to the other field if the authoritative
one is absent, and returns None when neither is present.
Sourcepub fn transfer_function(&self) -> TransferFunction
pub fn transfer_function(&self) -> TransferFunction
Derive transfer function from CICP (or Unknown if no CICP).
Trait Implementations§
Source§impl Clone for ColorContext
impl Clone for ColorContext
Source§fn clone(&self) -> ColorContext
fn clone(&self) -> ColorContext
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more