Struct nannou::color::Yxy [−][src]
#[repr(C)]pub struct Yxy<Wp = D65, T = f32> where
T: Component + Float,
Wp: WhitePoint, { pub x: T, pub y: T, pub luma: T, pub white_point: PhantomData<Wp>, }
Expand description
The CIE 1931 Yxy (xyY) color space.
Yxy is a luminance-chromaticity color space derived from the CIE XYZ color space. It is widely used to define colors. The chromacity diagrams for the color spaces are a plot of this color space’s x and y coordiantes.
Conversions and operations on this color space depend on the white point.
Fields
x: T
x chromacity co-ordinate derived from XYZ color space as X/(X+Y+Z). Typical range is between 0 and 1
y: T
y chromacity co-ordinate derived from XYZ color space as Y/(X+Y+Z). Typical range is between 0 and 1
luma: T
luma (Y) was a measure of the brightness or luminance of a color. It is the same as the Y from the XYZ color space. Its range is from 0 to 1, where 0 is black and 1 is white.
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: &Yxy<Wp, T>, f: F) -> Yxy<Wp, T> where
F: FnMut(T, T) -> T,
pub fn component_wise<F>(&self, other: &Yxy<Wp, T>, f: F) -> Yxy<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 Yxy<Wp, T> where
T: Component + Float + Deserialize<'de>,
Wp: WhitePoint,
impl<'de, Wp, T> Deserialize<'de> for Yxy<Wp, T> where
T: Component + Float + Deserialize<'de>,
Wp: WhitePoint,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Yxy<Wp, T>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
pub fn deserialize<__D>(
__deserializer: __D
) -> Result<Yxy<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 Yxy<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, _S> From<Alpha<Luma<_S, T>, T>> for Yxy<Wp, T> where
T: Component + Float,
Wp: WhitePoint,
_S: LumaStandard<WhitePoint = Wp>,
impl<Wp, T, _S> From<Alpha<Rgb<_S, T>, T>> for Yxy<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 Yxy<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<Luma<S, T>> for Yxy<<S as LumaStandard>::WhitePoint, T> where
T: Component + Float,
S: LumaStandard,
impl<S, T> From<Luma<S, T>> for Yxy<<S as LumaStandard>::WhitePoint, T> where
T: Component + Float,
S: LumaStandard,
Performs the conversion.
impl<Wp, T, _S> From<Rgb<_S, T>> for Yxy<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 Yxy<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<Yxy<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Alpha<Rgb<S, T>, T> where
T: Component + Float,
S: RgbStandard,
impl<S, T> From<Yxy<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Alpha<Rgb<S, T>, T> where
T: Component + Float,
S: RgbStandard,
pub fn from(
color: Yxy<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>
) -> Alpha<Rgb<S, T>, T>
pub fn from(
color: Yxy<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>
) -> Alpha<Rgb<S, T>, T>
Performs the conversion.
impl<S, T> From<Yxy<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Rgb<S, T> where
T: Component + Float,
S: RgbStandard,
impl<S, T> From<Yxy<<<S as RgbStandard>::Space as RgbSpace>::WhitePoint, T>> for Rgb<S, T> where
T: Component + Float,
S: RgbStandard,
Performs the conversion.
impl<S, T> From<Yxy<<S as LumaStandard>::WhitePoint, T>> for Alpha<Luma<S, T>, T> where
T: Component + Float,
S: LumaStandard,
impl<S, T> From<Yxy<<S as LumaStandard>::WhitePoint, T>> for Alpha<Luma<S, T>, T> where
T: Component + Float,
S: LumaStandard,
Performs the conversion.
impl<S, T> From<Yxy<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component + Float,
S: LumaStandard,
impl<S, T> From<Yxy<<S as LumaStandard>::WhitePoint, T>> for Luma<S, T> where
T: Component + Float,
S: LumaStandard,
Performs the conversion.
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: &Yxy<Wp, T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool
pub fn relative_eq(
&self,
other: &Yxy<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: &Yxy<Wp, T>,
epsilon: <T as AbsDiffEq<T>>::Epsilon,
max_relative: <T as AbsDiffEq<T>>::Epsilon
) -> bool
pub fn relative_ne(
&self,
other: &Yxy<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 Yxy<Wp, T> where
T: RefUnwindSafe,
Wp: RefUnwindSafe,
impl<Wp, T> UnwindSafe for Yxy<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,
S: IntoColor<Swp, T>,
D: FromColor<Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
impl<S, D, Swp, Dwp, T> AdaptFrom<S, Swp, Dwp, T> for D where
T: Component + Float,
S: IntoColor<Swp, T>,
D: FromColor<Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: Component + Float,
D: AdaptFrom<S, Swp, Dwp, T>,
Swp: WhitePoint,
Dwp: WhitePoint,
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
pub fn vzip(self) -> V