[][src]Struct pix::cmy::Cmy

pub struct Cmy {}

CMY subtractive color model.

The components are cyan, magenta, yellow and optional alpha.

Methods

impl Cmy[src]

pub fn cyan<P: Pixel>(p: P) -> P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get the cyan component.

Example: Get CMY Cyan

use pix::cmy::{Cmy, Cmy8};
use pix::chan::Ch8;

let p = Cmy8::new(0x93, 0x80, 0xA0);
assert_eq!(Cmy::cyan(p), Ch8::new(0x93));

pub fn cyan_mut<P: Pixel>(p: &mut P) -> &mut P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get a mutable reference to the cyan component.

Example: Modify CMY Cyan

use pix::cmy::{Cmy, Cmy8};
use pix::chan::Ch8;

let mut p = Cmy8::new(0x88, 0x77, 0x66);
*Cmy::cyan_mut(&mut p) = 0x55.into();
assert_eq!(Cmy::cyan(p), Ch8::new(0x55));

pub fn magenta<P: Pixel>(p: P) -> P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get the magenta component.

Example: CMY Magenta

use pix::cmy::{Cmy, Cmy16};
use pix::chan::Ch16;

let p = Cmy16::new(0x2000, 0x1234, 0x8000);
assert_eq!(Cmy::magenta(p), Ch16::new(0x1234));

pub fn magenta_mut<P: Pixel>(p: &mut P) -> &mut P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get a mutable reference to the magenta component.

Example: Modify CMY Magenta

use pix::cmy::{Cmy, Cmy16};
use pix::chan::Ch16;

let mut p = Cmy16::new(0x2000, 0x1234, 0x8000);
*Cmy::magenta_mut(&mut p) = 0x4321.into();
assert_eq!(Cmy::magenta(p), Ch16::new(0x4321));

pub fn yellow<P: Pixel>(p: P) -> P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get the yellow component.

Example: CMY Yellow

use pix::cmy::{Cmy, Cmy32};
use pix::chan::Ch32;

let p = Cmy32::new(0.25, 0.5, 1.0);
assert_eq!(Cmy::yellow(p), Ch32::new(1.0));

pub fn yellow_mut<P: Pixel>(p: &mut P) -> &mut P::Chan where
    P: Pixel<Model = Self>, 
[src]

Get a mutable reference to the yellow component.

Example: Modify CMY Yellow

use pix::cmy::{Cmy, Cmy32};
use pix::chan::Ch32;

let mut p = Cmy32::new(0.25, 0.5, 1.0);
*Cmy::yellow_mut(&mut p) = Ch32::new(0.75);
assert_eq!(Cmy::yellow(p), Ch32::new(0.75));

Trait Implementations

impl Clone for Cmy[src]

impl ColorModel for Cmy[src]

fn into_rgba<P>(p: P) -> PixRgba<P> where
    P: Pixel<Model = Self>, 
[src]

Convert into red, green, blue and alpha components

fn from_rgba<P>(rgba: PixRgba<P>) -> P where
    P: Pixel<Model = Self>, 
[src]

Convert from red, green, blue and alpha components

impl Copy for Cmy[src]

impl Debug for Cmy[src]

impl Default for Cmy[src]

impl PartialEq<Cmy> for Cmy[src]

impl StructuralPartialEq for Cmy[src]

Auto Trait Implementations

impl RefUnwindSafe for Cmy

impl Send for Cmy

impl Sync for Cmy

impl Unpin for Cmy

impl UnwindSafe for Cmy

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.