[−][src]Struct pix::gray::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]
P: Pixel<Model = Self>,
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]
P: Pixel<Model = Self>,
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]
const CIRCULAR: Range<usize>
[src]
const LINEAR: Range<usize>
[src]
const ALPHA: usize
[src]
fn into_rgba<P>(p: P) -> PixRgba<P> where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
Convert into red, green, blue and alpha components
fn from_rgba<P>(rgba: PixRgba<P>) -> P where
P: Pixel<Model = Self>,
[src]
P: Pixel<Model = Self>,
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,