Skip to main content

Transform

Trait Transform 

Source
pub trait Transform<Src, Ctx: ?Sized = ()>: Sized + 'static {
    // Required method
    fn transform_from(src: Src, ctx: &Ctx) -> Self;
}
Expand description

Produce Self from a source color Src infallibly.

Implement for transforms that cannot clip: RGB to XYZ, layout reorders, and transforms between spaces whose gamuts are compatible. A blanket impl provides TryTransform for free.

Ctx defaults to () for static transforms:

TransformCtx
sRGB to XYZ()
Device CMYK to XYZIccProfile
XYZ to CAM16-UCSViewingConditions
Relative XYZ to Absolute XYZf32 (cd/m2)

Required Methods§

Source

fn transform_from(src: Src, ctx: &Ctx) -> Self

Perform the transform.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl Transform<Color<[f32; 3], Oklab>> for Color<[f32; 3], Oklch>

Source§

impl Transform<Color<[f32; 3], Oklab>> for Color<[f32; 3], Xyz<D65>>

Source§

impl Transform<Color<[f32; 3], Oklch>> for Color<[f32; 3], Oklab>

Source§

impl Transform<Color<[f32; 3], Xyz<D65>>> for Color<[f32; 3], Oklab>

Source§

impl<L> Transform<Color<[f32; 3], RgbSpace<P3Primaries, SrgbTf, L>>> for Color<[f32; 3], Srgb<L>>
where L: Asserts<[f32; 3]> + ChannelMap<3> + 'static,

Source§

impl<L> Transform<Color<[f32; 3], RgbSpace<SrgbPrimaries, Rec709Tf, L>>> for Color<[f32; 3], Srgb<L>>
where L: Asserts<[f32; 3]> + ChannelMap<3> + 'static,

Source§

impl<L> Transform<Color<[f32; 3], RgbSpace<SrgbPrimaries, SrgbTf, L>>> for Color<[f32; 3], DisplayP3<L>>
where L: Asserts<[f32; 3]> + ChannelMap<3> + 'static,

Source§

impl<L> Transform<Color<[f32; 3], RgbSpace<SrgbPrimaries, SrgbTf, L>>> for Color<[f32; 3], Rec709<L>>
where L: Asserts<[f32; 3]> + ChannelMap<3> + 'static,

Source§

impl<L> Transform<Color<[f32; 4], RgbSpace<P3Primaries, SrgbTf, L>>> for Color<[f32; 4], Srgb<L>>
where L: Asserts<[f32; 4]> + ChannelMap<4> + 'static,

Source§

impl<L> Transform<Color<[f32; 4], RgbSpace<SrgbPrimaries, Rec709Tf, L>>> for Color<[f32; 4], Srgb<L>>
where L: Asserts<[f32; 4]> + ChannelMap<4> + 'static,

Source§

impl<L> Transform<Color<[f32; 4], RgbSpace<SrgbPrimaries, SrgbTf, L>>> for Color<[f32; 4], DisplayP3<L>>
where L: Asserts<[f32; 4]> + ChannelMap<4> + 'static,

Source§

impl<L> Transform<Color<[f32; 4], RgbSpace<SrgbPrimaries, SrgbTf, L>>> for Color<[f32; 4], Rec709<L>>
where L: Asserts<[f32; 4]> + ChannelMap<4> + 'static,

Source§

impl<P, TF, L1, L2> Transform<Color<[f32; 3], RgbSpace<P, TF, L1>>> for Color<[f32; 3], RgbSpace<P, TF, L2>>
where P: Primaries, TF: TransferFunction, L1: Asserts<[f32; 3]> + ChannelMap<3> + 'static, L2: Asserts<[f32; 3]> + ChannelMap<3> + 'static,

Source§

impl<P, TF, L1, L2> Transform<Color<[f32; 4], RgbSpace<P, TF, L1>>> for Color<[f32; 4], RgbSpace<P, TF, L2>>
where P: Primaries, TF: TransferFunction, L1: Asserts<[f32; 4]> + ChannelMap<4> + 'static, L2: Asserts<[f32; 4]> + ChannelMap<4> + 'static,

Source§

impl<P, TF, W, L> Transform<Color<[f32; 3], RgbSpace<P, TF, L>>> for Color<[f32; 3], Xyz<W>>
where P: Primaries + PrimariesToXyz<W, Bradford>, TF: TransferFunction, W: Illuminant, L: Asserts<[f32; 3]> + ChannelMap<3> + 'static, Xyz<W>: Asserts<[f32; 3]>,

Source§

impl<P, TF, W, L> Transform<Color<[f32; 4], RgbSpace<P, TF, L>>> for Color<[f32; 4], Xyz<W>>
where P: Primaries + PrimariesToXyz<W, Bradford>, TF: TransferFunction, W: Illuminant, L: Asserts<[f32; 4]> + ChannelMap<4> + 'static, Xyz<W>: Asserts<[f32; 4]>,

Source§

impl<W1, W2> Transform<Color<[f32; 3], Xyz<W1>>> for Color<[f32; 3], Xyz<W2>>
where W1: Illuminant, W2: Illuminant,

Source§

impl<W1, W2> Transform<Color<[f32; 4], Xyz<W1>>> for Color<[f32; 4], Xyz<W2>>
where W1: Illuminant, W2: Illuminant,

Source§

impl<W: Illuminant> Transform<Color<[f32; 3], LCh<W>>> for Color<[f32; 3], Lab<W>>

Source§

impl<W: Illuminant> Transform<Color<[f32; 3], Lab<W>>> for Color<[f32; 3], LCh<W>>

Source§

impl<W: Illuminant> Transform<Color<[f32; 3], Lab<W>>> for Color<[f32; 3], Xyz<W>>

Source§

impl<W: Illuminant> Transform<Color<[f32; 3], Xyz<W>>> for Color<[f32; 3], Lab<W>>