#[repr(C)]pub struct Oklab {
pub l: f32,
pub a: f32,
pub b: f32,
}Expand description
Struct that represent Oklab colorspace
Fields§
§l: f32All values in Oklab intended to be normalized [0;1]
a: f32A value range [-0.5; 0.5]
b: f32B value range [-0.5; 0.5]
Implementations§
source§impl Oklab
impl Oklab
pub fn new(l: f32, a: f32, b: f32) -> Oklab
sourcepub fn from_rgb(rgb: Rgb<u8>, transfer_function: TransferFunction) -> Oklab
pub fn from_rgb(rgb: Rgb<u8>, transfer_function: TransferFunction) -> Oklab
Converts from Rgb to Oklab using provided TransferFunction
sourcepub fn to_rgb(&self, transfer_function: TransferFunction) -> Rgb<u8>
pub fn to_rgb(&self, transfer_function: TransferFunction) -> Rgb<u8>
Converts Oklab to Rgb using provided TransferFunction
sourcepub fn to_srgb_f32(&self) -> Rgb<f32>
pub fn to_srgb_f32(&self) -> Rgb<f32>
sourcepub fn to_rgb_f32(&self, transfer_function: TransferFunction) -> Rgb<f32>
pub fn to_rgb_f32(&self, transfer_function: TransferFunction) -> Rgb<f32>
Converts Oklab to Rgb using provided TransferFunction
sourcepub fn to_linear_rgb(&self) -> Rgb<f32>
pub fn to_linear_rgb(&self) -> Rgb<f32>
Converts to linear RGB
pub fn hybrid_distance(&self, other: Self) -> f32
pub const fn l_range() -> (f32, f32)
pub const fn a_range() -> (f32, f32)
pub const fn b_range() -> (f32, f32)
Trait Implementations§
source§impl AddAssign<f32> for Oklab
impl AddAssign<f32> for Oklab
source§fn add_assign(&mut self, rhs: f32)
fn add_assign(&mut self, rhs: f32)
Performs the
+= operation. Read moresource§impl AddAssign for Oklab
impl AddAssign for Oklab
source§fn add_assign(&mut self, rhs: Oklab)
fn add_assign(&mut self, rhs: Oklab)
Performs the
+= operation. Read moresource§impl DivAssign<f32> for Oklab
impl DivAssign<f32> for Oklab
source§fn div_assign(&mut self, rhs: f32)
fn div_assign(&mut self, rhs: f32)
Performs the
/= operation. Read moresource§impl DivAssign for Oklab
impl DivAssign for Oklab
source§fn div_assign(&mut self, rhs: Oklab)
fn div_assign(&mut self, rhs: Oklab)
Performs the
/= operation. Read moresource§impl EuclideanDistance for Oklab
impl EuclideanDistance for Oklab
fn euclidean_distance(&self, other: Self) -> f32
source§impl MulAssign<f32> for Oklab
impl MulAssign<f32> for Oklab
source§fn mul_assign(&mut self, rhs: f32)
fn mul_assign(&mut self, rhs: f32)
Performs the
*= operation. Read moresource§impl MulAssign for Oklab
impl MulAssign for Oklab
source§fn mul_assign(&mut self, rhs: Oklab)
fn mul_assign(&mut self, rhs: Oklab)
Performs the
*= operation. Read moresource§impl PartialOrd for Oklab
impl PartialOrd for Oklab
source§impl SubAssign<f32> for Oklab
impl SubAssign<f32> for Oklab
source§fn sub_assign(&mut self, rhs: f32)
fn sub_assign(&mut self, rhs: f32)
Performs the
-= operation. Read moresource§impl SubAssign for Oklab
impl SubAssign for Oklab
source§fn sub_assign(&mut self, rhs: Oklab)
fn sub_assign(&mut self, rhs: Oklab)
Performs the
-= operation. Read moresource§impl TaxicabDistance for Oklab
impl TaxicabDistance for Oklab
fn taxicab_distance(&self, other: Self) -> f32
impl Copy for Oklab
impl StructuralPartialEq for Oklab
Auto Trait Implementations§
impl Freeze for Oklab
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more