pub struct Gray {}
Expand description
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.
Implementations§
source§impl Gray
impl Gray
sourcepub fn value<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self>,
pub fn value<P>(p: P) -> P::Chanwhere 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));
sourcepub fn value_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn value_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
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§
source§impl ColorModel for Gray
impl ColorModel for Gray
source§impl PartialEq<Gray> for Gray
impl PartialEq<Gray> for Gray
impl Copy for Gray
impl Eq for Gray
impl StructuralEq for Gray
impl StructuralPartialEq for Gray
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§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more