colorutils_rs

Struct Oklab

source
#[repr(C)]
pub struct Oklab { pub l: f32, pub a: f32, pub b: f32, }
Expand description

Struct that represent Oklab colorspace

Fields§

§l: f32

All values in Oklab intended to be normalized [0;1]

§a: f32

A value range [-0.5; 0.5]

§b: f32

B value range [-0.5; 0.5]

Implementations§

source§

impl Oklab

source

pub fn new(l: f32, a: f32, b: f32) -> Oklab

source

pub fn from_srgb(rgb: Rgb<u8>) -> Oklab

Converts from sRGB Rgb to Oklab using sRGB transfer function

source

pub fn from_rgb(rgb: Rgb<u8>, transfer_function: TransferFunction) -> Oklab

Converts from Rgb to Oklab using provided TransferFunction

source

pub fn from_linear_rgb(rgb: Rgb<f32>) -> Oklab

Convert Linear Rgb to Oklab

source

pub fn to_srgb(&self) -> Rgb<u8>

Converts Oklab to Rgb using sRGB transfer function

source

pub fn to_rgb(&self, transfer_function: TransferFunction) -> Rgb<u8>

Converts Oklab to Rgb using provided TransferFunction

source

pub fn to_srgb_f32(&self) -> Rgb<f32>

Converts Oklab to linear Rgb using sRGB transfer function

source

pub fn to_rgb_f32(&self, transfer_function: TransferFunction) -> Rgb<f32>

Converts Oklab to Rgb using provided TransferFunction

source

pub fn to_linear_rgb(&self) -> Rgb<f32>

Converts to linear RGB

source

pub fn hybrid_distance(&self, other: Self) -> f32

source

pub const fn l_range() -> (f32, f32)

source

pub const fn a_range() -> (f32, f32)

source

pub const fn b_range() -> (f32, f32)

source§

impl Oklab

source

pub fn sqrt(&self) -> Oklab

source

pub fn cbrt(&self) -> Oklab

Trait Implementations§

source§

impl Add<f32> for Oklab

source§

type Output = Oklab

The resulting type after applying the + operator.
source§

fn add(self, rhs: f32) -> Oklab

Performs the + operation. Read more
source§

impl Add for Oklab

source§

type Output = Oklab

The resulting type after applying the + operator.
source§

fn add(self, rhs: Self) -> Oklab

Performs the + operation. Read more
source§

impl AddAssign<f32> for Oklab

source§

fn add_assign(&mut self, rhs: f32)

Performs the += operation. Read more
source§

impl AddAssign for Oklab

source§

fn add_assign(&mut self, rhs: Oklab)

Performs the += operation. Read more
source§

impl Clone for Oklab

source§

fn clone(&self) -> Oklab

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Oklab

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Div<f32> for Oklab

source§

type Output = Oklab

The resulting type after applying the / operator.
source§

fn div(self, rhs: f32) -> Self::Output

Performs the / operation. Read more
source§

impl Div for Oklab

source§

type Output = Oklab

The resulting type after applying the / operator.
source§

fn div(self, rhs: Oklab) -> Self::Output

Performs the / operation. Read more
source§

impl DivAssign<f32> for Oklab

source§

fn div_assign(&mut self, rhs: f32)

Performs the /= operation. Read more
source§

impl DivAssign for Oklab

source§

fn div_assign(&mut self, rhs: Oklab)

Performs the /= operation. Read more
source§

impl EuclideanDistance for Oklab

source§

fn euclidean_distance(&self, other: Self) -> f32

source§

impl Mul<f32> for Oklab

source§

type Output = Oklab

The resulting type after applying the * operator.
source§

fn mul(self, rhs: f32) -> Self::Output

Performs the * operation. Read more
source§

impl Mul for Oklab

source§

type Output = Oklab

The resulting type after applying the * operator.
source§

fn mul(self, rhs: Oklab) -> Self::Output

Performs the * operation. Read more
source§

impl MulAssign<f32> for Oklab

source§

fn mul_assign(&mut self, rhs: f32)

Performs the *= operation. Read more
source§

impl MulAssign for Oklab

source§

fn mul_assign(&mut self, rhs: Oklab)

Performs the *= operation. Read more
source§

impl Neg for Oklab

source§

type Output = Oklab

The resulting type after applying the - operator.
source§

fn neg(self) -> Self::Output

Performs the unary - operation. Read more
source§

impl PartialEq for Oklab

source§

fn eq(&self, other: &Oklab) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for Oklab

source§

fn partial_cmp(&self, other: &Oklab) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl Pow<Oklab> for Oklab

source§

type Output = Oklab

The result after applying the operator.
source§

fn pow(self, rhs: Oklab) -> Self::Output

Returns self to the power rhs. Read more
source§

impl Pow<f32> for Oklab

source§

type Output = Oklab

The result after applying the operator.
source§

fn pow(self, rhs: f32) -> Self::Output

Returns self to the power rhs. Read more
source§

impl Sub<f32> for Oklab

source§

type Output = Oklab

The resulting type after applying the - operator.
source§

fn sub(self, rhs: f32) -> Self::Output

Performs the - operation. Read more
source§

impl Sub for Oklab

source§

type Output = Oklab

The resulting type after applying the - operator.
source§

fn sub(self, rhs: Oklab) -> Self::Output

Performs the - operation. Read more
source§

impl SubAssign<f32> for Oklab

source§

fn sub_assign(&mut self, rhs: f32)

Performs the -= operation. Read more
source§

impl SubAssign for Oklab

source§

fn sub_assign(&mut self, rhs: Oklab)

Performs the -= operation. Read more
source§

impl TaxicabDistance for Oklab

source§

fn taxicab_distance(&self, other: Self) -> f32

source§

impl Copy for Oklab

source§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

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 more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
source§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.