pub trait ColorManagement {
type Error: Debug;
// Required methods
fn build_transform(
&self,
src_icc: &[u8],
dst_icc: &[u8],
) -> Result<Box<dyn RowTransform>, Self::Error>;
fn identify_profile(&self, icc: &[u8]) -> Option<Cicp>;
}Expand description
Color management system interface.
Abstracts over CMS backends (moxcms, lcms2, etc.) to provide ICC profile transforms and profile identification.
§Feature-gated
The trait is always available for trait bounds and generic code.
Concrete implementations are provided by feature-gated modules
(e.g., cms-moxcms).
Required Associated Types§
Required Methods§
Sourcefn build_transform(
&self,
src_icc: &[u8],
dst_icc: &[u8],
) -> Result<Box<dyn RowTransform>, Self::Error>
fn build_transform( &self, src_icc: &[u8], dst_icc: &[u8], ) -> Result<Box<dyn RowTransform>, Self::Error>
Build a row-level transform between two ICC profiles.
Returns a RowTransform that converts pixel rows from the
source profile’s color space to the destination profile’s.
Sourcefn identify_profile(&self, icc: &[u8]) -> Option<Cicp>
fn identify_profile(&self, icc: &[u8]) -> Option<Cicp>
Identify whether an ICC profile matches a known CICP combination.
Two-tier matching:
- Hash table of known ICC byte sequences for instant lookup.
- Semantic comparison: parse matrix + TRC, compare against known values within tolerance.
Returns Some(cicp) if the profile matches a standard combination,
None if the profile is custom.