pub struct OklabSpace { /* private fields */ }Expand description
Oklab relative to one set of RGB primaries.
Holds both directions so the two can’t be swapped: a GamutMatrix alone
doesn’t say which way it goes. Kernels take rgb_to_lms
or lms_to_rgb directly.
use zenpixels_convert::{Primaries, oklab::OklabSpace};
let space = OklabSpace::for_primaries(Primaries::Bt709).unwrap();
let [l, a, b] = space.from_rgb([1.0, 1.0, 1.0]);
assert!((l - 1.0).abs() < 1e-3 && a.abs() < 1e-3 && b.abs() < 1e-3);Implementations§
Source§impl OklabSpace
impl OklabSpace
Sourcepub fn for_primaries(primaries: Primaries) -> Option<Self>
pub fn for_primaries(primaries: Primaries) -> Option<Self>
The space for primaries, or None when they have no XYZ matrix here.
Sourcepub fn for_custom_primaries(primaries: CustomPrimaries) -> Option<Self>
pub fn for_custom_primaries(primaries: CustomPrimaries) -> Option<Self>
The space for validated zenpixels::CustomPrimaries (Bradford-adapted to D65).
Sourcepub const fn rgb_to_lms(&self) -> &GamutMatrix
pub const fn rgb_to_lms(&self) -> &GamutMatrix
Linear RGB to LMS, skipping an intermediate XYZ buffer.
Sourcepub const fn lms_to_rgb(&self) -> &GamutMatrix
pub const fn lms_to_rgb(&self) -> &GamutMatrix
LMS to linear RGB, skipping an intermediate XYZ buffer.
Trait Implementations§
Source§impl Clone for OklabSpace
impl Clone for OklabSpace
Source§fn clone(&self) -> OklabSpace
fn clone(&self) -> OklabSpace
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for OklabSpace
Source§impl Debug for OklabSpace
impl Debug for OklabSpace
Source§impl PartialEq for OklabSpace
impl PartialEq for OklabSpace
impl StructuralPartialEq for OklabSpace
Auto Trait Implementations§
impl Freeze for OklabSpace
impl RefUnwindSafe for OklabSpace
impl Send for OklabSpace
impl Sync for OklabSpace
impl Unpin for OklabSpace
impl UnsafeUnpin for OklabSpace
impl UnwindSafe for OklabSpace
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