[][src]Struct pix::gray::Gray

pub struct Gray {}

Gray color model.

The components are value and optional alpha. Value ranges from black to white. With sRGB gamma it is luma, but with linear gamma it is relative luminance.

Methods

impl Gray[src]

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

Get the luma / relative luminance component.

Example: Get Value

use pix::chan::Ch16;
use pix::gray::{Gray, Gray16};

let p = Gray16::new(0x4000);
assert_eq!(Gray::value(p), Ch16::new(0x4000));

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

Get a mutable reference to the luma / relative luminance component.

Example: Modify Value

use pix::chan::Ch8;
use pix::gray::{Gray, Gray8};

let mut p = Gray8::new(0x40);
*Gray::value_mut(&mut p) = 0x50.into();
assert_eq!(Gray::value(p), Ch8::new(0x50));

Trait Implementations

impl Clone for Gray[src]

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

impl Debug for Gray[src]

impl Default for Gray[src]

impl PartialEq<Gray> for Gray[src]

impl StructuralPartialEq for Gray[src]

Auto Trait Implementations

impl RefUnwindSafe for Gray

impl Send for Gray

impl Sync for Gray

impl Unpin for Gray

impl UnwindSafe for Gray

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.