Struct rgb_derivation::Chromacity[][src]

pub struct Chromacity<K>(_, _);

A colour chromacity represented as (x, y) coordinates.

Implementations

impl<K> Chromacity<K>[src]

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

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

impl<K: Signed> Chromacity<K>[src]

pub fn new(x: K, y: K) -> Result<Self, Error<K>>[src]

pub unsafe fn new_unchecked(x: K, y: K) -> Self[src]

impl<K: Scalar> Chromacity<K> where
    &'x K: RefNum<K>, 
[src]

pub fn to_xyz(&self) -> [K; 3][src]

Returns XYZ coordinates of a colour with given chromacity and luminosity (the Y coordinate) equal one.

Example

use rgb_derivation::*;

let one = num::rational::Ratio::new(1i64, 1i64);
let one_third = num::rational::Ratio::new(1i64, 3i64);
let e = Chromacity::new(one_third, one_third).unwrap().to_xyz();
assert_eq!([one, one, one], e);

Trait Implementations

impl<K: Clone> Clone for Chromacity<K>[src]

impl<K: Copy> Copy for Chromacity<K>[src]

impl<K: Debug> Debug for Chromacity<K>[src]

impl<K: Eq> Eq for Chromacity<K>[src]

impl<K: Ord> Ord for Chromacity<K>[src]

impl<K: PartialEq> PartialEq<Chromacity<K>> for Chromacity<K>[src]

impl<K: PartialOrd> PartialOrd<Chromacity<K>> for Chromacity<K>[src]

impl<K> StructuralEq for Chromacity<K>[src]

impl<K> StructuralPartialEq for Chromacity<K>[src]

Auto Trait Implementations

impl<K> RefUnwindSafe for Chromacity<K> where
    K: RefUnwindSafe

impl<K> Send for Chromacity<K> where
    K: Send

impl<K> Sync for Chromacity<K> where
    K: Sync

impl<K> Unpin for Chromacity<K> where
    K: Unpin

impl<K> UnwindSafe for Chromacity<K> where
    K: 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.