[][src]Struct prisma::XyY

#[repr(C)]pub struct XyY<T> { /* fields omitted */ }

The xyY device-independent chromaticity space

xyY is a chromaticity transformation of XYZ, defined by a relative amount of X, Y and Z. It is a direct analog to the rgI model for Rgb, but without being bound to a specific Rgb space (see Rgi). xyY carries along the absolute luminosity to allow a reconstruction of the XYZ value. xy is often plotted together in what is often referred to as the "horseshoe diagram" which is used to show the gamut of various RGB color spaces.

The x and y components here are not absolute X and Y as in XYZ, but rather the ratio of each to the sum. That is:

\begin{aligned}
x &= \frac{X}{X+Y+Z} \\
y &= \frac{Y}{X+Y+Z} \\
z &= \frac{Z}{X+Y+Z} \\
x+y+z &= 1
\end{aligned}

The value of z is implicit given that x + y + z = 1 thus z can be computed via x = 1 - x - y.

XyY can be converted back to XYZ as follows:

\begin{aligned}
X &= \frac{Y}{y}x \\
Y &= Y \\
Z &= \frac{Y}{y}(1-x-y)
\end{aligned}

Prisma uses xy chromaticity coordinates in the specification of primaries. Together with a reference white point, this can uniquely define a RGB space.

Implementations

impl<T> XyY<T> where
    T: FreeChannelScalar + Float + PosNormalChannelScalar
[src]

pub fn new(x: T, y: T, Y: T) -> Self[src]

Construct an XyY instance from x, y and Y

Panics:

new will panic if x + y is greater than 1 or less than zero, or if either x or y are negative.

pub fn color_cast<TOut>(&self) -> XyY<TOut> where
    T: ChannelFormatCast<TOut>,
    TOut: FreeChannelScalar + PosNormalChannelScalar
[src]

Convert the internal channel scalar format

pub fn x(&self) -> T[src]

Returns the x chromaticity value

pub fn y(&self) -> T[src]

Returns the y chromaticity value

pub fn z(&self) -> T[src]

Returns the z chromaticity value

The z chromaticity value is computed from x and y based on the fact x + y + z = 1.

pub fn Y(&self) -> T[src]

Returns the luminosity Y

pub fn Y_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the luminosity Y

pub fn set_x(&mut self, val: T)[src]

Set the x value, rescaling y to maintain x + y + z = 1

Panics:

Panics if x is greater than one or less than zero

pub fn set_y(&mut self, val: T)[src]

Set the y value, rescaling x to maintain x + y + z = 1

Panics:

Panics if x is greater than one or less than zero

pub fn set_z(&mut self, val: T)[src]

Set the implicit z value, rescaling x and y to maintain x + y + z = 1

Panics:

Panics if x is greater than one or less than zero

Trait Implementations

impl<T> AbsDiffEq<XyY<T>> for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + AbsDiffEq,
    T::Epsilon: Clone
[src]

type Epsilon = T::Epsilon

Used for specifying relative comparisons.

impl<T> Bounded for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float
[src]

impl<T> Broadcast for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float
[src]

impl<T: Clone> Clone for XyY<T>[src]

impl<T> Color for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float
[src]

type Tag = XyYTag

The unique tag unit struct identifying the color type

type ChannelsTuple = (T, T, T)

A tuple of types for each channel in the color

impl<T: Copy> Copy for XyY<T>[src]

impl<T: Debug> Debug for XyY<T>[src]

impl<T> Default for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float
[src]

impl<T> Display for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float + Display
[src]

impl<T> Flatten for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float
[src]

impl<T> FromColor<XyY<T>> for Xyz<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float
[src]

impl<T> FromColor<Xyz<T>> for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float
[src]

impl<T> FromTuple for XyY<T> where
    T: FreeChannelScalar + Float + PosNormalChannelScalar
[src]

impl<T> HomogeneousColor for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float
[src]

type ChannelFormat = T

The scalar type of each channel

impl<T> Lerp for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + Float,
    FreeChannel<T>: Lerp,
    PosNormalBoundedChannel<T>: Lerp<Position = <FreeChannel<T> as Lerp>::Position>, 
[src]

type Position = <FreeChannel<T> as Lerp>::Position

The type of the pos argument

impl<T: PartialEq> PartialEq<XyY<T>> for XyY<T>[src]

impl<T: PartialOrd> PartialOrd<XyY<T>> for XyY<T>[src]

impl<T> RelativeEq<XyY<T>> for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + RelativeEq,
    T::Epsilon: Clone
[src]

impl<T> StructuralPartialEq for XyY<T>[src]

impl<T> UlpsEq<XyY<T>> for XyY<T> where
    T: FreeChannelScalar + PosNormalChannelScalar + UlpsEq,
    T::Epsilon: Clone
[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for XyY<T> where
    T: RefUnwindSafe

impl<T> Send for XyY<T> where
    T: Send

impl<T> Sync for XyY<T> where
    T: Sync

impl<T> Unpin for XyY<T> where
    T: Unpin

impl<T> UnwindSafe for XyY<T> where
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.