[][src]Struct prisma::ChromaticityCoordinates

pub struct ChromaticityCoordinates<T> {
    pub alpha: T,
    pub beta: T,
}

A pair of chromaticity coordinates $\alpha$ and $\beta$

Chromaticity coordinates are a basis set of a two-dimensional space defining the chroma and hue of the color without the luminance. These are primarily used for computing non-approximate (circular) HS* color values. Hsi is an example of a color space that uses these coordinates in its construction.

$\alpha$ is the "redness vs blue-greenness" whereas $\beta$ is "greenness vs blueness"

Hsv and similar models convert from RGB using a hexagonal transformation that is then treated as circular. This is convenient and very easy to compute, but it is slightly off of the "correct" value for hue and chroma obtained when using a circle.

From these coordinates, you can obtain the circular chroma and hue:

\begin{aligned}
H_{\textrm{circle}} &= atan2(\beta, \alpha) \\
C_{\textrm{circle}} &= \sqrt{\alpha^2 + \beta^2}
\end{aligned}

Fields

alpha: T

The alpha chromaticity coordinate

beta: T

The alpha chromaticity coordinate

Implementations

impl<T> ChromaticityCoordinates<T> where
    T: Float
[src]

pub fn new(alpha: T, beta: T) -> Self[src]

Construct a new ChromaticityCoordinates instance

Trait Implementations

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

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

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

impl<T> Default for ChromaticityCoordinates<T> where
    T: Float
[src]

impl<T: Hash> Hash for ChromaticityCoordinates<T>[src]

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

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

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

Auto Trait Implementations

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

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

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

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

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