pub trait AdaptIntoUnclamped<T>: Sized {
type Scalar;
// Required method
fn adapt_into_unclamped_with<M>(self) -> T
where M: LmsToXyz<Self::Scalar> + XyzToLms<Self::Scalar>;
// Provided method
fn adapt_into_unclamped(self) -> T
where Bradford: LmsToXyz<Self::Scalar> + XyzToLms<Self::Scalar> { ... }
}Expand description
A trait for unchecked conversion of one color into another via chromatic adaptation.
See IntoColor,
TryIntoColor and IntoColorUnclamped
for when there’s no need for chromatic adaptation.
Some conversions require the reference white point to be changed, while
maintaining the appearance of the color. This is called “chromatic
adaptation” or “white balancing”, and typically involves converting the
color to the Lms color space. This trait defaults to using the
Bradford matrix as part of the process, but other options are available
in lms::matrix.
The adaptation_matrix function offers more options and control. This
trait can be a convenient alternative when the source and destination white
points are statically known.
Required Associated Types§
Required Methods§
Sourcefn adapt_into_unclamped_with<M>(self) -> T
fn adapt_into_unclamped_with<M>(self) -> T
Adapt a color of type Self into a color of type T, using the custom
matrix M.
use palette::{
Xyz, white_point::{A, C}, lms::matrix::VonKries,
chromatic_adaptation::AdaptIntoUnclamped,
};
let input = Xyz::<A, f32>::new(0.315756, 0.162732, 0.015905);
//Will convert Xyz<A, f32> to Xyz<C, f32> using von Kries chromatic adaptation:
let output: Xyz<C, f32> = input.adapt_into_unclamped_with::<VonKries>();Provided Methods§
Sourcefn adapt_into_unclamped(self) -> T
fn adapt_into_unclamped(self) -> T
Adapt a color of type Self into a color of type T, using the
Bradford matrix.
use palette::{
Xyz, white_point::{A, C},
chromatic_adaptation::AdaptIntoUnclamped,
};
let input = Xyz::<A, f32>::new(0.315756, 0.162732, 0.015905);
//Will convert Xyz<A, f32> to Xyz<C, f32> using Bradford chromatic adaptation:
let output: Xyz<C, f32> = input.adapt_into_unclamped();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.