[−][src]Struct prisma::XyY
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]
T: FreeChannelScalar + Float + PosNormalChannelScalar,
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]
T: ChannelFormatCast<TOut>,
TOut: FreeChannelScalar + PosNormalChannelScalar,
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]
T: FreeChannelScalar + PosNormalChannelScalar + AbsDiffEq,
T::Epsilon: Clone,
type Epsilon = T::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> Self::Epsilon
[src]
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
[src]
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
[src]
impl<T> Bounded for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + Float,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + Float,
fn normalize(self) -> Self
[src]
fn is_normalized(&self) -> bool
[src]
impl<T> Broadcast for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + Float,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + Float,
impl<T: Clone> Clone for XyY<T>
[src]
impl<T> Color for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + Float,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + Float,
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
fn num_channels() -> u32
[src]
fn to_tuple(self) -> Self::ChannelsTuple
[src]
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]
T: FreeChannelScalar + PosNormalChannelScalar + Float,
impl<T> Display for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + Float + Display,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + Float + Display,
impl<T> Flatten for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + Float,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + Float,
fn as_slice(&self) -> &[Self::ChannelFormat]
[src]
fn from_slice(vals: &[T]) -> Self
[src]
impl<T> FromColor<XyY<T>> for Xyz<T> where
T: FreeChannelScalar + PosNormalChannelScalar + Float,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + Float,
fn from_color(from: &XyY<T>) -> Self
[src]
impl<T> FromColor<Xyz<T>> for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + Float,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + Float,
fn from_color(from: &Xyz<T>) -> Self
[src]
impl<T> FromTuple for XyY<T> where
T: FreeChannelScalar + Float + PosNormalChannelScalar,
[src]
T: FreeChannelScalar + Float + PosNormalChannelScalar,
fn from_tuple(values: (T, T, T)) -> Self
[src]
impl<T> HomogeneousColor for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + Float,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + Float,
impl<T> Lerp for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + Float,
FreeChannel<T>: Lerp,
PosNormalBoundedChannel<T>: Lerp<Position = <FreeChannel<T> as Lerp>::Position>,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + Float,
FreeChannel<T>: Lerp,
PosNormalBoundedChannel<T>: Lerp<Position = <FreeChannel<T> as Lerp>::Position>,
type Position = <FreeChannel<T> as Lerp>::Position
The type of the pos
argument
fn lerp(&self, right: &Self, pos: Self::Position) -> Self
[src]
impl<T: PartialEq> PartialEq<XyY<T>> for XyY<T>
[src]
impl<T: PartialOrd> PartialOrd<XyY<T>> for XyY<T>
[src]
fn partial_cmp(&self, other: &XyY<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &XyY<T>) -> bool
[src]
fn le(&self, other: &XyY<T>) -> bool
[src]
fn gt(&self, other: &XyY<T>) -> bool
[src]
fn ge(&self, other: &XyY<T>) -> bool
[src]
impl<T> RelativeEq<XyY<T>> for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + RelativeEq,
T::Epsilon: Clone,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + RelativeEq,
T::Epsilon: Clone,
fn default_max_relative() -> Self::Epsilon
[src]
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
impl<T> StructuralPartialEq for XyY<T>
[src]
impl<T> UlpsEq<XyY<T>> for XyY<T> where
T: FreeChannelScalar + PosNormalChannelScalar + UlpsEq,
T::Epsilon: Clone,
[src]
T: FreeChannelScalar + PosNormalChannelScalar + UlpsEq,
T::Epsilon: Clone,
Auto Trait Implementations
impl<T> RefUnwindSafe for XyY<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for XyY<T> where
T: Send,
T: Send,
impl<T> Sync for XyY<T> where
T: Sync,
T: Sync,
impl<T> Unpin for XyY<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for XyY<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,