#[non_exhaustive]pub struct ColorContext {
pub icc: Option<Arc<[u8]>>,
pub cicp: Option<Cicp>,
pub diffuse_white: Option<DiffuseWhite>,
}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).
diffuse_white: Option<DiffuseWhite>Absolute-luminance anchor: the cd/m² (nits) that a relative-linear
sample value of 1.0 represents. None means unsignaled — consumers
default to DiffuseWhite::BT2408 (203 nits, the cross-vendor
convention). Travels with the pixels so the HDR converter can map
relative-linear light to absolute luminance for PQ/HLG encode and
tone-mapping.
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 with_diffuse_white(self, white: DiffuseWhite) -> ColorContext
pub fn with_diffuse_white(self, white: DiffuseWhite) -> ColorContext
Attach an absolute-luminance anchor — the nits that relative-linear
1.0 represents — returning the updated context.
Set this on an HDR working buffer (e.g. after gain-map reconstruction,
where the anchor is DiffuseWhite::BT2408 = 203) so downstream
conversion can map relative-linear light to absolute cd/m² for PQ/HLG
encode and tone-mapping.
Sourcepub fn from_icc_and_cicp(icc: impl Into<Arc<[u8]>>, cicp: Cicp) -> ColorContext
👎Deprecated since 0.2.6: use from_icc() or from_cicp(); roundtrip metadata belongs on ColorOrigin
pub fn from_icc_and_cicp(icc: impl Into<Arc<[u8]>>, cicp: Cicp) -> ColorContext
use from_icc() or from_cicp(); roundtrip metadata belongs on ColorOrigin
Create from both ICC and CICP.
Deprecated: Codecs should populate only the authoritative field —
use from_icc() or from_cicp().
Roundtrip metadata belongs on ColorOrigin, not ColorContext.
Sourcepub fn as_profile_source(&self) -> Option<ColorProfileSource<'_>>
pub fn as_profile_source(&self) -> Option<ColorProfileSource<'_>>
Get a ColorProfileSource reference for CMS integration.
Returns ICC if present, otherwise CICP. Returns None when neither
is present.
Codecs should populate only the authoritative field on ColorContext
at decode time, using ColorAuthority on ColorOrigin to
determine which. When only one field is set, this method returns it.
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ColorContext
impl Debug for ColorContext
Source§impl Default for ColorContext
impl Default for ColorContext
Source§fn default() -> ColorContext
fn default() -> ColorContext
impl Eq for ColorContext
Source§impl PartialEq for ColorContext
impl PartialEq for ColorContext
Source§fn eq(&self, other: &ColorContext) -> bool
fn eq(&self, other: &ColorContext) -> bool
self and other values to be equal, and is used by ==.