[−][src]Struct prisma::Xyz
The CIE XYZ device-independent color space
The XYZ color space was defined by the International Commission on Illumination (CIE) in 1931 to be able to describe color human vision. It was developed from a series of experiments to map the human perceptual response to light. A set of "color matching" functions were developed, and from these the XYZ space is defined. XYZ forms an authoritative definition of perceived colors, and is thus used widely in many fields where accurate color representation and conversion are needed.
XYZ is the "parent" device independent color space from which all other color spaces are defined.
All device-dependent color spaces are defined by a set of (generally three) primaries defined
in XYZ plus a white point defining the viewing conditions. The transformation from RGB to XYZ
can be represented in a 3x3 matrix of values, which when multiplied against a vector of (R, G, B)
produces a vector of (X, Y, Z)
.
While XYZ is authoritative, it is not generally the most convenient space to do manipulations in. The Y of XYZ is luminance whereas X and Z are both linearly independent responses to color, but do not map neatly to an observable color. XYZ is also not perceptually uniform.
For perceptual uniformity, CIE defined two further spaces that are transformations of XYZ:
LAV and LUV. These are non-linearly derived from XYZ, and both are approximately perceptually uniform,
although with different properties. See Lab
and Luv
for more details on those color spaces.
XYZ coordinates are not technically bounded in any range, and the visible region of the space is not a simple shape. Many combinations of XYZ will correspond to no representable color and are therefore "imaginary" to humans.
Standard Observer
XYZ is actually a family of spaces, each constructed from a set of color matching functions. Currently
there are two different "standard observers" defined by the CIE, which are the color matching functions
obtained from experiments that represent the average human eye response at a given field of view.
The $2^{\circ}
$ standard observer is by far the most widely used, and is defined using only the
center-most 2 degrees of vision. SRgb and the majority of other used color spaces are defined
against this standard observer. A later $10^{\circ}
$ standard observer was created representing a
larger field of view. These two standard observers differ in their color matching functions by
a modest but not insignificant amount, and XYZ using one is not compatible with XYZ using the other.
While $10^{\circ}
$ standard observer is recommended for use in many applications using more
than about $4^{\circ}
$ of
vision, the $2^{\circ}
$ standard observer is still much more widely used in practice.
Implementations
impl<T> Xyz<T> where
T: FreeChannelScalar,
[src]
T: FreeChannelScalar,
pub fn new(x: T, y: T, z: T) -> Self
[src]
Construct a new Xyz
instance from x
, y
and z
pub fn color_cast<TOut>(&self) -> Xyz<TOut> where
T: ChannelFormatCast<TOut>,
TOut: FreeChannelScalar,
[src]
T: ChannelFormatCast<TOut>,
TOut: FreeChannelScalar,
Convert the internal channel scalar format
pub fn x(&self) -> T
[src]
Returns the X
value
pub fn y(&self) -> T
[src]
Returns the Y
value
pub fn z(&self) -> T
[src]
Returns the Z
value
pub fn x_mut(&mut self) -> &mut T
[src]
Returns a mutable reference to the X
value
pub fn y_mut(&mut self) -> &mut T
[src]
Returns a mutable reference to the Y
value
pub fn z_mut(&mut self) -> &mut T
[src]
Returns a mutable reference to the Z
value
pub fn set_x(&mut self, val: T)
[src]
Set the X
value
pub fn set_y(&mut self, val: T)
[src]
Set the Y
value
pub fn set_z(&mut self, val: T)
[src]
Set the Z
value
Trait Implementations
impl<T> AbsDiffEq<Xyz<T>> for Xyz<T> where
T: FreeChannelScalar + AbsDiffEq,
T::Epsilon: Clone,
[src]
T: FreeChannelScalar + 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 Xyz<T> where
T: FreeChannelScalar,
[src]
T: FreeChannelScalar,
fn normalize(self) -> Self
[src]
fn is_normalized(&self) -> bool
[src]
impl<T> Broadcast for Xyz<T> where
T: FreeChannelScalar,
[src]
T: FreeChannelScalar,
impl<T: Clone> Clone for Xyz<T>
[src]
impl<T> Color for Xyz<T> where
T: FreeChannelScalar,
[src]
T: FreeChannelScalar,
type Tag = XyzTag
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, E> ConvertFromXyz<T, Xyz<T>> for EncodedColorSpace<T, E> where
T: PosNormalChannelScalar + FreeChannelScalar + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
E: ColorEncoding + PartialEq + Clone,
[src]
T: PosNormalChannelScalar + FreeChannelScalar + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
E: ColorEncoding + PartialEq + Clone,
type OutputColor = Rgb<T>
The color type converted to.
fn convert_from_xyz_raw(&self, color: &Xyz<T>) -> Rgb<T>
[src]
fn convert_from_xyz(
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, Self::Encoding, Self>
[src]
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, Self::Encoding, Self>
fn convert_from_xyz_linear(
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, LinearEncoding, Self>
[src]
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, LinearEncoding, Self>
impl<T> ConvertFromXyz<T, Xyz<T>> for SRgb<T> where
T: Float + FreeChannelScalar + PosNormalChannelScalar + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
[src]
T: Float + FreeChannelScalar + PosNormalChannelScalar + ChannelFormatCast<f64>,
f64: ChannelFormatCast<T>,
type OutputColor = Rgb<T>
The color type converted to.
fn convert_from_xyz_raw(&self, color: &Xyz<T>) -> Rgb<T>
[src]
fn convert_from_xyz(
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, Self::Encoding, Self>
[src]
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, Self::Encoding, Self>
fn convert_from_xyz_linear(
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, LinearEncoding, Self>
[src]
&self,
color: &In
) -> SpacedColor<T, Self::OutputColor, LinearEncoding, Self>
impl<T: Copy> Copy for Xyz<T>
[src]
impl<T: Debug> Debug for Xyz<T>
[src]
impl<T> Default for Xyz<T> where
T: FreeChannelScalar,
[src]
T: FreeChannelScalar,
impl<T> Display for Xyz<T> where
T: FreeChannelScalar + Display,
[src]
T: FreeChannelScalar + Display,
impl<T> Flatten for Xyz<T> where
T: FreeChannelScalar,
[src]
T: FreeChannelScalar,
fn as_slice(&self) -> &[Self::ChannelFormat]
[src]
fn from_slice(vals: &[T]) -> Self
[src]
impl<T, Model> FromColor<Lms<T, Model>> for Xyz<T> where
T: FreeChannelScalar,
Model: LmsModel<T>,
[src]
T: FreeChannelScalar,
Model: LmsModel<T>,
fn from_color(from: &Lms<T, Model>) -> 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, Model> FromColor<Xyz<T>> for Lms<T, Model> where
T: FreeChannelScalar,
Model: LmsModel<T>,
[src]
T: FreeChannelScalar,
Model: LmsModel<T>,
fn from_color(from: &Xyz<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 Xyz<T> where
T: FreeChannelScalar,
[src]
T: FreeChannelScalar,
fn from_tuple(values: (T, T, T)) -> Self
[src]
impl<T> HomogeneousColor for Xyz<T> where
T: FreeChannelScalar,
[src]
T: FreeChannelScalar,
impl<T> Lerp for Xyz<T> where
T: FreeChannelScalar,
PosFreeChannel<T>: Lerp,
[src]
T: FreeChannelScalar,
PosFreeChannel<T>: Lerp,
type Position = <PosFreeChannel<T> as Lerp>::Position
The type of the pos
argument
fn lerp(&self, right: &Self, pos: Self::Position) -> Self
[src]
impl<T: PartialEq> PartialEq<Xyz<T>> for Xyz<T>
[src]
impl<T: PartialOrd> PartialOrd<Xyz<T>> for Xyz<T>
[src]
fn partial_cmp(&self, other: &Xyz<T>) -> Option<Ordering>
[src]
fn lt(&self, other: &Xyz<T>) -> bool
[src]
fn le(&self, other: &Xyz<T>) -> bool
[src]
fn gt(&self, other: &Xyz<T>) -> bool
[src]
fn ge(&self, other: &Xyz<T>) -> bool
[src]
impl<T> RelativeEq<Xyz<T>> for Xyz<T> where
T: FreeChannelScalar + RelativeEq,
T::Epsilon: Clone,
[src]
T: FreeChannelScalar + 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 Xyz<T>
[src]
impl<T> UlpsEq<Xyz<T>> for Xyz<T> where
T: FreeChannelScalar + UlpsEq,
T::Epsilon: Clone,
[src]
T: FreeChannelScalar + UlpsEq,
T::Epsilon: Clone,
Auto Trait Implementations
impl<T> RefUnwindSafe for Xyz<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Xyz<T> where
T: Send,
T: Send,
impl<T> Sync for Xyz<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Xyz<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Xyz<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>,