[][src]Struct colorspace::color_space_rgb::ColorSpaceRGB

pub struct ColorSpaceRGB<T> where
    T: Real
{ pub xf_xyz_to_rgb: Matrix33<T>, pub xf_rgb_to_xyz: Matrix33<T>, pub red: XYY<T>, pub green: XYY<T>, pub blue: XYY<T>, pub white: XYY<T>, pub oetf: TransferFunction<T>, pub eotf: TransferFunction<T>, }

Defines a tristimulus RGB color space as a collection of primaries, a whitepoint and OETF.

Fields

xf_xyz_to_rgb: Matrix33<T>xf_rgb_to_xyz: Matrix33<T>red: XYY<T>green: XYY<T>blue: XYY<T>white: XYY<T>oetf: TransferFunction<T>eotf: TransferFunction<T>

Implementations

impl<T> ColorSpaceRGB<T> where
    T: Real
[src]

Create a new color space using the supplied primaries and transfer functions

// Define the DCI P3 color space
use colorspace::*;
let cs_dci_p3 = ColorSpaceRGB::<f64>::new(
    XYYf64 { x: 0.680, y: 0.320, Y: 1.0 },
    XYYf64 { x: 0.265, y: 0.690, Y: 1.0 },
    XYYf64 { x: 0.150, y: 0.060 , Y: 1.0},
    XYYf64 {
        x: 0.314,
        y: 0.351,
        Y: 1.0,
    },
    Box::new(|c: RGBf64| c.powf(1.0 / 2.6)),
    Box::new(|c: RGBf64| c.powf(2.6)),
);

pub fn new(
    red: XYY<T>,
    green: XYY<T>,
    blue: XYY<T>,
    white: XYY<T>,
    oetf: TransferFunction<T>,
    eotf: TransferFunction<T>
) -> ColorSpaceRGB<T>
[src]

pub fn new_with_specified_matrices(
    red: XYY<T>,
    green: XYY<T>,
    blue: XYY<T>,
    white: XYY<T>,
    xf_xyz_to_rgb: Matrix33<T>,
    xf_rgb_to_xyz: Matrix33<T>,
    oetf: TransferFunction<T>,
    eotf: TransferFunction<T>
) -> ColorSpaceRGB<T>
[src]

Create a new color space using the supplied XYZ->RGB conversion matrices instead of deriving them from the primaries. This is useful when the published spec for a color space differs from its mathematical definition, for example in the case of sRGB.

// sRGB's published definition is different from the calculated values
// due to rounding
use colorspace::*;
let cs_srgb = ColorSpaceRGB::<f64>::new_with_specified_matrices(
    XYYf64 { x: 0.64, y: 0.33, Y: 1.0 },
    XYYf64 { x: 0.30, y: 0.60, Y: 1.0 },
    XYYf64 { x: 0.15, y: 0.06, Y: 1.0 },
    XYYf64 {
        x: 0.3127,
        y: 0.3290,
        Y: 1.0,
    },
    M3f64::new([3.2406, -1.5372, -0.4986,
                   -0.9689, 1.8758, 0.0415,
                   0.0557, -0.2040, 1.0570]),
    M3f64::new([0.4124, 0.3576, 0.1805,
                   0.2126, 0.7152, 0.0722,
                   0.0193, 0.1192, 0.9505]),
    Box::new(encode::srgb),
    Box::new(decode::srgb),
);

pub fn encode(&self, c: RGBf<T>) -> RGBf<T>[src]

Convert a scene-referred, linear color to a display-referred, possibly non-linear color using the opto-electrical transfer function. If the color space does not have an associated OETF then it simply returns c unaltered.

pub fn decode(&self, c: RGBf<T>) -> RGBf<T>[src]

Convert a display-referred, possibly non-linear color to a scene-referred, linear color using the electro-optical transfer function. If the color space does not have an associated EOTF then it simply returns c unaltered.

Auto Trait Implementations

impl<T> !RefUnwindSafe for ColorSpaceRGB<T>

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

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

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

impl<T> !UnwindSafe for ColorSpaceRGB<T>

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, 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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,