[−][src]Struct prisma::Lab
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]
T: FreeChannelScalar,
W: UnitWhitePoint<T>,
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]
T: FreeChannelScalar,
W: WhitePoint<T>,
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]
T: ChannelFormatCast<TOut>,
TOut: FreeChannelScalar,
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]
T: FreeChannelScalar,
W: WhitePoint<T>,
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]
T: FreeChannelScalar + AbsDiffEq,
T::Epsilon: Clone,
W: WhitePoint<T>,
type Epsilon = T::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> Self::Epsilon
[src]
fn abs_diff_eq(&self, other: &Self, epsilon: Self::Epsilon) -> bool
[src]
fn abs_diff_ne(&self, other: &Rhs, epsilon: Self::Epsilon) -> bool
[src]
impl<T, W> Bounded for Lab<T, W> where
T: FreeChannelScalar,
W: WhitePoint<T>,
[src]
T: FreeChannelScalar,
W: WhitePoint<T>,
fn normalize(self) -> Self
[src]
fn is_normalized(&self) -> bool
[src]
impl<T, W> Broadcast for Lab<T, W> where
T: FreeChannelScalar,
W: UnitWhitePoint<T>,
[src]
T: FreeChannelScalar,
W: UnitWhitePoint<T>,
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]
T: FreeChannelScalar,
W: WhitePoint<T>,
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
fn num_channels() -> u32
[src]
fn to_tuple(self) -> Self::ChannelsTuple
[src]
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]
T: FreeChannelScalar,
W: UnitWhitePoint<T>,
impl<T, W> Display for Lab<T, W> where
T: FreeChannelScalar + Display,
W: WhitePoint<T>,
[src]
T: FreeChannelScalar + Display,
W: WhitePoint<T>,
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]
T: FreeChannelScalar,
A: AngularChannelScalar + FromAngle<Rad<T>> + Angle,
W: WhitePoint<T>,
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]
T: FreeChannelScalar,
A: AngularChannelScalar + Angle<Scalar = T>,
W: WhitePoint<T>,
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]
T: FreeChannelScalar,
W: UnitWhitePoint<T>,
fn from_tuple(values: (T, T, T)) -> Self
[src]
impl<T, W> HomogeneousColor for Lab<T, W> where
T: FreeChannelScalar,
W: WhitePoint<T>,
[src]
T: FreeChannelScalar,
W: WhitePoint<T>,
impl<T, W> Lerp for Lab<T, W> where
T: FreeChannelScalar + Lerp,
W: WhitePoint<T>,
[src]
T: FreeChannelScalar + Lerp,
W: WhitePoint<T>,
type Position = <FreeChannel<T> as Lerp>::Position
The type of the pos
argument
fn lerp(&self, right: &Self, pos: Self::Position) -> Self
[src]
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]
fn partial_cmp(&self, other: &Lab<T, W>) -> Option<Ordering>
[src]
fn lt(&self, other: &Lab<T, W>) -> bool
[src]
fn le(&self, other: &Lab<T, W>) -> bool
[src]
fn gt(&self, other: &Lab<T, W>) -> bool
[src]
fn ge(&self, other: &Lab<T, W>) -> bool
[src]
impl<T, W> RelativeEq<Lab<T, W>> for Lab<T, W> where
T: FreeChannelScalar + RelativeEq,
T::Epsilon: Clone,
W: WhitePoint<T>,
[src]
T: FreeChannelScalar + RelativeEq,
T::Epsilon: Clone,
W: WhitePoint<T>,
fn default_max_relative() -> Self::Epsilon
[src]
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
&self,
other: &Rhs,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
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]
T: FreeChannelScalar + UlpsEq,
T::Epsilon: Clone,
W: WhitePoint<T>,
Auto Trait Implementations
impl<T, W> RefUnwindSafe for Lab<T, W> where
T: RefUnwindSafe,
W: RefUnwindSafe,
T: RefUnwindSafe,
W: RefUnwindSafe,
impl<T, W> Send for Lab<T, W> where
T: Send,
W: Send,
T: Send,
W: Send,
impl<T, W> Sync for Lab<T, W> where
T: Sync,
W: Sync,
T: Sync,
W: Sync,
impl<T, W> Unpin for Lab<T, W> where
T: Unpin,
W: Unpin,
T: Unpin,
W: Unpin,
impl<T, W> UnwindSafe for Lab<T, W> where
T: UnwindSafe,
W: UnwindSafe,
T: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,