[][src]Struct prisma::Xyz

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

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]

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]

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]

type Epsilon = T::Epsilon

Used for specifying relative comparisons.

impl<T> Bounded for Xyz<T> where
    T: FreeChannelScalar
[src]

impl<T> Broadcast for Xyz<T> where
    T: FreeChannelScalar
[src]

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

impl<T> Color for Xyz<T> where
    T: FreeChannelScalar
[src]

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

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]

type OutputColor = Rgb<T>

The color type converted to.

impl<T> ConvertFromXyz<T, Xyz<T>> for SRgb<T> where
    T: Float + FreeChannelScalar + PosNormalChannelScalar + ChannelFormatCast<f64>,
    f64: ChannelFormatCast<T>, 
[src]

type OutputColor = Rgb<T>

The color type converted to.

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]

impl<T> Display for Xyz<T> where
    T: FreeChannelScalar + Display
[src]

impl<T> Flatten for Xyz<T> where
    T: FreeChannelScalar
[src]

impl<T, Model> FromColor<Lms<T, Model>> for Xyz<T> where
    T: FreeChannelScalar,
    Model: LmsModel<T>, 
[src]

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

impl<T, Model> FromColor<Xyz<T>> for Lms<T, Model> where
    T: FreeChannelScalar,
    Model: LmsModel<T>, 
[src]

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

impl<T> FromTuple for Xyz<T> where
    T: FreeChannelScalar
[src]

impl<T> HomogeneousColor for Xyz<T> where
    T: FreeChannelScalar
[src]

type ChannelFormat = T

The scalar type of each channel

impl<T> Lerp for Xyz<T> where
    T: FreeChannelScalar,
    PosFreeChannel<T>: Lerp
[src]

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

The type of the pos argument

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

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

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

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

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

Auto Trait Implementations

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

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

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

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

impl<T> UnwindSafe for Xyz<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.