[][src]Struct prisma::Lab

#[repr(C)]pub struct Lab<T, W> { /* fields omitted */ }

The CIELAB perceptually uniform device-independent color space

Lab is a color space obtained by a non-linear transformation for XYZ that is intended to be perceptually uniform, that is, such that a euclidean distance in any direction appears to change the same amount. Unlike XYZ, Lab spaces require a reference white point in order to be defined. This means that there are many different lab spaces that are incompatible because of having different white points. Like XYZ, most values in Lab lie outside the visible gamut of the eye.

The L value represents lightness, while a and b are green vs red and blue vs yellow respectively. Lab is one of two commonly used perceptually uniform spaces, the other being Luv.

A polar version of Lab exists as Lchab. Lchab is to Lab as Hsv is to Rgb, and is generally easier to reason about.

Implementations

impl<T, W> Lab<T, W> where
    T: FreeChannelScalar,
    W: UnitWhitePoint<T>, 
[src]

pub fn new(L: T, a: T, b: T) -> Self[src]

Construct a new Lab value with a named white point and channels.

Unlike new_with_whitepoint, new constructs a default instance of a UnitWhitePoint. It is only valid when W is a UnitWhitePoint.

impl<T, W> Lab<T, W> where
    T: FreeChannelScalar,
    W: WhitePoint<T>, 
[src]

pub fn new_with_whitepoint(L: T, a: T, b: T, white_point: W) -> Self[src]

Construct a new Lab value with a given white point and channels

pub fn color_cast<TOut>(&self) -> Lab<TOut, W> where
    T: ChannelFormatCast<TOut>,
    TOut: FreeChannelScalar
[src]

Convert the internal channel scalar format

pub fn L(&self) -> T[src]

Returns the L lightness channel scalar

pub fn a(&self) -> T[src]

Returns the a green-red channel scalar

pub fn b(&self) -> T[src]

Returns the b yellow-blue channel scalar

pub fn L_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the L lightness channel scalar

pub fn a_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the a green-red channel scalar

pub fn b_mut(&mut self) -> &mut T[src]

Returns a mutable reference to the b yellow-blue channel scalar

pub fn set_L(&mut self, val: T)[src]

Set the L channel scalar

pub fn set_a(&mut self, val: T)[src]

Set the a channel scalar

pub fn set_b(&mut self, val: T)[src]

Set the b channel scalar

pub fn white_point(&self) -> &W[src]

Returns a reference to the white point for the Lab color space

impl<T, W> Lab<T, W> where
    T: FreeChannelScalar,
    W: WhitePoint<T>, 
[src]

pub fn from_xyz(from: &Xyz<T>, wp: W) -> Lab<T, W>[src]

Construct an Lab value from an Xyz instance and a white point

pub fn to_xyz(&self) -> Xyz<T>[src]

Construct an Xyz value from self

pub fn epsilon() -> T[src]

Return the $\epsilon$ constant used in the Lab conversion

For a description of the value, visit BruceLindbloom.com.

pub fn kappa() -> T[src]

Return the $\kappa$ constant used in the Lab conversion

For a description of the value, visit BruceLindbloom.com.

Trait Implementations

impl<T, W> AbsDiffEq<Lab<T, W>> for Lab<T, W> where
    T: FreeChannelScalar + AbsDiffEq,
    T::Epsilon: Clone,
    W: WhitePoint<T>, 
[src]

type Epsilon = T::Epsilon

Used for specifying relative comparisons.

impl<T, W> Bounded for Lab<T, W> where
    T: FreeChannelScalar,
    W: WhitePoint<T>, 
[src]

impl<T, W> Broadcast for Lab<T, W> where
    T: FreeChannelScalar,
    W: UnitWhitePoint<T>, 
[src]

impl<T: Clone, W: Clone> Clone for Lab<T, W>[src]

impl<T, W> Color for Lab<T, W> where
    T: FreeChannelScalar,
    W: WhitePoint<T>, 
[src]

type Tag = LabTag

The unique tag unit struct identifying the color type

type ChannelsTuple = (T, T, T)

A tuple of types for each channel in the color

impl<T: Copy, W: Copy> Copy for Lab<T, W>[src]

impl<T: Debug, W: Debug> Debug for Lab<T, W>[src]

impl<T, W> Default for Lab<T, W> where
    T: FreeChannelScalar,
    W: UnitWhitePoint<T>, 
[src]

impl<T, W> Display for Lab<T, W> where
    T: FreeChannelScalar + Display,
    W: WhitePoint<T>, 
[src]

impl<T, W, A> FromColor<Lab<T, W>> for Lchab<T, W, A> where
    T: FreeChannelScalar,
    A: AngularChannelScalar + FromAngle<Rad<T>> + Angle,
    W: WhitePoint<T>, 
[src]

fn from_color(from: &Lab<T, W>) -> Self[src]

Construct an Lchab value from a Lab value

impl<T, W, A> FromColor<Lchab<T, W, A>> for Lab<T, W> where
    T: FreeChannelScalar,
    A: AngularChannelScalar + Angle<Scalar = T>,
    W: WhitePoint<T>, 
[src]

fn from_color(from: &Lchab<T, W, A>) -> Self[src]

Construct a Lab value from an Lchab value

impl<T, W> FromTuple for Lab<T, W> where
    T: FreeChannelScalar,
    W: UnitWhitePoint<T>, 
[src]

impl<T, W> HomogeneousColor for Lab<T, W> where
    T: FreeChannelScalar,
    W: WhitePoint<T>, 
[src]

type ChannelFormat = T

The scalar type of each channel

impl<T, W> Lerp for Lab<T, W> where
    T: FreeChannelScalar + Lerp,
    W: WhitePoint<T>, 
[src]

type Position = <FreeChannel<T> as Lerp>::Position

The type of the pos argument

impl<T: PartialEq, W: PartialEq> PartialEq<Lab<T, W>> for Lab<T, W>[src]

impl<T: PartialOrd, W: PartialOrd> PartialOrd<Lab<T, W>> for Lab<T, W>[src]

impl<T, W> RelativeEq<Lab<T, W>> for Lab<T, W> where
    T: FreeChannelScalar + RelativeEq,
    T::Epsilon: Clone,
    W: WhitePoint<T>, 
[src]

impl<T, W> StructuralPartialEq for Lab<T, W>[src]

impl<T, W> UlpsEq<Lab<T, W>> for Lab<T, W> where
    T: FreeChannelScalar + UlpsEq,
    T::Epsilon: Clone,
    W: WhitePoint<T>, 
[src]

Auto Trait Implementations

impl<T, W> RefUnwindSafe for Lab<T, W> where
    T: RefUnwindSafe,
    W: RefUnwindSafe

impl<T, W> Send for Lab<T, W> where
    T: Send,
    W: Send

impl<T, W> Sync for Lab<T, W> where
    T: Sync,
    W: Sync

impl<T, W> Unpin for Lab<T, W> where
    T: Unpin,
    W: Unpin

impl<T, W> UnwindSafe for Lab<T, W> where
    T: UnwindSafe,
    W: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.