pub struct Oklab {}
Implementations§
source§impl Oklab
impl Oklab
sourcepub fn l<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn l<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get the L component (perceived lightness).
Example: Oklab L
use pix::chan::Ch32;
use pix::oklab::{Oklab, Oklab32};
let p = Oklab32::new(0.25, 0.5, 1.0);
assert_eq!(Oklab::l(p), Ch32::new(0.25));
sourcepub fn l_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn l_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get a mutable reference to the L component.
Example: Modify Oklab L
use pix::chan::Ch32;
use pix::oklab::{Oklab, Oklab32};
let mut p = Oklab32::new(0.25, 0.5, 1.0);
*Oklab::l_mut(&mut p) = Ch32::new(0.75);
assert_eq!(Oklab::l(p), Ch32::new(0.75));
sourcepub fn a<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn a<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get the a component (green/red).
Example: Oklab a
use pix::chan::Ch16;
use pix::oklab::{Oklab, Oklab16};
let p = Oklab16::new(0x2000, 0x1234, 0x8000);
assert_eq!(Oklab::a(p), Ch16::new(0x1234));
sourcepub fn a_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn a_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get a mutable reference to the a component.
Example: Modify Oklab a
use pix::chan::Ch16;
use pix::oklab::{Oklab, Oklab16};
let mut p = Oklab16::new(0x2000, 0x1234, 0x8000);
*Oklab::a_mut(&mut p) = 0x4321.into();
assert_eq!(Oklab::a(p), Ch16::new(0x4321));
sourcepub fn b<P>(p: P) -> P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn b<P>(p: P) -> P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get the b component (blue/yellow).
Example: Oklab b
use pix::chan::Ch8;
use pix::oklab::{Oklab, Oklab8};
let p = Oklab8::new(0x93, 0x80, 0xA0);
assert_eq!(Oklab::b(p), Ch8::new(0xA0));
sourcepub fn b_mut<P>(p: &mut P) -> &mut P::Chanwhere
P: Pixel<Model = Self> + Pixel,
pub fn b_mut<P>(p: &mut P) -> &mut P::Chanwhere P: Pixel<Model = Self> + Pixel,
Get a mutable reference to the b component.
Example: Modify Oklab b
use pix::chan::Ch8;
use pix::oklab::{Oklab, Oklab8};
let mut p = Oklab8::new(0x88, 0x77, 0x66);
*Oklab::b_mut(&mut p) = 0x55.into();
assert_eq!(Oklab::b(p), Ch8::new(0x55));
Trait Implementations§
source§impl ColorModel for Oklab
impl ColorModel for Oklab
source§impl PartialEq<Oklab> for Oklab
impl PartialEq<Oklab> for Oklab
impl Copy for Oklab
impl Eq for Oklab
impl StructuralEq for Oklab
impl StructuralPartialEq for Oklab
Auto Trait Implementations§
impl RefUnwindSafe for Oklab
impl Send for Oklab
impl Sync for Oklab
impl Unpin for Oklab
impl UnwindSafe for Oklab
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