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>;
// Provided method
fn build_transform_for_format(
&self,
src_icc: &[u8],
dst_icc: &[u8],
src_format: PixelFormat,
dst_format: PixelFormat,
) -> Result<Box<dyn RowTransform>, Self::Error> { ... }
}use PluggableCms (dyn-safe, ColorProfileSource-based)
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).
§Deprecated
Prefer PluggableCms for new code. ColorManagement is generic,
not dyn-safe, and takes raw ICC byte pairs; PluggableCms is
dyn-safe, accepts ColorProfileSource (ICC / CICP / named /
primaries+transfer), carries ConvertOptions, and composes into
the dispatch chain used by
RowConverter::new_explicit_with_cms.
Required Associated Types§
Required Methods§
Sourcefn build_transform(
&self,
src_icc: &[u8],
dst_icc: &[u8],
) -> Result<Box<dyn RowTransform>, Self::Error>
👎Deprecated since 0.2.8: use PluggableCms (dyn-safe, ColorProfileSource-based)
fn build_transform( &self, src_icc: &[u8], dst_icc: &[u8], ) -> Result<Box<dyn RowTransform>, Self::Error>
use PluggableCms (dyn-safe, ColorProfileSource-based)
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.
This method assumes u8 RGB pixel data. For format-aware transforms
that match the actual source/destination bit depth and layout, use
build_transform_for_format.
Sourcefn identify_profile(&self, icc: &[u8]) -> Option<Cicp>
👎Deprecated since 0.2.8: use PluggableCms (dyn-safe, ColorProfileSource-based)
fn identify_profile(&self, icc: &[u8]) -> Option<Cicp>
use PluggableCms (dyn-safe, ColorProfileSource-based)
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.
Provided Methods§
Sourcefn build_transform_for_format(
&self,
src_icc: &[u8],
dst_icc: &[u8],
src_format: PixelFormat,
dst_format: PixelFormat,
) -> Result<Box<dyn RowTransform>, Self::Error>
👎Deprecated since 0.2.8: use PluggableCms (dyn-safe, ColorProfileSource-based)
fn build_transform_for_format( &self, src_icc: &[u8], dst_icc: &[u8], src_format: PixelFormat, dst_format: PixelFormat, ) -> Result<Box<dyn RowTransform>, Self::Error>
use PluggableCms (dyn-safe, ColorProfileSource-based)
Build a format-aware row-level transform between two ICC profiles.
Like build_transform, but the CMS backend
can use the pixel format information to create a transform at the
native bit depth (u8, u16, or f32) and layout (RGB, RGBA, Gray, etc.),
avoiding unnecessary depth conversions.
The default implementation ignores the format parameters and delegates
to build_transform.