#[repr(C)]pub struct LabHue<T: Float = f32>(/* private fields */);
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§
source§impl<T: Float> LabHue<T>
impl<T: Float> 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§
source§impl<T: Float + AbsDiffEq> AbsDiffEq for LabHue<T>
impl<T: Float + AbsDiffEq> AbsDiffEq for LabHue<T>
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
source§impl<T: Float + AddAssign> AddAssign<T> for LabHue<T>
impl<T: Float + AddAssign> AddAssign<T> for LabHue<T>
source§fn add_assign(&mut self, other: T)
fn add_assign(&mut self, other: T)
+=
operation. Read moresource§impl<T: Float + AddAssign> AddAssign for LabHue<T>
impl<T: Float + AddAssign> AddAssign for LabHue<T>
source§fn add_assign(&mut self, other: LabHue<T>)
fn add_assign(&mut self, other: LabHue<T>)
+=
operation. Read moresource§impl<'de, T> Deserialize<'de> for LabHue<T>where
T: Deserialize<'de> + Float,
impl<'de, T> Deserialize<'de> for LabHue<T>where
T: Deserialize<'de> + Float,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl<T: Float> PartialEq for LabHue<T>
impl<T: Float> PartialEq for LabHue<T>
source§impl<T: Float + RelativeEq> RelativeEq for LabHue<T>
impl<T: Float + RelativeEq> RelativeEq for LabHue<T>
source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
source§impl<T: Float + SubAssign> SubAssign<T> for LabHue<T>
impl<T: Float + SubAssign> SubAssign<T> for LabHue<T>
source§fn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
-=
operation. Read moresource§impl<T: Float + SubAssign> SubAssign for LabHue<T>
impl<T: Float + SubAssign> SubAssign for LabHue<T>
source§fn sub_assign(&mut self, other: LabHue<T>)
fn sub_assign(&mut self, other: LabHue<T>)
-=
operation. Read moresource§impl<T: Float + UlpsEq> UlpsEq for LabHue<T>
impl<T: Float + UlpsEq> UlpsEq for LabHue<T>
impl<T: Copy + Float> Copy 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§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for S
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<Swp, Dwp, T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
impl<T, U> ConvertInto<U> for Twhere
U: ConvertFrom<T>,
source§fn convert_into(self) -> U
fn convert_into(self) -> U
source§fn convert_unclamped_into(self) -> U
fn convert_unclamped_into(self) -> U
source§fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
fn try_convert_into(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains the unclamped color. Read more