Enum Space

Source
pub enum Space {
    SRGB,
    HSV,
    LRGB,
    XYZ,
    CIELAB,
    CIELCH,
    OKLAB,
    OKLCH,
    JZAZBZ,
    JZCZHZ,
}
Expand description

Defines colorspace pixels will take.

Variants§

§

SRGB

Gamma-corrected sRGB.

§

HSV

Hue Saturation Value.

A UCS typically preferred for modern applications

§

LRGB

Linear RGB. IEC 61966-2-1:1999 transferred

§

XYZ

1931 CIE XYZ @ D65.

§

CIELAB

CIE LAB. Lightness, red/green chromacity, yellow/blue chromacity.

1976 UCS with many known flaws. Most other LAB spaces derive from this

§

CIELCH

CIE LCH(ab). Lightness, Chroma, Hue

Cylindrical version of CIE LAB.

§

OKLAB

Oklab

https://bottosson.github.io/posts/oklab/

2020 UCS, used in CSS Color Module Level 4

§

OKLCH

Cylindrical version of OKLAB.

§

JZAZBZ

JzAzBz

https://opg.optica.org/oe/fulltext.cfm?uri=oe-25-13-15131

2017 UCS, intended for uniform hue and HDR colors

§

JZCZHZ

Cylindrical version of JzAzBz

Implementations§

Source§

impl Space

Source

pub const ALL: &'static [Space]

All color spaces

Source

pub const UCS: &'static [Space]

Uniform color spaces

Source

pub const UCS_POLAR: &'static [Space]

Uniform color spaces in cylindrical/polar format

Source

pub const TRI: &'static [Space]

RGB/Tristimulus color spaces

Source

pub fn channels(&self) -> [char; 3]

Returns 3 channels letters for user-facing colorspace controls

Source

pub const fn srgb_quants(&self) -> [[f32; 3]; 101]

Retrieves a map from a given Space back to SRGB.

This is useful for things like creating adjustable values in Space that represent most of the SRGB range without clipping. Wrapping Hue values are set to f32::INFINITY

Trait Implementations§

Source§

impl Clone for Space

Source§

fn clone(&self) -> Space

Returns a duplicate 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 Space

Source§

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

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

impl Display for Space

Source§

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

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

impl PartialEq for Space

Source§

fn eq(&self, other: &Space) -> 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 TryFrom<&str> for Space

Source§

type Error = ()

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

fn try_from(value: &str) -> Result<Self, ()>

Performs the conversion.
Source§

impl TryFrom<*const i8> for Space

Source§

type Error = ()

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

fn try_from(value: *const c_char) -> Result<Self, ()>

Performs the conversion.
Source§

impl Copy for Space

Source§

impl Eq for Space

Source§

impl StructuralPartialEq for Space

Auto Trait Implementations§

§

impl Freeze for Space

§

impl RefUnwindSafe for Space

§

impl Send for Space

§

impl Sync for Space

§

impl Unpin for Space

§

impl UnwindSafe for Space

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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> 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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. 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.