Struct palette::Yxy [] [src]

pub struct Yxy<T: Float = f32> {
    pub x: T,
    pub y: T,
    pub luma: T,
}

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 assumes the CIE Standard Illuminant D65 as the white point, and the 2° standard colorimetric observer.

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.

Methods

impl<T: Float> Yxy<T>
[src]

fn new(x: T, y: T, luma: T) -> Yxy<T>

CIE Yxy.

Trait Implementations

impl<T: PartialEq + Float> PartialEq for Yxy<T>
[src]

fn eq(&self, __arg_0: &Yxy<T>) -> bool

This method tests for self and other values to be equal, and is used by ==. Read more

fn ne(&self, __arg_0: &Yxy<T>) -> bool

This method tests for !=.

impl<T: Debug + Float> Debug for Yxy<T>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<T: Copy + Float> Copy for Yxy<T>
[src]

impl<T: Clone + Float> Clone for Yxy<T>
[src]

fn clone(&self) -> Yxy<T>

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)
1.0.0

Performs copy-assignment from source. Read more

impl<T: Float> FromColor<T> for Yxy<T>
[src]

fn from_xyz(xyz: Xyz<T>) -> Self

Convert from XYZ color space

fn from_yxy(yxy: Yxy<T>) -> Self

Convert from Yxy color space

fn from_luma(luma: Luma<T>) -> Self

Convert from Luma

fn from_lab(inp: Lab<T>) -> Self

Convert from L*a*b* color space

fn from_lch(inp: Lch<T>) -> Self

Convert from L*C*h° color space

fn from_rgb(inp: Rgb<T>) -> Self

Convert from RGB color space

fn from_hsl(inp: Hsl<T>) -> Self

Convert from HSL color space

fn from_hsv(inp: Hsv<T>) -> Self

Convert from HSV color space

fn from_hwb(inp: Hwb<T>) -> Self

Convert from HWB color space

impl<T: Float> Limited for Yxy<T>
[src]

fn is_valid(&self) -> bool

Check if the color's components are within the expected ranges.

fn clamp(&self) -> Yxy<T>

Return a new color where the components has been clamped to the nearest valid values. Read more

fn clamp_self(&mut self)

Clamp the color's components to the nearest valid values.

impl<T: Float> Mix for Yxy<T>
[src]

type Scalar = T

The type of the mixing factor.

fn mix(&self, other: &Yxy<T>, factor: T) -> Yxy<T>

Mix the color with an other color, by factor. Read more

impl<T: Float> Shade for Yxy<T>
[src]

type Scalar = T

The type of the lighten/darken amount.

fn lighten(&self, amount: T) -> Yxy<T>

Lighten the color by amount.

fn darken(&self, amount: Self::Scalar) -> Self

Darken the color by amount.

impl<T: Float> ComponentWise for Yxy<T>
[src]

type Scalar = T

The scalar type for color components.

fn component_wise<F: FnMut(T, T) -> T>(&self, other: &Yxy<T>, f: F) -> Yxy<T>

Perform a binary operation on this and an other color.

fn component_wise_self<F: FnMut(T) -> T>(&self, f: F) -> Yxy<T>

Perform a unary operation on this color.

impl<T: Float> Default for Yxy<T>
[src]

fn default() -> Yxy<T>

Returns the "default value" for a type. Read more

impl<T: Float> Add<Yxy<T>> for Yxy<T>
[src]

type Output = Yxy<T>

The resulting type after applying the + operator

fn add(self, other: Yxy<T>) -> Yxy<T>

The method for the + operator

impl<T: Float> Add<T> for Yxy<T>
[src]

type Output = Yxy<T>

The resulting type after applying the + operator

fn add(self, c: T) -> Yxy<T>

The method for the + operator

impl<T: Float> Sub<Yxy<T>> for Yxy<T>
[src]

type Output = Yxy<T>

The resulting type after applying the - operator

fn sub(self, other: Yxy<T>) -> Yxy<T>

The method for the - operator

impl<T: Float> Sub<T> for Yxy<T>
[src]

type Output = Yxy<T>

The resulting type after applying the - operator

fn sub(self, c: T) -> Yxy<T>

The method for the - operator

impl<T: Float> Mul<Yxy<T>> for Yxy<T>
[src]

type Output = Yxy<T>

The resulting type after applying the * operator

fn mul(self, other: Yxy<T>) -> Yxy<T>

The method for the * operator

impl<T: Float> Mul<T> for Yxy<T>
[src]

type Output = Yxy<T>

The resulting type after applying the * operator

fn mul(self, c: T) -> Yxy<T>

The method for the * operator

impl<T: Float> Div<Yxy<T>> for Yxy<T>
[src]

type Output = Yxy<T>

The resulting type after applying the / operator

fn div(self, other: Yxy<T>) -> Yxy<T>

The method for the / operator

impl<T: Float> Div<T> for Yxy<T>
[src]

type Output = Yxy<T>

The resulting type after applying the / operator

fn div(self, c: T) -> Yxy<T>

The method for the / operator

impl<T: Float> IntoColor<T> for Yxy<T>
[src]

fn into_xyz(self) -> Xyz<T>

Convert into XYZ space

fn into_yxy(self) -> Yxy<T>

Convert into Yxy color space

fn into_lab(self) -> Lab<T>

Convert into L*a*b* color space

fn into_lch(self) -> Lch<T>

Convert into L*C*h° color space

fn into_rgb(self) -> Rgb<T>

Convert into RGB color space.

fn into_hsl(self) -> Hsl<T>

Convert into HSL color space

fn into_hsv(self) -> Hsv<T>

Convert into HSV color space

fn into_luma(self) -> Luma<T>

Convert into Luma

fn into_hwb(self) -> Hwb<T>

Convert into HWB color space

impl<T: Float> From<Alpha<Yxy<T>, T>> for Yxy<T>
[src]

fn from(color: Alpha<Yxy<T>, T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Color<T>> for Yxy<T>
[src]

fn from(color: Color<T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Xyz<T>> for Yxy<T>
[src]

fn from(other: Xyz<T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Alpha<Xyz<T>, T>> for Yxy<T>
[src]

fn from(other: Alpha<Xyz<T>, T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Lab<T>> for Yxy<T>
[src]

fn from(other: Lab<T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Alpha<Lab<T>, T>> for Yxy<T>
[src]

fn from(other: Alpha<Lab<T>, T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Lch<T>> for Yxy<T>
[src]

fn from(other: Lch<T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Alpha<Lch<T>, T>> for Yxy<T>
[src]

fn from(other: Alpha<Lch<T>, T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Rgb<T>> for Yxy<T>
[src]

fn from(other: Rgb<T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Alpha<Rgb<T>, T>> for Yxy<T>
[src]

fn from(other: Alpha<Rgb<T>, T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Hsl<T>> for Yxy<T>
[src]

fn from(other: Hsl<T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Alpha<Hsl<T>, T>> for Yxy<T>
[src]

fn from(other: Alpha<Hsl<T>, T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Hsv<T>> for Yxy<T>
[src]

fn from(other: Hsv<T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Alpha<Hsv<T>, T>> for Yxy<T>
[src]

fn from(other: Alpha<Hsv<T>, T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Hwb<T>> for Yxy<T>
[src]

fn from(other: Hwb<T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Alpha<Hwb<T>, T>> for Yxy<T>
[src]

fn from(other: Alpha<Hwb<T>, T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Luma<T>> for Yxy<T>
[src]

fn from(other: Luma<T>) -> Yxy<T>

Performs the conversion.

impl<T: Float> From<Alpha<Luma<T>, T>> for Yxy<T>
[src]

fn from(other: Alpha<Luma<T>, T>) -> Yxy<T>

Performs the conversion.

impl<T: Float + ApproxEq> ApproxEq for Yxy<T> where T::Epsilon: Copy + Float
[src]

type Epsilon = T::Epsilon

Used for specifying relative comparisons.

fn default_epsilon() -> Self::Epsilon

The default tolerance to use when testing values that are close together. Read more

fn default_max_relative() -> Self::Epsilon

The default relative tolerance for testing values that are far-apart. Read more

fn default_max_ulps() -> u32

The default ULPs to tolerate when testing values that are far-apart. Read more

fn relative_eq(&self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon) -> bool

A test for equality that uses a relative comparison if the values are far apart.

fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

A test for equality that uses units in the last place (ULP) if the values are far apart.

fn relative_ne(&self, other: &Self, epsilon: Self::Epsilon, max_relative: Self::Epsilon) -> bool

The inverse of ApproxEq::relative_eq.

fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool

The inverse of ApproxEq::ulps_eq.