Struct nannou_core::color::RgbHue
source · #[repr(C)]pub struct RgbHue<T = f32>(/* private fields */)
where
T: Float;
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> RgbHue<T>where
T: Float,
impl<T> RgbHue<T>where
T: Float,
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> AbsDiffEq for RgbHue<T>
impl<T> AbsDiffEq for RgbHue<T>
source§fn default_epsilon() -> <RgbHue<T> as AbsDiffEq>::Epsilon
fn default_epsilon() -> <RgbHue<T> as AbsDiffEq>::Epsilon
source§fn abs_diff_eq(
&self,
other: &RgbHue<T>,
epsilon: <T as AbsDiffEq>::Epsilon
) -> bool
fn abs_diff_eq( &self, other: &RgbHue<T>, epsilon: <T as AbsDiffEq>::Epsilon ) -> bool
source§fn abs_diff_ne(
&self,
other: &RgbHue<T>,
epsilon: <T as AbsDiffEq>::Epsilon
) -> bool
fn abs_diff_ne( &self, other: &RgbHue<T>, epsilon: <T as AbsDiffEq>::Epsilon ) -> bool
ApproxEq::abs_diff_eq
.source§impl<T> AddAssign<T> for RgbHue<T>
impl<T> 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> AddAssign for RgbHue<T>
impl<T> 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: Float + Deserialize<'de>,
impl<'de, T> Deserialize<'de> for RgbHue<T>where
T: Float + Deserialize<'de>,
source§fn deserialize<__D>(
__deserializer: __D
) -> Result<RgbHue<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<RgbHue<T>, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
source§impl<T> PartialEq for RgbHue<T>where
T: Float,
impl<T> PartialEq for RgbHue<T>where
T: Float,
source§impl<T> RelativeEq for RgbHue<T>
impl<T> RelativeEq for RgbHue<T>
source§fn default_max_relative() -> <RgbHue<T> as AbsDiffEq>::Epsilon
fn default_max_relative() -> <RgbHue<T> as AbsDiffEq>::Epsilon
source§fn relative_eq(
&self,
other: &RgbHue<T>,
epsilon: <T as AbsDiffEq>::Epsilon,
max_relative: <T as AbsDiffEq>::Epsilon
) -> bool
fn relative_eq( &self, other: &RgbHue<T>, epsilon: <T as AbsDiffEq>::Epsilon, max_relative: <T as AbsDiffEq>::Epsilon ) -> bool
source§impl<T> Serialize for RgbHue<T>
impl<T> Serialize for RgbHue<T>
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 RgbHue<T>
impl<T> 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> SubAssign for RgbHue<T>
impl<T> 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> UlpsEq for RgbHue<T>
impl<T> UlpsEq for RgbHue<T>
source§fn default_max_ulps() -> u32
fn default_max_ulps() -> u32
impl<T> 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