Trait nannou::color::Mix[][src]

pub trait Mix {
    type Scalar: Float;
    pub fn mix(&self, other: &Self, factor: Self::Scalar) -> Self;
}

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

type Scalar: Float[src]

The type of the mixing factor.

Loading content...

Required methods

pub fn mix(&self, other: &Self, factor: Self::Scalar) -> Self[src]

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.

Loading content...

Implementors

impl<C> Mix for PreAlpha<C, <C as Mix>::Scalar> where
    C: Mix
[src]

type Scalar = <C as Mix>::Scalar

impl<C> Mix for Alpha<C, <C as Mix>::Scalar> where
    C: Mix
[src]

type Scalar = <C as Mix>::Scalar

impl<S, T> Mix for Rgb<S, T> where
    S: RgbStandard<TransferFn = LinearFn>,
    T: Component + Float
[src]

type Scalar = T

impl<S, T> Mix for Hsl<S, T> where
    S: RgbSpace,
    T: Component + Float
[src]

type Scalar = T

impl<S, T> Mix for Hsv<S, T> where
    S: RgbSpace,
    T: Component + Float
[src]

type Scalar = T

impl<S, T> Mix for Luma<S, T> where
    S: LumaStandard<TransferFn = LinearFn>,
    T: Component + Float
[src]

type Scalar = T

impl<S, T> Mix for Hwb<S, T> where
    S: RgbSpace,
    T: Component + Float
[src]

type Scalar = T

impl<Wp, T> Mix for Lab<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Scalar = T

impl<Wp, T> Mix for Lch<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Scalar = T

impl<Wp, T> Mix for Xyz<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Scalar = T

impl<Wp, T> Mix for Yxy<Wp, T> where
    T: Component + Float,
    Wp: WhitePoint
[src]

type Scalar = T

Loading content...