Struct palette::RgbHue [] [src]

pub struct RgbHue<T: Float = f32>(_);

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]

fn from_radians(radians: T) -> RgbHue<T>

Create a new hue from radians, instead of degrees.

fn to_degrees(self) -> T

Get the hue as degrees, in the range (-180, 180].

fn to_radians(self) -> T

Convert the hue to radians, in the range (-π, π].

fn to_positive_degrees(self) -> T

Convert the hue to positive degrees, in the range [0, 360).

fn to_positive_radians(self) -> T

Convert the hue to positive radians, in the range [0, 2π).

Trait Implementations

impl<T: Default + Float> Default for RgbHue<T>
[src]

fn default() -> RgbHue<T>

Returns the "default value" for a type. Read more

impl<T: Debug + Float> Debug for RgbHue<T>
[src]

fn fmt(&self, __arg_0: &mut Formatter) -> Result

Formats the value using the given formatter.

impl<T: Copy + Float> Copy for RgbHue<T>
[src]

impl<T: Clone + Float> Clone for 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

Performs copy-assignment from source. Read more

impl<T: Float> From<T> for RgbHue<T>
[src]

fn from(degrees: T) -> RgbHue<T>

Performs the conversion.

impl Into<f64> for RgbHue<f64>
[src]

fn into(self) -> f64

Performs the conversion.

impl Into<f32> for RgbHue<f32>
[src]

fn into(self) -> f32

Performs the conversion.

impl Into<f32> for RgbHue<f64>
[src]

fn into(self) -> f32

Performs the conversion.

impl<T: Float> PartialEq for RgbHue<T>
[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

This method tests for !=.

impl<T: Float> PartialEq<T> for RgbHue<T>
[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

This method tests for !=.

impl<T: Float> Add<RgbHue<T>> for RgbHue<T>
[src]

type Output = RgbHue<T>

The resulting type after applying the + operator

fn add(self, other: RgbHue<T>) -> RgbHue<T>

The method for the + operator

impl<T: Float> Add<T> for RgbHue<T>
[src]

type Output = RgbHue<T>

The resulting type after applying the + operator

fn add(self, other: T) -> RgbHue<T>

The method for the + operator

impl<T: Float> Sub<RgbHue<T>> for RgbHue<T>
[src]

type Output = RgbHue<T>

The resulting type after applying the - operator

fn sub(self, other: RgbHue<T>) -> RgbHue<T>

The method for the - operator

impl<T: Float> Sub<T> for RgbHue<T>
[src]

type Output = RgbHue<T>

The resulting type after applying the - operator

fn sub(self, other: T) -> RgbHue<T>

The method for the - operator