[−][src]Trait palette::Mix
A trait for linear color interpolation.
use palette::{LinSrgb, Mix}; let a = LinSrgb::new(0.0, 0.5, 1.0); let b = LinSrgb::new(1.0, 0.5, 0.0); assert_eq!(a.mix(&b, 0.0), a); assert_eq!(a.mix(&b, 0.5), LinSrgb::new(0.5, 0.5, 0.5)); assert_eq!(a.mix(&b, 1.0), b);
Associated Types
Loading content...Required methods
fn mix(&self, other: &Self, factor: Self::Scalar) -> Self
Mix the color with an other color, by factor
.
factor
sould be between 0.0
and 1.0
, where 0.0
will result in
the same color as self
and 1.0
will result in the same color as
other
.
Implementors
impl<C: Mix> Mix for PreAlpha<C, C::Scalar>
[src]
type Scalar = C::Scalar
fn mix(
&self,
other: &PreAlpha<C, C::Scalar>,
factor: C::Scalar
) -> PreAlpha<C, C::Scalar>
[src]
&self,
other: &PreAlpha<C, C::Scalar>,
factor: C::Scalar
) -> PreAlpha<C, C::Scalar>
impl<C: Mix> Mix for Alpha<C, C::Scalar>
[src]
type Scalar = C::Scalar
fn mix(
&self,
other: &Alpha<C, C::Scalar>,
factor: C::Scalar
) -> Alpha<C, C::Scalar>
[src]
&self,
other: &Alpha<C, C::Scalar>,
factor: C::Scalar
) -> Alpha<C, C::Scalar>
impl<S, T> Mix for Color<S, T> where
T: Float + Component,
S: RgbSpace,
[src]
T: Float + Component,
S: RgbSpace,
impl<S, T> Mix for Luma<S, T> where
T: Component + Float,
S: LumaStandard<TransferFn = LinearFn>,
[src]
T: Component + Float,
S: LumaStandard<TransferFn = LinearFn>,
impl<S, T> Mix for Rgb<S, T> where
S: RgbStandard<TransferFn = LinearFn>,
T: Component + Float,
[src]
S: RgbStandard<TransferFn = LinearFn>,
T: Component + Float,
impl<S, T> Mix for Hsl<S, T> where
T: Component + Float,
S: RgbSpace,
[src]
T: Component + Float,
S: RgbSpace,
impl<S, T> Mix for Hsv<S, T> where
T: Component + Float,
S: RgbSpace,
[src]
T: Component + Float,
S: RgbSpace,
impl<S, T> Mix for Hwb<S, T> where
T: Component + Float,
S: RgbSpace,
[src]
T: Component + Float,
S: RgbSpace,
impl<Wp, T> Mix for Lab<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
[src]
T: Component + Float,
Wp: WhitePoint,
impl<Wp, T> Mix for Lch<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
[src]
T: Component + Float,
Wp: WhitePoint,
impl<Wp, T> Mix for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
[src]
T: Component + Float,
Wp: WhitePoint,
impl<Wp, T> Mix for Yxy<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
[src]
T: Component + Float,
Wp: WhitePoint,