Struct nannou::color::Xyz [−][src]
#[repr(C)]pub struct Xyz<Wp = D65, T = f32> where
T: Component + Float,
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 defautl 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
Trait Implementations
type Epsilon = <T as AbsDiffEq<T>>::Epsilon
type Epsilon = <T as AbsDiffEq<T>>::Epsilon
Used for specifying relative comparisons.
The default tolerance to use when testing values that are close together. Read more
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
The inverse of ApproxEq::abs_diff_eq
.
Performs the +=
operation. Read more
Performs the +=
operation. Read more
type Scalar = T
type Scalar = T
The scalar type for color components.
pub fn component_wise<F>(&self, other: &Xyz<Wp, T>, f: F) -> Xyz<Wp, T> where
F: FnMut(T, T) -> T,
pub fn component_wise<F>(&self, other: &Xyz<Wp, T>, f: F) -> Xyz<Wp, T> where
F: FnMut(T, T) -> T,
Perform a binary operation on this and an other color.
Perform a unary operation on this color.
impl<'de, Wp, T> Deserialize<'de> for Xyz<Wp, T> where
T: Component + Float + Deserialize<'de>,
Wp: WhitePoint,
impl<'de, Wp, T> Deserialize<'de> for Xyz<Wp, T> where
T: Component + Float + Deserialize<'de>,
Wp: WhitePoint,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Xyz<Wp, T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Xyz<Wp, T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the /=
operation. Read more
Performs the /=
operation. Read more
impl<Wp, T, _S> From<Alpha<Luma<_S, T>, T>> for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, _S> From<Alpha<Luma<_S, T>, T>> for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, _S> From<Alpha<Rgb<_S, T>, T>> for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbStandard,
<_S as RgbStandard>::Space: RgbSpace,
<<_S as RgbStandard>::Space as RgbSpace>::WhitePoint == Wp,
impl<Wp, T, _S> From<Alpha<Rgb<_S, T>, T>> for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: RgbStandard,
<_S as RgbStandard>::Space: RgbSpace,
<<_S as RgbStandard>::Space as RgbSpace>::WhitePoint == Wp,
impl<Wp, T, S> From<Luma<S, T>> for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, S> From<Luma<S, T>> for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, S> From<Rgb<S, T>> for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
S: RgbStandard,
<S as RgbStandard>::Space: RgbSpace,
<<S as RgbStandard>::Space as RgbSpace>::WhitePoint == Wp,
impl<Wp, T, S> From<Rgb<S, T>> for Xyz<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
S: RgbStandard,
<S as RgbStandard>::Space: RgbSpace,
<<S as RgbStandard>::Space as RgbSpace>::WhitePoint == Wp,
impl<S, T> From<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Alpha<Rgb<S, T>, T> where
S: RgbStandard,
T: Component + Float,
impl<S, T> From<Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Alpha<Rgb<S, T>, T> where
S: RgbStandard,
T: Component + Float,
pub fn from(
color: Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>
) -> Alpha<Rgb<S, T>, T>
pub fn from(
color: Xyz<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>
) -> Alpha<Rgb<S, T>, T>
Performs the conversion.
impl<S, T> From<Xyz<<S as LumaStandard>::WhitePoint, T>> for Alpha<Luma<S, T>, T> where
T: Component + Float,
S: LumaStandard,
impl<S, T> From<Xyz<<S as LumaStandard>::WhitePoint, T>> for Alpha<Luma<S, T>, T> where
T: Component + Float,
S: LumaStandard,
Performs the conversion.
impl<S, T> From<Xyz<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
S: LumaStandard,
T: Component + Float,
impl<S, T> From<Xyz<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
S: LumaStandard,
T: Component + Float,
Performs the conversion.
impl<S, Wp, T> From<Xyz<Wp, T>> for Rgb<S, T> where
S: RgbStandard,
T: Component + Float,
Wp: WhitePoint,
<S as RgbStandard>::Space: RgbSpace,
<<S as RgbStandard>::Space as RgbSpace>::WhitePoint == Wp,
impl<S, Wp, T> From<Xyz<Wp, T>> for Rgb<S, T> where
S: RgbStandard,
T: Component + Float,
Wp: WhitePoint,
<S as RgbStandard>::Space: RgbSpace,
<<S as RgbStandard>::Space as RgbSpace>::WhitePoint == Wp,
Convert from RGB color space
Convert from HSL color space
Convert from HSV color space
Convert into RGB color space.
Convert into HSL color space
Convert into HSV color space
Return a new color where the components has been clamped to the nearest valid values. Read more
Clamp the color’s components to the nearest valid values.
Performs the *=
operation. Read more
Performs the *=
operation. Read more
Cast as a reference to raw color components.
Cast as a mutable reference to raw color components.
Convert from raw color components.
Cast from a reference to raw color components.
Cast from a mutable reference to raw color components.
Cast a slice of raw color components to a slice of colors. Read more
Cast a mutable slice of raw color components to a mutable slice of colors. Read more
Cast a slice of colors to a slice of raw color components. Read more
The default relative tolerance for testing values that are far-apart. Read more
pub fn relative_eq(
&self,
other: &Xyz<Wp, T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool
pub fn relative_eq(
&self,
other: &Xyz<Wp, T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
pub fn relative_ne(
&self,
other: &Xyz<Wp, T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool
pub fn relative_ne(
&self,
other: &Xyz<Wp, T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool
The inverse of ApproxEq::relative_eq
.
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
pub fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
Performs the -=
operation. Read more
Performs the -=
operation. Read more
The default ULPs to tolerate when testing values that are far-apart. Read more
A test for equality that uses units in the last place (ULP) if the values are far apart.
Auto Trait Implementations
impl<Wp, T> RefUnwindSafe for Xyz<Wp, T> where
T: RefUnwindSafe,
Wp: RefUnwindSafe,
impl<Wp, T> UnwindSafe for Xyz<Wp, T> where
T: UnwindSafe,
Wp: UnwindSafe,
Blanket Implementations
impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColor<Swp, T>,
D: FromColor<Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
S: IntoColor<Swp, T>,
D: FromColor<Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
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: Component + Float,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
Mutably borrows from an owned value. Read more
Convert from T with values clamped to the color defined bounds Read more
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
Convert from T. The resulting color might be invalid in its color space Read more
Convert into T with values clamped to the color defined bounds Read more
Convert into T. The resulting color might be invalid in its color space Read more
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