[][src]Struct pix::rgb::Rgb

pub struct Rgb {}

RGB additive color model.

The components are red, green, blue and optional alpha.

Methods

impl Rgb[src]

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

Get the red component.

Example: RGB Red

use pix::chan::Ch32;
use pix::rgb::{Rgb, Rgb32};

let p = Rgb32::new(0.25, 0.5, 1.0);
assert_eq!(Rgb::red(p), Ch32::new(0.25));

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

Get a mutable reference to the red component.

Example: Modify RGB Red

use pix::chan::Ch32;
use pix::rgb::{Rgb, Rgb32};

let mut p = Rgb32::new(0.25, 0.5, 1.0);
*Rgb::red_mut(&mut p) = Ch32::new(0.75);
assert_eq!(Rgb::red(p), Ch32::new(0.75));

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

Get the green component.

Example: RGB Green

use pix::chan::Ch16;
use pix::rgb::{Rgb, Rgb16};

let p = Rgb16::new(0x2000, 0x1234, 0x8000);
assert_eq!(Rgb::green(p), Ch16::new(0x1234));

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

Get a mutable reference to the green component.

Example: Modify RGB Green

use pix::chan::Ch16;
use pix::rgb::{Rgb, Rgb16};

let mut p = Rgb16::new(0x2000, 0x1234, 0x8000);
*Rgb::green_mut(&mut p) = 0x4321.into();
assert_eq!(Rgb::green(p), Ch16::new(0x4321));

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

Get the blue component.

Example: RGB Blue

use pix::chan::Ch8;
use pix::rgb::{Rgb, Rgb8};

let p = Rgb8::new(0x93, 0x80, 0xA0);
assert_eq!(Rgb::blue(p), Ch8::new(0xA0));

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

Get a mutable reference to the blue component.

Example: Modify RGB Blue

use pix::chan::Ch8;
use pix::rgb::{Rgb, Rgb8};

let mut p = Rgb8::new(0x88, 0x77, 0x66);
*Rgb::blue_mut(&mut p) = 0x55.into();
assert_eq!(Rgb::blue(p), Ch8::new(0x55));

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

Get channel-wise difference

pub fn within_threshold<P: Pixel>(p: P, rhs: P) -> bool where
    P: Pixel<Model = Self>, 
[src]

Check if all Channels are within threshold

Trait Implementations

impl Clone for Rgb[src]

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

impl Debug for Rgb[src]

impl Default for Rgb[src]

impl PartialEq<Rgb> for Rgb[src]

impl StructuralPartialEq for Rgb[src]

Auto Trait Implementations

impl RefUnwindSafe for Rgb

impl Send for Rgb

impl Sync for Rgb

impl Unpin for Rgb

impl UnwindSafe for Rgb

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.