Expand description
A hue type for the CIE L*a*b* family of color spaces.
It’s measured in degrees and it’s based on the four physiological elementary colors red, yellow, green and blue. This makes it different from the hue of RGB based color spaces.
The hue is a circular type, where 0
and 360
is the same, and
it’s normalized to (-180, 180]
when it’s converted to a linear
number (like f32
). This makes many calculations easier, but may
also have some surprising effects if it’s expected to act as a
linear number.
Implementations
sourceimpl<T: Float + FromF64> LabHue<T>
impl<T: Float + FromF64> LabHue<T>
sourcepub fn from_degrees(degrees: T) -> LabHue<T>
pub fn from_degrees(degrees: T) -> LabHue<T>
Create a new hue from degrees.
sourcepub fn from_radians(radians: T) -> LabHue<T>
pub fn from_radians(radians: T) -> LabHue<T>
Create a new hue from radians, instead of degrees.
sourcepub fn to_degrees(self) -> T
pub fn to_degrees(self) -> T
Get the hue as degrees, in the range (-180, 180]
.
sourcepub fn to_radians(self) -> T
pub fn to_radians(self) -> T
Convert the hue to radians, in the range (-π, π]
.
sourcepub fn to_positive_degrees(self) -> T
pub fn to_positive_degrees(self) -> T
Convert the hue to positive degrees, in the range [0, 360)
.
sourcepub fn to_positive_radians(self) -> T
pub fn to_positive_radians(self) -> T
Convert the hue to positive radians, in the range [0, 2π)
.
sourcepub fn to_raw_degrees(self) -> T
pub fn to_raw_degrees(self) -> T
Get the internal representation, without normalizing it.
sourcepub fn to_raw_radians(self) -> T
pub fn to_raw_radians(self) -> T
Get the internal representation as radians, without normalizing it.
Trait Implementations
sourceimpl<T: Float + FromF64 + AbsDiffEq> AbsDiffEq<LabHue<T>> for LabHue<T> where
T::Epsilon: Float + FromF64,
impl<T: Float + FromF64 + AbsDiffEq> AbsDiffEq<LabHue<T>> for LabHue<T> where
T::Epsilon: Float + FromF64,
sourcefn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
sourcefn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool
fn abs_diff_eq(&self, other: &Self, epsilon: T::Epsilon) -> bool
A test for equality that uses the absolute difference to compute the approximate equality of two numbers. Read more
sourcefn abs_diff_ne(&self, other: &Self, epsilon: T::Epsilon) -> bool
fn abs_diff_ne(&self, other: &Self, epsilon: T::Epsilon) -> bool
The inverse of AbsDiffEq::abs_diff_eq
.
sourceimpl<T: Float + AddAssign> AddAssign<LabHue<T>> for LabHue<T>
impl<T: Float + AddAssign> AddAssign<LabHue<T>> for LabHue<T>
sourcefn add_assign(&mut self, other: LabHue<T>)
fn add_assign(&mut self, other: LabHue<T>)
Performs the +=
operation. Read more
sourceimpl AddAssign<LabHue<f32>> for f32
impl AddAssign<LabHue<f32>> for f32
sourcefn add_assign(&mut self, other: LabHue<f32>)
fn add_assign(&mut self, other: LabHue<f32>)
Performs the +=
operation. Read more
sourceimpl AddAssign<LabHue<f64>> for f64
impl AddAssign<LabHue<f64>> for f64
sourcefn add_assign(&mut self, other: LabHue<f64>)
fn add_assign(&mut self, other: LabHue<f64>)
Performs the +=
operation. Read more
sourceimpl<T: Float + AddAssign> AddAssign<T> for LabHue<T>
impl<T: Float + AddAssign> AddAssign<T> for LabHue<T>
sourcefn add_assign(&mut self, other: T)
fn add_assign(&mut self, other: T)
Performs the +=
operation. Read more
sourceimpl<T: Float + FromF64 + RelativeEq> RelativeEq<LabHue<T>> for LabHue<T> where
T::Epsilon: Float + FromF64,
impl<T: Float + FromF64 + RelativeEq> RelativeEq<LabHue<T>> for LabHue<T> where
T::Epsilon: Float + FromF64,
sourcefn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
sourcefn relative_eq(
&self,
other: &Self,
epsilon: T::Epsilon,
max_relative: T::Epsilon
) -> bool
fn relative_eq(
&self,
other: &Self,
epsilon: T::Epsilon,
max_relative: T::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
sourcefn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
The inverse of RelativeEq::relative_eq
.
sourceimpl<T: Float + SubAssign> SubAssign<LabHue<T>> for LabHue<T>
impl<T: Float + SubAssign> SubAssign<LabHue<T>> for LabHue<T>
sourcefn sub_assign(&mut self, other: LabHue<T>)
fn sub_assign(&mut self, other: LabHue<T>)
Performs the -=
operation. Read more
sourceimpl SubAssign<LabHue<f32>> for f32
impl SubAssign<LabHue<f32>> for f32
sourcefn sub_assign(&mut self, other: LabHue<f32>)
fn sub_assign(&mut self, other: LabHue<f32>)
Performs the -=
operation. Read more
sourceimpl SubAssign<LabHue<f64>> for f64
impl SubAssign<LabHue<f64>> for f64
sourcefn sub_assign(&mut self, other: LabHue<f64>)
fn sub_assign(&mut self, other: LabHue<f64>)
Performs the -=
operation. Read more
sourceimpl<T: Float + SubAssign> SubAssign<T> for LabHue<T>
impl<T: Float + SubAssign> SubAssign<T> for LabHue<T>
sourcefn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
Performs the -=
operation. Read more
sourceimpl<T: Float + FromF64 + UlpsEq> UlpsEq<LabHue<T>> for LabHue<T> where
T::Epsilon: Float + FromF64,
impl<T: Float + FromF64 + UlpsEq> UlpsEq<LabHue<T>> for LabHue<T> where
T::Epsilon: Float + FromF64,
impl<T: Copy + Float> Copy for LabHue<T>
impl<T: Float + FromF64 + Eq> Eq for LabHue<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for LabHue<T> where
T: RefUnwindSafe,
impl<T> Send for LabHue<T> where
T: Send,
impl<T> Sync for LabHue<T> where
T: Sync,
impl<T> Unpin for LabHue<T> where
T: Unpin,
impl<T> UnwindSafe for LabHue<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S where
T: FloatComponent,
Swp: WhitePoint,
Dwp: WhitePoint,
D: AdaptFrom<S, Swp, Dwp, T>,
sourcefn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> D where
M: TransformMatrix<Swp, Dwp, T>,
Convert the source color to the destination color using the specified method Read more
sourcefn adapt_into(self) -> D
fn adapt_into(self) -> D
Convert the source color to the destination color using the bradford method by default Read more
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T, U> IntoColor<U> for T where
U: FromColor<T>,
impl<T, U> IntoColor<U> for T where
U: FromColor<T>,
sourcefn into_color(self) -> U
fn into_color(self) -> U
Convert into T with values clamped to the color defined bounds Read more
sourceimpl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for T where
U: FromColorUnclamped<T>,
sourcefn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
Convert into T. The resulting color might be invalid in its color space Read more
sourceimpl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for T where
U: TryFromColor<T>,
sourcefn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
Convert into T, returning ok if the color is inside of its defined
range, otherwise an OutOfBounds
error is returned which contains
the unclamped color. Read more