pub trait ColorSpaceConversion {
const WHITE_POINT: WhitePoint;
// Required methods
fn to_linear_light(from: &ColorComponents) -> ColorComponents;
fn to_xyz(from: &ColorComponents) -> ColorComponents;
fn from_xyz(from: &ColorComponents) -> ColorComponents;
fn to_gamma_encoded(from: &ColorComponents) -> ColorComponents;
}
Expand description
A trait that allows conversion of color spaces to and from XYZ coordinate space with a specified white point.
Allows following the specified method of converting between color spaces:
- Convert to values to sRGB linear light.
- Convert to XYZ coordinate space.
- Adjust white point to target white point.
- Convert to sRGB linear light in target color space.
- Convert to sRGB gamma encoded in target color space.
https://drafts.csswg.org/css-color-4/#color-conversion
Required Associated Constants§
Sourceconst WHITE_POINT: WhitePoint
const WHITE_POINT: WhitePoint
The white point that the implementer is represented in.
Required Methods§
Sourcefn to_linear_light(from: &ColorComponents) -> ColorComponents
fn to_linear_light(from: &ColorComponents) -> ColorComponents
Convert the components from sRGB gamma encoded values to sRGB linear light values.
Sourcefn to_xyz(from: &ColorComponents) -> ColorComponents
fn to_xyz(from: &ColorComponents) -> ColorComponents
Convert the components from sRGB linear light values to XYZ coordinate space.
Sourcefn from_xyz(from: &ColorComponents) -> ColorComponents
fn from_xyz(from: &ColorComponents) -> ColorComponents
Convert the components from XYZ coordinate space to sRGB linear light values.
Sourcefn to_gamma_encoded(from: &ColorComponents) -> ColorComponents
fn to_gamma_encoded(from: &ColorComponents) -> ColorComponents
Convert the components from sRGB linear light values to sRGB gamma encoded values.
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.