Skip to main content

ColorManagement

Trait ColorManagement 

Source
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§

Source

type Error: Debug

Error type for CMS operations.

Required Methods§

Source

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.

Source

fn identify_profile(&self, icc: &[u8]) -> Option<Cicp>

Identify whether an ICC profile matches a known CICP combination.

Two-tier matching:

  1. Hash table of known ICC byte sequences for instant lookup.
  2. 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.

Implementors§