Struct palette::RgbHue [−][src]
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.
Methods
impl<T: Float> RgbHue<T>
[src]
impl<T: Float> RgbHue<T>
pub fn from_degrees(degrees: T) -> RgbHue<T>
[src]
pub fn from_degrees(degrees: T) -> RgbHue<T>
Create a new hue from degrees.
pub fn from_radians(radians: T) -> RgbHue<T>
[src]
pub fn from_radians(radians: T) -> RgbHue<T>
Create a new hue from radians, instead of degrees.
pub fn to_degrees(self) -> T
[src]
pub fn to_degrees(self) -> T
Get the hue as degrees, in the range (-180, 180]
.
pub fn to_radians(self) -> T
[src]
pub fn to_radians(self) -> T
Convert the hue to radians, in the range (-π, π]
.
pub fn to_positive_degrees(self) -> T
[src]
pub fn to_positive_degrees(self) -> T
Convert the hue to positive degrees, in the range [0, 360)
.
pub fn to_positive_radians(self) -> T
[src]
pub fn to_positive_radians(self) -> T
Convert the hue to positive radians, in the range [0, 2π)
.
pub fn to_raw_degrees(self) -> T
[src]
pub fn to_raw_degrees(self) -> T
Get the internal representation, without normalizing it.
pub fn to_raw_radians(self) -> T
[src]
pub fn to_raw_radians(self) -> T
Get the internal representation as radians, without normalizing it.
Trait Implementations
impl<T: Clone + Float> Clone for RgbHue<T>
[src]
impl<T: Clone + Float> Clone for RgbHue<T>
fn clone(&self) -> RgbHue<T>
[src]
fn clone(&self) -> RgbHue<T>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<T: Copy + Float> Copy for RgbHue<T>
[src]
impl<T: Copy + Float> Copy for RgbHue<T>
impl<T: Debug + Float> Debug for RgbHue<T>
[src]
impl<T: Debug + Float> Debug for RgbHue<T>
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl<T: Default + Float> Default for RgbHue<T>
[src]
impl<T: Default + Float> Default for RgbHue<T>
impl<T: Float> From<T> for RgbHue<T>
[src]
impl<T: Float> From<T> for RgbHue<T>
impl Into<f64> for RgbHue<f64>
[src]
impl Into<f64> for RgbHue<f64>
impl Into<f32> for RgbHue<f32>
[src]
impl Into<f32> for RgbHue<f32>
impl Into<f32> for RgbHue<f64>
[src]
impl Into<f32> for RgbHue<f64>
impl<T: Float> PartialEq for RgbHue<T>
[src]
impl<T: Float> PartialEq for RgbHue<T>
fn eq(&self, other: &RgbHue<T>) -> bool
[src]
fn eq(&self, other: &RgbHue<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T: Float> PartialEq<T> for RgbHue<T>
[src]
impl<T: Float> PartialEq<T> for RgbHue<T>
fn eq(&self, other: &T) -> bool
[src]
fn eq(&self, other: &T) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
fn ne(&self, other: &Rhs) -> bool
This method tests for !=
.
impl<T: Float> Add<RgbHue<T>> for RgbHue<T>
[src]
impl<T: Float> Add<RgbHue<T>> for RgbHue<T>
type Output = RgbHue<T>
The resulting type after applying the +
operator.
fn add(self, other: RgbHue<T>) -> RgbHue<T>
[src]
fn add(self, other: RgbHue<T>) -> RgbHue<T>
Performs the +
operation.
impl<T: Float> Add<T> for RgbHue<T>
[src]
impl<T: Float> Add<T> for RgbHue<T>
type Output = RgbHue<T>
The resulting type after applying the +
operator.
fn add(self, other: T) -> RgbHue<T>
[src]
fn add(self, other: T) -> RgbHue<T>
Performs the +
operation.
impl Add<RgbHue<f32>> for f32
[src]
impl Add<RgbHue<f32>> for f32
type Output = RgbHue<f32>
The resulting type after applying the +
operator.
fn add(self, other: RgbHue<f32>) -> RgbHue<f32>
[src]
fn add(self, other: RgbHue<f32>) -> RgbHue<f32>
Performs the +
operation.
impl Add<RgbHue<f64>> for f64
[src]
impl Add<RgbHue<f64>> for f64
type Output = RgbHue<f64>
The resulting type after applying the +
operator.
fn add(self, other: RgbHue<f64>) -> RgbHue<f64>
[src]
fn add(self, other: RgbHue<f64>) -> RgbHue<f64>
Performs the +
operation.
impl<T: Float> Sub<RgbHue<T>> for RgbHue<T>
[src]
impl<T: Float> Sub<RgbHue<T>> for RgbHue<T>
type Output = RgbHue<T>
The resulting type after applying the -
operator.
fn sub(self, other: RgbHue<T>) -> RgbHue<T>
[src]
fn sub(self, other: RgbHue<T>) -> RgbHue<T>
Performs the -
operation.
impl<T: Float> Sub<T> for RgbHue<T>
[src]
impl<T: Float> Sub<T> for RgbHue<T>
type Output = RgbHue<T>
The resulting type after applying the -
operator.
fn sub(self, other: T) -> RgbHue<T>
[src]
fn sub(self, other: T) -> RgbHue<T>
Performs the -
operation.
impl Sub<RgbHue<f32>> for f32
[src]
impl Sub<RgbHue<f32>> for f32
type Output = RgbHue<f32>
The resulting type after applying the -
operator.
fn sub(self, other: RgbHue<f32>) -> RgbHue<f32>
[src]
fn sub(self, other: RgbHue<f32>) -> RgbHue<f32>
Performs the -
operation.
impl Sub<RgbHue<f64>> for f64
[src]
impl Sub<RgbHue<f64>> for f64
type Output = RgbHue<f64>
The resulting type after applying the -
operator.
fn sub(self, other: RgbHue<f64>) -> RgbHue<f64>
[src]
fn sub(self, other: RgbHue<f64>) -> RgbHue<f64>
Performs the -
operation.
impl<T: Float + ApproxEq> ApproxEq for RgbHue<T> where
<T as ApproxEq>::Epsilon: Float,
[src]
impl<T: Float + ApproxEq> ApproxEq for RgbHue<T> where
<T as ApproxEq>::Epsilon: Float,
type Epsilon = <T as ApproxEq>::Epsilon
Used for specifying relative comparisons.
fn default_epsilon() -> Self::Epsilon
[src]
fn default_epsilon() -> Self::Epsilon
The default tolerance to use when testing values that are close together. Read more
fn default_max_relative() -> Self::Epsilon
[src]
fn default_max_relative() -> Self::Epsilon
The default relative tolerance for testing values that are far-apart. Read more
fn default_max_ulps() -> u32
[src]
fn default_max_ulps() -> u32
The default ULPs to tolerate when testing values that are far-apart. Read more
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
fn relative_eq(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
A test for equality that uses a relative comparison if the values are far apart.
fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
[src]
fn ulps_eq(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
A test for equality that uses units in the last place (ULP) if the values are far apart.
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
[src]
fn relative_ne(
&self,
other: &Self,
epsilon: Self::Epsilon,
max_relative: Self::Epsilon
) -> bool
The inverse of ApproxEq::relative_eq
.
fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
[src]
fn ulps_ne(&self, other: &Self, epsilon: Self::Epsilon, max_ulps: u32) -> bool
The inverse of ApproxEq::ulps_eq
.