Trait palette::Mix
[−]
[src]
pub trait Mix { type Scalar: Float; fn mix(&self, other: &Self, factor: Self::Scalar) -> Self; }
A trait for linear color interpolation.
use palette::{Rgb, Mix}; let a = Rgb::new(0.0, 0.5, 1.0); let b = Rgb::new(1.0, 0.5, 0.0); assert_eq!(a.mix(&b, 0.0), a); assert_eq!(a.mix(&b, 0.5), Rgb::new(0.5, 0.5, 0.5)); assert_eq!(a.mix(&b, 1.0), b);
Associated Types
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>
impl<C: Mix> Mix for Alpha<C, C::Scalar>
impl<T: Float> Mix for Rgb<T>
impl<T: Float> Mix for Luma<T>
impl<T: Float> Mix for Yxy<T>
impl<T: Float> Mix for Xyz<T>
impl<T: Float> Mix for Lab<T>
impl<T: Float> Mix for Lch<T>
impl<T: Float> Mix for Hsv<T>
impl<T: Float> Mix for Hsl<T>
impl<T: Float> Mix for Hwb<T>
impl<T: Float> Mix for Color<T>