#[repr(C)]pub struct LuvHue<T = f32>(/* private fields */);
Expand description
A hue type for the CIE L*u*v* family of 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> LuvHue<T>
impl<T> LuvHue<T>
sourcepub const fn new(angle: T) -> LuvHue<T>
pub const fn new(angle: T) -> LuvHue<T>
Create a new hue, specified in the default unit for the angle
type T
.
f32
, f64
and other real number types represent degrees,
while u8
simply represents the range [0, 360]
as [0, 256]
.
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Get the internal representation without normalizing or converting it.
f32
, f64
and other real number types represent degrees,
while u8
simply represents the range [0, 360]
as [0, 256]
.
sourcepub fn into_format<U>(self) -> LuvHue<U>where
U: FromAngle<T>,
pub fn into_format<U>(self) -> LuvHue<U>where
U: FromAngle<T>,
Convert into another angle type.
sourcepub fn from_format<U>(hue: LuvHue<U>) -> LuvHue<T>where
T: FromAngle<U>,
pub fn from_format<U>(hue: LuvHue<U>) -> LuvHue<T>where
T: FromAngle<U>,
Convert from another angle type.
source§impl<T> LuvHue<T>where
T: RealAngle,
impl<T> LuvHue<T>where
T: RealAngle,
sourcepub fn from_degrees(degrees: T) -> LuvHue<T>
pub fn from_degrees(degrees: T) -> LuvHue<T>
Create a new hue from degrees. This is an alias for new
.
sourcepub fn from_radians(radians: T) -> LuvHue<T>
pub fn from_radians(radians: T) -> LuvHue<T>
Create a new hue from radians, instead of degrees.
sourcepub fn into_raw_degrees(self) -> T
pub fn into_raw_degrees(self) -> T
Get the internal representation as degrees, without normalizing it.
sourcepub fn into_raw_radians(self) -> T
pub fn into_raw_radians(self) -> T
Get the internal representation as radians, without normalizing it.
source§impl<T> LuvHue<T>where
T: RealAngle + SignedAngle,
impl<T> LuvHue<T>where
T: RealAngle + SignedAngle,
sourcepub fn into_degrees(self) -> T
pub fn into_degrees(self) -> T
Get the hue as degrees, in the range (-180, 180]
.
sourcepub fn into_radians(self) -> T
pub fn into_radians(self) -> T
Convert the hue to radians, in the range (-π, π]
.
source§impl<T> LuvHue<T>where
T: RealAngle + UnsignedAngle,
impl<T> LuvHue<T>where
T: RealAngle + UnsignedAngle,
sourcepub fn into_positive_degrees(self) -> T
pub fn into_positive_degrees(self) -> T
Convert the hue to positive degrees, in the range [0, 360)
.
sourcepub fn into_positive_radians(self) -> T
pub fn into_positive_radians(self) -> T
Convert the hue to positive radians, in the range [0, 2π)
.
source§impl<T> LuvHue<T>where
T: RealAngle + Trigonometry,
impl<T> LuvHue<T>where
T: RealAngle + Trigonometry,
sourcepub fn from_cartesian(a: T, b: T) -> LuvHue<T>
pub fn from_cartesian(a: T, b: T) -> LuvHue<T>
Returns a hue from a
and b
, normalized to [0°, 360°)
.
If a
and b
are both 0
, returns 0
,
sourcepub fn into_cartesian(self) -> (T, T)
pub fn into_cartesian(self) -> (T, T)
Returns a
and b
values for this hue, normalized to [-1, 1]
.
They will have to be multiplied by a radius values, such as saturation, value, chroma, etc., to represent a specific color.
source§impl<C> LuvHue<C>
impl<C> LuvHue<C>
sourcepub fn iter<'a>(&'a self) -> <&'a LuvHue<C> as IntoIterator>::IntoIterwhere
&'a LuvHue<C>: IntoIterator,
pub fn iter<'a>(&'a self) -> <&'a LuvHue<C> as IntoIterator>::IntoIterwhere
&'a LuvHue<C>: IntoIterator,
Return an iterator over the hues in the wrapped collection.
sourcepub fn iter_mut<'a>(
&'a mut self,
) -> <&'a mut LuvHue<C> as IntoIterator>::IntoIterwhere
&'a mut LuvHue<C>: IntoIterator,
pub fn iter_mut<'a>(
&'a mut self,
) -> <&'a mut LuvHue<C> as IntoIterator>::IntoIterwhere
&'a mut LuvHue<C>: IntoIterator,
Return an iterator that allows modifying the hues in the wrapped collection.
sourcepub fn get<'a, I, T>(
&'a self,
index: I,
) -> Option<LuvHue<&'a <I as SliceIndex<[T]>>::Output>>
pub fn get<'a, I, T>( &'a self, index: I, ) -> Option<LuvHue<&'a <I as SliceIndex<[T]>>::Output>>
Get a hue, or slice of hues, with references to the values at index
. See slice::get
for details.
sourcepub fn get_mut<'a, I, T>(
&'a mut self,
index: I,
) -> Option<LuvHue<&'a mut <I as SliceIndex<[T]>>::Output>>
pub fn get_mut<'a, I, T>( &'a mut self, index: I, ) -> Option<LuvHue<&'a mut <I as SliceIndex<[T]>>::Output>>
Get a hue, or slice of hues, that allows modifying the values at index
. See slice::get_mut
for details.
source§impl<T> LuvHue<Vec<T>>
impl<T> LuvHue<Vec<T>>
sourcepub fn with_capacity(capacity: usize) -> LuvHue<Vec<T>>
pub fn with_capacity(capacity: usize) -> LuvHue<Vec<T>>
Create a struct with a vector with a minimum capacity. See Vec::with_capacity
for details.
sourcepub fn push(&mut self, value: LuvHue<T>)
pub fn push(&mut self, value: LuvHue<T>)
Push an additional hue onto the hue vector. See Vec::push
for details.
sourcepub fn pop(&mut self) -> Option<LuvHue<T>>
pub fn pop(&mut self) -> Option<LuvHue<T>>
Pop a hue from the hue vector. See Vec::pop
for details.
sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Clear the hue vector. See Vec::clear
for details.
sourcepub fn drain<R>(&mut self, range: R) -> LuvHueIter<Drain<'_, T>> ⓘ
pub fn drain<R>(&mut self, range: R) -> LuvHueIter<Drain<'_, T>> ⓘ
Return an iterator that moves hues out of the specified range.
Trait Implementations§
source§impl<T> AbsDiffEq for LuvHue<T>
impl<T> AbsDiffEq for LuvHue<T>
source§fn default_epsilon() -> <LuvHue<T> as AbsDiffEq>::Epsilon
fn default_epsilon() -> <LuvHue<T> as AbsDiffEq>::Epsilon
source§fn abs_diff_eq(
&self,
other: &LuvHue<T>,
epsilon: <T as AbsDiffEq>::Epsilon,
) -> bool
fn abs_diff_eq( &self, other: &LuvHue<T>, epsilon: <T as AbsDiffEq>::Epsilon, ) -> bool
source§fn abs_diff_ne(
&self,
other: &LuvHue<T>,
epsilon: <T as AbsDiffEq>::Epsilon,
) -> bool
fn abs_diff_ne( &self, other: &LuvHue<T>, epsilon: <T as AbsDiffEq>::Epsilon, ) -> bool
AbsDiffEq::abs_diff_eq
.source§impl<T> AddAssign<T> for LuvHue<T>where
T: AddAssign,
impl<T> AddAssign<T> for LuvHue<T>where
T: AddAssign,
source§fn add_assign(&mut self, other: T)
fn add_assign(&mut self, other: T)
+=
operation. Read moresource§impl<T> AddAssign for LuvHue<T>where
T: AddAssign,
impl<T> AddAssign for LuvHue<T>where
T: AddAssign,
source§fn add_assign(&mut self, other: LuvHue<T>)
fn add_assign(&mut self, other: LuvHue<T>)
+=
operation. Read moresource§impl<'de, T> Deserialize<'de> for LuvHue<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for LuvHue<T>where
T: Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<LuvHue<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<LuvHue<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<C, T> Extend<T> for LuvHue<C>where
C: Extend<T>,
impl<C, T> Extend<T> for LuvHue<C>where
C: Extend<T>,
source§fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
fn extend<I>(&mut self, iter: I)where
I: IntoIterator<Item = T>,
source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)source§impl<'a, 'b, T> IntoIterator for &'a LuvHue<&'b [T]>
impl<'a, 'b, T> IntoIterator for &'a LuvHue<&'b [T]>
source§impl<'a, 'b, T> IntoIterator for &'a LuvHue<&'b mut [T]>
impl<'a, 'b, T> IntoIterator for &'a LuvHue<&'b mut [T]>
source§impl<'a, T> IntoIterator for &'a LuvHue<Vec<T>>
impl<'a, T> IntoIterator for &'a LuvHue<Vec<T>>
source§impl<'a, 'b, T> IntoIterator for &'a mut LuvHue<&'b mut [T]>
impl<'a, 'b, T> IntoIterator for &'a mut LuvHue<&'b mut [T]>
source§type IntoIter = LuvHueIter<IterMut<'a, T>>
type IntoIter = LuvHueIter<IterMut<'a, T>>
source§impl<'a, T, const N: usize> IntoIterator for &'a mut LuvHue<[T; N]>
impl<'a, T, const N: usize> IntoIterator for &'a mut LuvHue<[T; N]>
source§type IntoIter = LuvHueIter<IterMut<'a, T>>
type IntoIter = LuvHueIter<IterMut<'a, T>>
source§impl<'a, T> IntoIterator for &'a mut LuvHue<Box<[T]>>
impl<'a, T> IntoIterator for &'a mut LuvHue<Box<[T]>>
source§type IntoIter = LuvHueIter<IterMut<'a, T>>
type IntoIter = LuvHueIter<IterMut<'a, T>>
source§impl<'a, T> IntoIterator for &'a mut LuvHue<Vec<T>>
impl<'a, T> IntoIterator for &'a mut LuvHue<Vec<T>>
source§type IntoIter = LuvHueIter<IterMut<'a, T>>
type IntoIter = LuvHueIter<IterMut<'a, T>>
source§impl<'a, T> IntoIterator for LuvHue<&'a [T]>
impl<'a, T> IntoIterator for LuvHue<&'a [T]>
source§impl<'a, T> IntoIterator for LuvHue<&'a mut [T]>
impl<'a, T> IntoIterator for LuvHue<&'a mut [T]>
source§impl<T> IntoIterator for LuvHue<Vec<T>>
impl<T> IntoIterator for LuvHue<Vec<T>>
source§impl<T> RelativeEq for LuvHue<T>where
T: Zero + AngleEq<Mask = bool> + Sub<Output = T> + RealAngle + Clone + RelativeEq + SignedAngle,
<T as AbsDiffEq>::Epsilon: HalfRotation + Mul<Output = <T as AbsDiffEq>::Epsilon>,
impl<T> RelativeEq for LuvHue<T>where
T: Zero + AngleEq<Mask = bool> + Sub<Output = T> + RealAngle + Clone + RelativeEq + SignedAngle,
<T as AbsDiffEq>::Epsilon: HalfRotation + Mul<Output = <T as AbsDiffEq>::Epsilon>,
source§fn default_max_relative() -> <LuvHue<T> as AbsDiffEq>::Epsilon
fn default_max_relative() -> <LuvHue<T> as AbsDiffEq>::Epsilon
source§impl<T> SaturatingAdd<T> for LuvHue<T>where
T: SaturatingAdd<Output = T>,
impl<T> SaturatingAdd<T> for LuvHue<T>where
T: SaturatingAdd<Output = T>,
source§impl<T> SaturatingAdd for LuvHue<T>where
T: SaturatingAdd<Output = T>,
impl<T> SaturatingAdd for LuvHue<T>where
T: SaturatingAdd<Output = T>,
source§impl<T> SaturatingSub<T> for LuvHue<T>where
T: SaturatingSub<Output = T>,
impl<T> SaturatingSub<T> for LuvHue<T>where
T: SaturatingSub<Output = T>,
source§impl<T> SaturatingSub for LuvHue<T>where
T: SaturatingSub<Output = T>,
impl<T> SaturatingSub for LuvHue<T>where
T: SaturatingSub<Output = T>,
source§impl<T> Serialize for LuvHue<T>where
T: Serialize,
impl<T> Serialize for LuvHue<T>where
T: Serialize,
source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
source§impl<T> SubAssign<T> for LuvHue<T>where
T: SubAssign,
impl<T> SubAssign<T> for LuvHue<T>where
T: SubAssign,
source§fn sub_assign(&mut self, other: T)
fn sub_assign(&mut self, other: T)
-=
operation. Read moresource§impl<T> SubAssign for LuvHue<T>where
T: SubAssign,
impl<T> SubAssign for LuvHue<T>where
T: SubAssign,
source§fn sub_assign(&mut self, other: LuvHue<T>)
fn sub_assign(&mut self, other: LuvHue<T>)
-=
operation. Read moresource§impl<T> UlpsEq for LuvHue<T>
impl<T> UlpsEq for LuvHue<T>
source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
impl<T> Copy for LuvHue<T>where
T: Copy,
impl<T> Eq for LuvHue<T>
Auto Trait Implementations§
impl<T> Freeze for LuvHue<T>where
T: Freeze,
impl<T> RefUnwindSafe for LuvHue<T>where
T: RefUnwindSafe,
impl<T> Send for LuvHue<T>where
T: Send,
impl<T> Sync for LuvHue<T>where
T: Sync,
impl<T> Unpin for LuvHue<T>where
T: Unpin,
impl<T> UnwindSafe for LuvHue<T>where
T: UnwindSafe,
Blanket Implementations§
source§impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
impl<S, D, Swp, Dwp, T> AdaptInto<D, Swp, Dwp, T> for Swhere
T: Real + Zero + Arithmetics + Clone,
Swp: WhitePoint<T>,
Dwp: WhitePoint<T>,
D: AdaptFrom<S, Swp, Dwp, T>,
source§fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
fn adapt_into_using<M>(self, method: M) -> Dwhere
M: TransformMatrix<T>,
source§fn adapt_into(self) -> D
fn adapt_into(self) -> D
source§impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
impl<T, Res> Apply<Res> for Twhere
T: ?Sized,
source§impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
impl<T, C> ArraysFrom<C> for Twhere
C: IntoArrays<T>,
source§fn arrays_from(colors: C) -> T
fn arrays_from(colors: C) -> T
source§impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
impl<T, C> ArraysInto<C> for Twhere
C: FromArrays<T>,
source§fn arrays_into(self) -> C
fn arrays_into(self) -> C
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<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
impl<WpParam, T, U> Cam16IntoUnclamped<WpParam, T> for Uwhere
T: FromCam16Unclamped<WpParam, U>,
source§type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
type Scalar = <T as FromCam16Unclamped<WpParam, U>>::Scalar
parameters
when converting.source§fn cam16_into_unclamped(
self,
parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>,
) -> T
fn cam16_into_unclamped( self, parameters: BakedParameters<WpParam, <U as Cam16IntoUnclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
impl<T, C> ComponentsFrom<C> for Twhere
C: IntoComponents<T>,
source§fn components_from(colors: C) -> T
fn components_from(colors: C) -> T
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<T> FromAngle<T> for T
impl<T> FromAngle<T> for T
source§fn from_angle(angle: T) -> T
fn from_angle(angle: T) -> T
angle
.source§impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
impl<T, U> FromStimulus<U> for Twhere
U: IntoStimulus<T>,
source§fn from_stimulus(other: U) -> T
fn from_stimulus(other: U) -> T
other
into Self
, while performing the appropriate scaling,
rounding and clamping.source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
source§impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
impl<T, U> IntoAngle<U> for Twhere
U: FromAngle<T>,
source§fn into_angle(self) -> U
fn into_angle(self) -> U
T
.source§impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
impl<WpParam, T, U> IntoCam16Unclamped<WpParam, T> for Uwhere
T: Cam16FromUnclamped<WpParam, U>,
source§type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
type Scalar = <T as Cam16FromUnclamped<WpParam, U>>::Scalar
parameters
when converting.source§fn into_cam16_unclamped(
self,
parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>,
) -> T
fn into_cam16_unclamped( self, parameters: BakedParameters<WpParam, <U as IntoCam16Unclamped<WpParam, T>>::Scalar>, ) -> T
self
into C
, using the provided parameters.source§impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
impl<T, U> IntoColor<U> for Twhere
U: FromColor<T>,
source§fn into_color(self) -> U
fn into_color(self) -> U
source§impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
impl<T, U> IntoColorUnclamped<U> for Twhere
U: FromColorUnclamped<T>,
source§fn into_color_unclamped(self) -> U
fn into_color_unclamped(self) -> U
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> IntoStimulus<T> for T
impl<T> IntoStimulus<T> for T
source§fn into_stimulus(self) -> T
fn into_stimulus(self) -> T
self
into T
, while performing the appropriate scaling,
rounding and clamping.source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.source§impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
impl<T, C> TryComponentsInto<C> for Twhere
C: TryFromComponents<T>,
source§type Error = <C as TryFromComponents<T>>::Error
type Error = <C as TryFromComponents<T>>::Error
try_into_colors
fails to cast.source§fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
fn try_components_into(self) -> Result<C, <T as TryComponentsInto<C>>::Error>
source§impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
impl<T, U> TryIntoColor<U> for Twhere
U: TryFromColor<T>,
source§fn try_into_color(self) -> Result<U, OutOfBounds<U>>
fn try_into_color(self) -> Result<U, OutOfBounds<U>>
OutOfBounds
error is returned which contains
the unclamped color. Read more