[][src]Struct pix::ycc::YCbCr

pub struct YCbCr {}

YCbCr color model (used in JPEG and other formats).

The components are y, cb, cr and optional alpha.

Methods

impl YCbCr[src]

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

Get the y component.

This is luma when gamma-encoded, or luminance with linear gamma.

Example: YCbCr Y

use pix::chan::Ch32;
use pix::ycc::{YCbCr, YCbCr32};

let p = YCbCr32::new(0.25, 0.5, 1.0);
assert_eq!(YCbCr::y(p), Ch32::new(0.25));

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

Get a mutable reference to the y component.

Example: Modify YCbCr Y

use pix::chan::Ch32;
use pix::ycc::{YCbCr, YCbCr32};

let mut p = YCbCr32::new(0.25, 0.5, 1.0);
*YCbCr::y_mut(&mut p) = Ch32::new(0.75);
assert_eq!(YCbCr::y(p), Ch32::new(0.75));

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

Get the Cb component.

This the blue-difference chroma.

Example: YCbCr Cb

use pix::chan::Ch16;
use pix::ycc::{YCbCr, YCbCr16};

let p = YCbCr16::new(0x2000, 0x1234, 0x8000);
assert_eq!(YCbCr::cb(p), Ch16::new(0x1234));

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

Get a mutable reference to the Cb component.

Example: Modify YCbCr Cr

use pix::chan::Ch16;
use pix::ycc::{YCbCr, YCbCr16};

let mut p = YCbCr16::new(0x2000, 0x1234, 0x8000);
*YCbCr::cb_mut(&mut p) = 0x4321.into();
assert_eq!(YCbCr::cb(p), Ch16::new(0x4321));

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

Get the Cr component.

This the red-difference chroma.

Example: YCbCr Cr

use pix::chan::Ch8;
use pix::ycc::{YCbCr, YCbCr8};

let p = YCbCr8::new(0x93, 0x80, 0xA0);
assert_eq!(YCbCr::cr(p), Ch8::new(0xA0));

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

Get a mutable reference to the Cr component.

Example: Modify YCbCr Cr

use pix::chan::Ch8;
use pix::ycc::{YCbCr, YCbCr8};

let mut p = YCbCr8::new(0x88, 0x77, 0x66);
*YCbCr::cr_mut(&mut p) = 0x55.into();
assert_eq!(YCbCr::cr(p), Ch8::new(0x55));

Trait Implementations

impl Clone for YCbCr[src]

impl ColorModel for YCbCr[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 YCbCr[src]

impl Debug for YCbCr[src]

impl Default for YCbCr[src]

impl PartialEq<YCbCr> for YCbCr[src]

impl StructuralPartialEq for YCbCr[src]

Auto Trait Implementations

impl RefUnwindSafe for YCbCr

impl Send for YCbCr

impl Sync for YCbCr

impl Unpin for YCbCr

impl UnwindSafe for YCbCr

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.