#[repr(C)]pub struct Xyz<Wp = D65, T = f32> where
T: FloatComponent,
Wp: WhitePoint, {
pub x: T,
pub y: T,
pub z: T,
pub white_point: PhantomData<Wp>,
}
Expand description
The CIE 1931 XYZ color space.
XYZ links the perceived colors to their wavelengths and simply makes it possible to describe the way we see colors as numbers. It’s often used when converting from one color space to an other, and requires a standard illuminant and a standard observer to be defined.
Conversions and operations on this color space depend on the defined white point
Fields
x: T
X is the scale of what can be seen as a response curve for the cone cells in the human eye. Its range depends on the white point and goes from 0.0 to 0.95047 for the default D65.
y: T
Y is the luminance of the color, where 0.0 is black and 1.0 is white.
z: T
Z is the scale of what can be seen as the blue stimulation. Its range depends on the white point and goes from 0.0 to 1.08883 for the default D65.
white_point: PhantomData<Wp>
The white point associated with the color’s illuminant and observer. D65 for 2 degree observer is used by default.
Implementations
sourceimpl<T> Xyz<D65, T> where
T: FloatComponent,
impl<T> Xyz<D65, T> where
T: FloatComponent,
sourceimpl<Wp, T> Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourcepub fn into_components(self) -> (T, T, T)
pub fn into_components(self) -> (T, T, T)
Convert to a (X, Y, Z)
tuple.
sourcepub fn from_components((x, y, z): (T, T, T)) -> Self
pub fn from_components((x, y, z): (T, T, T)) -> Self
Convert from a (X, Y, Z)
tuple.
Trait Implementations
sourceimpl<Wp, T> AbsDiffEq<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + AbsDiffEq,
T::Epsilon: Copy + FloatComponent,
Wp: WhitePoint + PartialEq,
impl<Wp, T> AbsDiffEq<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + AbsDiffEq,
T::Epsilon: Copy + FloatComponent,
Wp: WhitePoint + PartialEq,
sourcefn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
sourcefn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
sourcefn abs_diff_ne(&self, other: &Self, epsilon: T::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Self, epsilon: T::Epsilon) -> bool
The inverse of AbsDiffEq::abs_diff_eq
.
sourceimpl<Wp, T> Add<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Add<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> Add<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Add<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> AddAssign<T> for Xyz<Wp, T> where
T: FloatComponent + AddAssign,
Wp: WhitePoint,
impl<Wp, T> AddAssign<T> for Xyz<Wp, T> where
T: FloatComponent + AddAssign,
Wp: WhitePoint,
sourcefn add_assign(&mut self, c: T)
fn add_assign(&mut self, c: T)
Performs the +=
operation. Read more
sourceimpl<Wp, T> AddAssign<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + AddAssign,
Wp: WhitePoint,
impl<Wp, T> AddAssign<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + AddAssign,
Wp: WhitePoint,
sourcefn add_assign(&mut self, other: Xyz<Wp, T>)
fn add_assign(&mut self, other: Xyz<Wp, T>)
Performs the +=
operation. Read more
sourceimpl<Wp, T, P> AsMut<P> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
P: RawPixel<T> + ?Sized,
impl<Wp, T, P> AsMut<P> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
P: RawPixel<T> + ?Sized,
sourceimpl<Wp, T, P> AsRef<P> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
P: RawPixel<T> + ?Sized,
impl<Wp, T, P> AsRef<P> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
P: RawPixel<T> + ?Sized,
sourceimpl<Wp, T> Clamp for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Clamp for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourcefn is_within_bounds(&self) -> bool
fn is_within_bounds(&self) -> bool
Check if the color’s components are within the expected clamped range bounds. Read more
sourcefn clamp(&self) -> Xyz<Wp, T>
fn clamp(&self) -> Xyz<Wp, T>
Return a new color where the components have been clamped to the nearest valid values. Read more
sourcefn clamp_self(&mut self)
fn clamp_self(&mut self)
Clamp the color’s components to the nearest valid values.
sourceimpl<Wp, T> Clone for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Clone for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> ComponentWise for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> ComponentWise for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
type Scalar = T
type Scalar = T
The scalar type for color components.
sourcefn component_wise<F: FnMut(T, T) -> T>(
&self,
other: &Xyz<Wp, T>,
f: F
) -> Xyz<Wp, T>
fn component_wise<F: FnMut(T, T) -> T>(
&self,
other: &Xyz<Wp, T>,
f: F
) -> Xyz<Wp, T>
Perform a binary operation on this and an other color.
sourcefn component_wise_self<F: FnMut(T) -> T>(&self, f: F) -> Xyz<Wp, T>
fn component_wise_self<F: FnMut(T) -> T>(&self, f: F) -> Xyz<Wp, T>
Perform a unary operation on this color.
sourceimpl<Wp: Debug, T: Debug> Debug for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp: Debug, T: Debug> Debug for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> Default for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Default for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> Div<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Div<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> Div<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Div<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> DivAssign<T> for Xyz<Wp, T> where
T: FloatComponent + DivAssign,
Wp: WhitePoint,
impl<Wp, T> DivAssign<T> for Xyz<Wp, T> where
T: FloatComponent + DivAssign,
Wp: WhitePoint,
sourcefn div_assign(&mut self, c: T)
fn div_assign(&mut self, c: T)
Performs the /=
operation. Read more
sourceimpl<Wp, T> DivAssign<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + DivAssign,
Wp: WhitePoint,
impl<Wp, T> DivAssign<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + DivAssign,
Wp: WhitePoint,
sourcefn div_assign(&mut self, other: Xyz<Wp, T>)
fn div_assign(&mut self, other: Xyz<Wp, T>)
Performs the /=
operation. Read more
sourceimpl<Wp: WhitePoint, T: FloatComponent> From<(T, T, T)> for Xyz<Wp, T>
impl<Wp: WhitePoint, T: FloatComponent> From<(T, T, T)> for Xyz<Wp, T>
sourceimpl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
impl<Wp, T, _C, _A> FromColorUnclamped<Alpha<_C, _A>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
_C: IntoColorUnclamped<Self>,
_A: Component,
sourcefn from_color_unclamped(color: Alpha<_C, _A>) -> Self
fn from_color_unclamped(color: Alpha<_C, _A>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hsl<_S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hsl<_S, T>) -> Self
fn from_color_unclamped(color: Hsl<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Hsluv<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Hsluv<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(color: Hsluv<Wp, T>) -> Self
fn from_color_unclamped(color: Hsluv<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hsv<_S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hsv<_S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hsv<_S, T>) -> Self
fn from_color_unclamped(color: Hsv<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, _S> FromColorUnclamped<Hwb<_S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, _S> FromColorUnclamped<Hwb<_S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
_S: RgbStandard,
_S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Hwb<_S, T>) -> Self
fn from_color_unclamped(color: Hwb<_S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Lab<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> FromColorUnclamped<Lab<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourcefn from_color_unclamped(color: Lab<Wp, T>) -> Self
fn from_color_unclamped(color: Lab<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Lch<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Lch<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(color: Lch<Wp, T>) -> Self
fn from_color_unclamped(color: Lch<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Lchuv<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Lchuv<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(color: Lchuv<Wp, T>) -> Self
fn from_color_unclamped(color: Lchuv<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, S> FromColorUnclamped<Luma<S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, S> FromColorUnclamped<Luma<S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
S: LumaStandard<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Luma<S, T>) -> Self
fn from_color_unclamped(color: Luma<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Luv<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> FromColorUnclamped<Luv<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourcefn from_color_unclamped(color: Luv<Wp, T>) -> Self
fn from_color_unclamped(color: Luv<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T> FromColorUnclamped<Oklab<T>> for Xyz<D65, T> where
T: FloatComponent,
impl<T> FromColorUnclamped<Oklab<T>> for Xyz<D65, T> where
T: FloatComponent,
sourcefn from_color_unclamped(color: Oklab<T>) -> Self
fn from_color_unclamped(color: Oklab<T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T> FromColorUnclamped<Oklch<T>> for Xyz<D65, T> where
T: FloatComponent,
impl<T> FromColorUnclamped<Oklch<T>> for Xyz<D65, T> where
T: FloatComponent,
sourcefn from_color_unclamped(color: Oklch<T>) -> Self
fn from_color_unclamped(color: Oklch<T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T, S> FromColorUnclamped<Rgb<S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
S: RgbStandard,
S::Space: RgbSpace<WhitePoint = Wp>,
impl<Wp, T, S> FromColorUnclamped<Rgb<S, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
S: RgbStandard,
S::Space: RgbSpace<WhitePoint = Wp>,
sourcefn from_color_unclamped(color: Rgb<S, T>) -> Self
fn from_color_unclamped(color: Rgb<S, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsl<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsv<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hsv<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hwb<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Hwb<S, T> where
T: FloatComponent,
S: RgbStandard,
T: FloatComponent,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Rgb<S, T> where
S: RgbStandard,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Rgb<S, T> where
S: RgbStandard,
T: FloatComponent,
sourcefn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
fn from_color_unclamped(
color: Xyz<<S::Space as RgbSpace>::WhitePoint, T>
) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<S, T> FromColorUnclamped<Xyz<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
S: LumaStandard,
T: FloatComponent,
impl<S, T> FromColorUnclamped<Xyz<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
S: LumaStandard,
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<S::WhitePoint, T>) -> Self
fn from_color_unclamped(color: Xyz<S::WhitePoint, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T> FromColorUnclamped<Xyz<D65, T>> for Oklab<T> where
T: FloatComponent,
impl<T> FromColorUnclamped<Xyz<D65, T>> for Oklab<T> where
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<D65, T>) -> Self
fn from_color_unclamped(color: Xyz<D65, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<T> FromColorUnclamped<Xyz<D65, T>> for Oklch<T> where
T: FloatComponent,
impl<T> FromColorUnclamped<Xyz<D65, T>> for Oklch<T> where
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<D65, T>) -> Self
fn from_color_unclamped(color: Xyz<D65, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Hsluv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Hsluv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<Wp, T>) -> Self
fn from_color_unclamped(color: Xyz<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Lab<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Lab<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<Wp, T>) -> Self
fn from_color_unclamped(color: Xyz<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Lch<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Lch<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<Wp, T>) -> Self
fn from_color_unclamped(color: Xyz<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Lchuv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Lchuv<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<Wp, T>) -> Self
fn from_color_unclamped(color: Xyz<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Luv<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Luv<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<Wp, T>) -> Self
fn from_color_unclamped(color: Xyz<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Xyz<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Xyz<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(color: Xyz<Wp, T>) -> Self
fn from_color_unclamped(color: Xyz<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Yxy<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> FromColorUnclamped<Xyz<Wp, T>> for Yxy<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
sourcefn from_color_unclamped(xyz: Xyz<Wp, T>) -> Self
fn from_color_unclamped(xyz: Xyz<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp, T> FromColorUnclamped<Yxy<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> FromColorUnclamped<Yxy<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourcefn from_color_unclamped(color: Yxy<Wp, T>) -> Self
fn from_color_unclamped(color: Yxy<Wp, T>) -> Self
Convert from T. The resulting color might be invalid in its color space. Read more
sourceimpl<Wp: WhitePoint, T: FloatComponent> Into<(T, T, T)> for Xyz<Wp, T>
impl<Wp: WhitePoint, T: FloatComponent> Into<(T, T, T)> for Xyz<Wp, T>
sourceimpl<Wp, T> Mix for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Mix for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> Mul<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Mul<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> Mul<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Mul<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> MulAssign<T> for Xyz<Wp, T> where
T: FloatComponent + MulAssign,
Wp: WhitePoint,
impl<Wp, T> MulAssign<T> for Xyz<Wp, T> where
T: FloatComponent + MulAssign,
Wp: WhitePoint,
sourcefn mul_assign(&mut self, c: T)
fn mul_assign(&mut self, c: T)
Performs the *=
operation. Read more
sourceimpl<Wp, T> MulAssign<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + MulAssign,
Wp: WhitePoint,
impl<Wp, T> MulAssign<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + MulAssign,
Wp: WhitePoint,
sourcefn mul_assign(&mut self, other: Xyz<Wp, T>)
fn mul_assign(&mut self, other: Xyz<Wp, T>)
Performs the *=
operation. Read more
sourceimpl<Wp, T> PartialEq<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + PartialEq,
Wp: WhitePoint,
impl<Wp, T> PartialEq<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + PartialEq,
Wp: WhitePoint,
sourceimpl<Wp, T> Pixel<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Pixel<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourcefn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
fn as_raw_mut<P: RawPixel<T> + ?Sized>(&mut self) -> &mut P
Cast as a mutable reference to raw color components.
sourcefn into_raw<P: RawPixelSized<T>>(self) -> P
fn into_raw<P: RawPixelSized<T>>(self) -> P
Convert into raw color components.
sourcefn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
fn from_raw<P: RawPixel<T> + ?Sized>(pixel: &P) -> &Self
Cast from a reference to raw color components.
sourcefn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
fn from_raw_mut<P: RawPixel<T> + ?Sized>(pixel: &mut P) -> &mut Self
Cast from a mutable reference to raw color components.
sourcefn from_raw_slice(slice: &[T]) -> &[Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn from_raw_slice(slice: &[T]) -> &[Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Cast a slice of raw color components to a slice of colors. Read more
sourcefn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
fn from_raw_slice_mut(slice: &mut [T]) -> &mut [Self]ⓘNotable traits for &[u8]impl<'_> Read for &[u8]impl<'_> Write for &mut [u8]
Cast a mutable slice of raw color components to a mutable slice of colors. Read more
sourceimpl<Wp, T> RelativeContrast for Xyz<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
impl<Wp, T> RelativeContrast for Xyz<Wp, T> where
Wp: WhitePoint,
T: FloatComponent,
type Scalar = T
type Scalar = T
The type of the contrast ratio.
sourcefn get_contrast_ratio(&self, other: &Self) -> T
fn get_contrast_ratio(&self, other: &Self) -> T
Calculate the contrast ratio between two colors.
sourcefn has_min_contrast_text(&self, other: &Self) -> bool
fn has_min_contrast_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.3. Contrast is at least 4.5:1 (Level AA). Read more
sourcefn has_min_contrast_large_text(&self, other: &Self) -> bool
fn has_min_contrast_large_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.3 for large text. Contrast is at least 3:1 (Level AA). Read more
sourcefn has_enhanced_contrast_text(&self, other: &Self) -> bool
fn has_enhanced_contrast_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.6. Contrast is at least 7:1 (Level AAA). Read more
sourcefn has_enhanced_contrast_large_text(&self, other: &Self) -> bool
fn has_enhanced_contrast_large_text(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.6 for large text. Contrast is at least 4.5:1 (Level AAA). Read more
sourcefn has_min_contrast_graphics(&self, other: &Self) -> bool
fn has_min_contrast_graphics(&self, other: &Self) -> bool
Verify the contrast between two colors satisfies SC 1.4.11 for graphical objects. Contrast is at least 3:1 (Level AA). Read more
sourceimpl<Wp, T> RelativeEq<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + RelativeEq,
T::Epsilon: Copy + FloatComponent,
Wp: WhitePoint + PartialEq,
impl<Wp, T> RelativeEq<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + RelativeEq,
T::Epsilon: Copy + FloatComponent,
Wp: WhitePoint + PartialEq,
sourcefn default_max_relative() -> T::Epsilon
fn default_max_relative() -> T::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
sourcefn relative_eq(
&self,
other: &Self,
epsilon: T::Epsilon,
max_relative: T::Epsilon
) -> bool
fn relative_eq(
&self,
other: &Self,
epsilon: T::Epsilon,
max_relative: T::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
sourcefn relative_ne(
&self,
other: &Self,
epsilon: T::Epsilon,
max_relative: T::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Self,
epsilon: T::Epsilon,
max_relative: T::Epsilon
) -> bool
The inverse of RelativeEq::relative_eq
.
sourceimpl<Wp, T> Shade for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Shade for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
type Scalar = T
type Scalar = T
The type of the lighten/darken modifier.
sourcefn lighten(&self, factor: T) -> Xyz<Wp, T>
fn lighten(&self, factor: T) -> Xyz<Wp, T>
Scale the color towards the maximum lightness by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn lighten_fixed(&self, amount: T) -> Xyz<Wp, T>
fn lighten_fixed(&self, amount: T) -> Xyz<Wp, T>
Lighten the color by amount
, a value ranging from 0.0
to 1.0
. Read more
sourcefn darken(&self, factor: Self::Scalar) -> Self
fn darken(&self, factor: Self::Scalar) -> Self
Scale the color towards the minimum lightness by factor
, a value
ranging from 0.0
to 1.0
. Read more
sourcefn darken_fixed(&self, amount: Self::Scalar) -> Self
fn darken_fixed(&self, amount: Self::Scalar) -> Self
Darken the color by amount
, a value ranging from 0.0
to 1.0
. Read more
sourceimpl<Wp, T> Sub<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Sub<T> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> Sub<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Sub<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
sourceimpl<Wp, T> SubAssign<T> for Xyz<Wp, T> where
T: FloatComponent + SubAssign,
Wp: WhitePoint,
impl<Wp, T> SubAssign<T> for Xyz<Wp, T> where
T: FloatComponent + SubAssign,
Wp: WhitePoint,
sourcefn sub_assign(&mut self, c: T)
fn sub_assign(&mut self, c: T)
Performs the -=
operation. Read more
sourceimpl<Wp, T> SubAssign<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + SubAssign,
Wp: WhitePoint,
impl<Wp, T> SubAssign<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + SubAssign,
Wp: WhitePoint,
sourcefn sub_assign(&mut self, other: Xyz<Wp, T>)
fn sub_assign(&mut self, other: Xyz<Wp, T>)
Performs the -=
operation. Read more
sourceimpl<Wp, T> UlpsEq<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + UlpsEq,
T::Epsilon: Copy + FloatComponent,
Wp: WhitePoint + PartialEq,
impl<Wp, T> UlpsEq<Xyz<Wp, T>> for Xyz<Wp, T> where
T: FloatComponent + UlpsEq,
T::Epsilon: Copy + FloatComponent,
Wp: WhitePoint + PartialEq,
sourceimpl<Wp, T, _A> WithAlpha<_A> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
_A: Component,
impl<Wp, T, _A> WithAlpha<_A> for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
_A: Component,
sourcefn with_alpha(self, alpha: _A) -> Self::WithAlpha
fn with_alpha(self, alpha: _A) -> Self::WithAlpha
Transforms the color into a transparent color with the provided
alpha value. If Self
already has a transparency, it is
overwritten. Read more
sourcefn without_alpha(self) -> Self::Color
fn without_alpha(self) -> Self::Color
Removes the transparency from the color. If Self::Color
has
an internal transparency field, that field will be set to
A::max_intensity()
to make it opaque. Read more
sourcefn split(self) -> (Self::Color, _A)
fn split(self) -> (Self::Color, _A)
Splits the color into separate color and transparency values. Read more
sourcefn opaque(self) -> Self::WithAlpha
fn opaque(self) -> Self::WithAlpha
Transforms the color into a fully opaque color with a transparency
field. If Self
already has a transparency, it is overwritten. Read more
sourcefn transparent(self) -> Self::WithAlpha
fn transparent(self) -> Self::WithAlpha
Transforms the color into a fully transparent color. If Self
already has a transparency, it is overwritten. Read more
impl<Wp, T> Copy for Xyz<Wp, T> where
T: FloatComponent,
Wp: WhitePoint,
impl<Wp, T> Eq for Xyz<Wp, T> where
T: FloatComponent + Eq,
Wp: WhitePoint,
Auto Trait Implementations
impl<Wp, T> RefUnwindSafe for Xyz<Wp, T> where
T: RefUnwindSafe,
Wp: RefUnwindSafe,
impl<Wp, T> Send for Xyz<Wp, T> where
T: Send,
Wp: Send,
impl<Wp, T> Sync for Xyz<Wp, T> where
T: Sync,
Wp: Sync,
impl<Wp, T> Unpin for Xyz<Wp, T> where
T: Unpin,
Wp: Unpin,
impl<Wp, T> UnwindSafe for Xyz<Wp, T> where
T: UnwindSafe,
Wp: UnwindSafe,
Blanket Implementations
sourceimpl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColorUnclamped<Xyz<Swp, T>>,
D: FromColorUnclamped<Xyz<Dwp, T>>,
impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColorUnclamped<Xyz<Swp, T>>,
D: FromColorUnclamped<Xyz<Dwp, T>>,
sourcefn adapt_from_using<M>(color: S, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_from_using<M>(color: S, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_from(color: S) -> Self
fn adapt_from(color: S) -> Self
Convert the source color to the destination color using the bradford method by default Read more
sourceimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
sourcefn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford method by default Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, U> FromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
impl<T, U> FromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
sourcefn from_color(t: T) -> U
fn from_color(t: T) -> U
Convert from T with values clamped to the color defined bounds. Read more
sourceimpl<T, U> IntoColor<U> for T where
U: FromColor<T>,
impl<T, U> IntoColor<U> for T where
U: FromColor<T>,
sourcefn into_color(self) -> U
fn into_color(self) -> U
Convert into T with values clamped to the color defined bounds Read more
sourceimpl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
sourcefn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
sourceimpl<T, U> TryFromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
impl<T, U> TryFromColor<T> for U where
U: FromColorUnclamped<T> + Clamp,
sourcefn try_from_color(t: T) -> Result<U, OutOfBounds<U>>
fn try_from_color(t: T) -> Result<U, OutOfBounds<U>>
Convert from T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more
sourceimpl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
sourcefn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more