pub struct Xyz {}
Expand description
Implementations§
source§impl Xyz
impl Xyz
sourcepub fn x<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn x<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get the X component.
Example: Xyz X
use pix::chan::Ch32;
use pix::xyz::{Xyz, Xyz32};
let p = Xyz32::new(0.25, 0.5, 1.0);
assert_eq!(Xyz::x(p), Ch32::new(0.25));
sourcepub fn x_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn x_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get a mutable reference to the X component.
Example: Modify Xyz X
use pix::chan::Ch32;
use pix::xyz::{Xyz, Xyz32};
let mut p = Xyz32::new(0.25, 0.5, 1.0);
*Xyz::x_mut(&mut p) = Ch32::new(0.75);
assert_eq!(Xyz::x(p), Ch32::new(0.75));
sourcepub fn y<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn y<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get the Y component.
Example: Xyz Y
use pix::chan::Ch16;
use pix::xyz::{Xyz, Xyz16};
let p = Xyz16::new(0x2000, 0x1234, 0x8000);
assert_eq!(Xyz::y(p), Ch16::new(0x1234));
sourcepub fn y_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn y_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get a mutable reference to the Y component.
Example: Modify Xyz Y
use pix::chan::Ch16;
use pix::xyz::{Xyz, Xyz16};
let mut p = Xyz16::new(0x2000, 0x1234, 0x8000);
*Xyz::y_mut(&mut p) = 0x4321.into();
assert_eq!(Xyz::y(p), Ch16::new(0x4321));
sourcepub fn z<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn z<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get the Z component.
Example: Xyz Z
use pix::chan::Ch8;
use pix::xyz::{Xyz, Xyz8};
let p = Xyz8::new(0x93, 0x80, 0xA0);
assert_eq!(Xyz::z(p), Ch8::new(0xA0));
sourcepub fn z_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn z_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get a mutable reference to the Z component.
Example: Modify Xyz Z
use pix::chan::Ch8;
use pix::xyz::{Xyz, Xyz8};
let mut p = Xyz8::new(0x88, 0x77, 0x66);
*Xyz::z_mut(&mut p) = 0x55.into();
assert_eq!(Xyz::z(p), Ch8::new(0x55));
Trait Implementations§
source§impl ColorModel for Xyz
impl ColorModel for Xyz
impl Copy for Xyz
impl Eq for Xyz
impl StructuralEq for Xyz
impl StructuralPartialEq for Xyz
Auto Trait Implementations§
impl RefUnwindSafe for Xyz
impl Send for Xyz
impl Sync for Xyz
impl Unpin for Xyz
impl UnwindSafe for Xyz
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