#[repr(C)]pub struct RgbHue<T: Float = f32>(/* private fields */);
Expand description
A hue type for the RGB family of color spaces.
It’s measured in degrees and uses the three additive primaries red, green and blue.
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> RgbHue<T>
impl<T: Float> RgbHue<T>
sourcepub fn from_degrees(degrees: T) -> RgbHue<T>
pub fn from_degrees(degrees: T) -> RgbHue<T>
Create a new hue from degrees.
sourcepub fn from_radians(radians: T) -> RgbHue<T>
pub fn from_radians(radians: T) -> RgbHue<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 RgbHue<T>
impl<T: Float + AbsDiffEq> AbsDiffEq for RgbHue<T>
source§fn default_epsilon() -> Self::Epsilon
fn default_epsilon() -> Self::Epsilon
source§impl<T: Float + AddAssign> AddAssign<T> for RgbHue<T>
impl<T: Float + AddAssign> AddAssign<T> for RgbHue<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 RgbHue<T>
impl<T: Float + AddAssign> AddAssign for RgbHue<T>
source§fn add_assign(&mut self, other: RgbHue<T>)
fn add_assign(&mut self, other: RgbHue<T>)
+=
operation. Read moresource§impl<'de, T> Deserialize<'de> for RgbHue<T>where
T: Deserialize<'de> + Float,
impl<'de, T> Deserialize<'de> for RgbHue<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 RgbHue<T>
impl<T: Float> PartialEq for RgbHue<T>
source§impl<T: Float + RelativeEq> RelativeEq for RgbHue<T>
impl<T: Float + RelativeEq> RelativeEq for RgbHue<T>
source§fn default_max_relative() -> Self::Epsilon
fn default_max_relative() -> Self::Epsilon
source§impl<T: Float + SubAssign> SubAssign<T> for RgbHue<T>
impl<T: Float + SubAssign> SubAssign<T> for RgbHue<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 RgbHue<T>
impl<T: Float + SubAssign> SubAssign for RgbHue<T>
source§fn sub_assign(&mut self, other: RgbHue<T>)
fn sub_assign(&mut self, other: RgbHue<T>)
-=
operation. Read moresource§impl<T: Float + UlpsEq> UlpsEq for RgbHue<T>
impl<T: Float + UlpsEq> UlpsEq for RgbHue<T>
impl<T: Copy + Float> Copy for RgbHue<T>
Auto Trait Implementations§
impl<T> RefUnwindSafe for RgbHue<T>where
T: RefUnwindSafe,
impl<T> Send for RgbHue<T>where
T: Send,
impl<T> Sync for RgbHue<T>where
T: Sync,
impl<T> Unpin for RgbHue<T>where
T: Unpin,
impl<T> UnwindSafe for RgbHue<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