pub trait Mix {
type Scalar;
// Required method
fn mix(self, other: Self, factor: Self::Scalar) -> Self;
}
Expand description
Linear color interpolation of two colors.
See also MixAssign
.
use approx::assert_relative_eq;
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_relative_eq!(a.mix(b, 0.0), a);
assert_relative_eq!(a.mix(b, 0.5), LinSrgb::new(0.5, 0.5, 0.5));
assert_relative_eq!(a.mix(b, 1.0), b);
Required Associated Types§
Required Methods§
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.