Struct pix::cmy::Cmy

source ·
pub struct Cmy {}
Expand description

CMY subtractive color model.

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

Implementations§

source§

impl Cmy

source

pub fn cyan<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,

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));
source

pub fn cyan_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,

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));
source

pub fn magenta<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,

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));
source

pub fn magenta_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,

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));
source

pub fn yellow<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,

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));
source

pub fn yellow_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,

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§

source§

impl Clone for Cmy

source§

fn clone(&self) -> Cmy

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl ColorModel for Cmy

source§

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

Convert into red, green, blue and alpha components

source§

fn from_rgba<P>(rgba: PixRgba<P>) -> Pwhere P: Pixel<Model = Self>,

Convert from red, green, blue and alpha components

source§

const CIRCULAR: Range<usize> = _

Range of circular channel numbers
source§

const LINEAR: Range<usize> = _

Range of linear channel numbers
source§

const ALPHA: usize = 3usize

Alpha channel number
source§

impl Debug for Cmy

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Cmy

source§

fn default() -> Cmy

Returns the “default value” for a type. Read more
source§

impl PartialEq<Cmy> for Cmy

source§

fn eq(&self, other: &Cmy) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Copy for Cmy

source§

impl Eq for Cmy

source§

impl StructuralEq for Cmy

source§

impl StructuralPartialEq for Cmy

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§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.