Struct palette::Hsv
[−]
[src]
pub struct Hsv<T: Float = f32> { pub hue: RgbHue<T>, pub saturation: T, pub value: T, }
Linear HSV color space.
HSV is a cylindrical version of RGB and it's very
similar to HSL. The difference is that the value
component in HSV determines the brightness of the color, and not the
lightness. The difference is that, for example, red (100% R, 0% G, 0% B)
and white (100% R, 100% G, 100% B) has the same brightness (or value), but
not the same lightness.
Fields
hue: RgbHue<T>
The hue of the color, in degrees. Decides if it's red, blue, purple, etc.
saturation: T
The colorfulness of the color. 0.0 gives gray scale colors and 1.0 will give absolutely clear colors.
value: T
Decides how bright the color will look. 0.0 will be black, and 1.0 will
give a bright an clear color that goes towards white when saturation
goes towards 0.0.
Methods
impl<T: Float> Hsv<T>
[src]
Trait Implementations
impl<T: PartialEq + Float> PartialEq for Hsv<T>
[src]
fn eq(&self, __arg_0: &Hsv<T>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Hsv<T>) -> bool
This method tests for !=
.
impl<T: Debug + Float> Debug for Hsv<T>
[src]
impl<T: Copy + Float> Copy for Hsv<T>
[src]
impl<T: Clone + Float> Clone for Hsv<T>
[src]
fn clone(&self) -> Hsv<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> Limited for Hsv<T>
[src]
fn is_valid(&self) -> bool
Check if the color's components are within the expected ranges.
fn clamp(&self) -> Hsv<T>
Return a new color where the components has been clamped to the nearest valid values. Read more
fn clamp_self(&mut self)
Clamp the color's components to the nearest valid values.
impl<T: Float> Mix for Hsv<T>
[src]
type Scalar = T
The type of the mixing factor.
fn mix(&self, other: &Hsv<T>, factor: T) -> Hsv<T>
Mix the color with an other color, by factor
. Read more
impl<T: Float> Shade for Hsv<T>
[src]
type Scalar = T
The type of the lighten/darken amount.
fn lighten(&self, amount: T) -> Hsv<T>
Lighten the color by amount
.
fn darken(&self, amount: Self::Scalar) -> Self
Darken the color by amount
.
impl<T: Float> GetHue for Hsv<T>
[src]
type Hue = RgbHue<T>
The kind of hue unit this color space uses. Read more
fn get_hue(&self) -> Option<RgbHue<T>>
Calculate a hue if possible. Read more
impl<T: Float> Hue for Hsv<T>
[src]
fn with_hue(&self, hue: RgbHue<T>) -> Hsv<T>
Return a new copy of self
, but with a specific hue.
fn shift_hue(&self, amount: RgbHue<T>) -> Hsv<T>
Return a new copy of self
, but with the hue shifted by amount
.
impl<T: Float> Saturate for Hsv<T>
[src]
type Scalar = T
The type of the (de)saturation factor.
fn saturate(&self, factor: T) -> Hsv<T>
Increase the saturation by factor
.
fn desaturate(&self, factor: Self::Scalar) -> Self
Decrease the saturation by factor
.
impl<T: Float> Default for Hsv<T>
[src]
impl<T: Float> Add<Hsv<T>> for Hsv<T>
[src]
type Output = Hsv<T>
The resulting type after applying the +
operator
fn add(self, other: Hsv<T>) -> Hsv<T>
The method for the +
operator
impl<T: Float> Add<T> for Hsv<T>
[src]
type Output = Hsv<T>
The resulting type after applying the +
operator
fn add(self, c: T) -> Hsv<T>
The method for the +
operator
impl<T: Float> Sub<Hsv<T>> for Hsv<T>
[src]
type Output = Hsv<T>
The resulting type after applying the -
operator
fn sub(self, other: Hsv<T>) -> Hsv<T>
The method for the -
operator
impl<T: Float> Sub<T> for Hsv<T>
[src]
type Output = Hsv<T>
The resulting type after applying the -
operator
fn sub(self, c: T) -> Hsv<T>
The method for the -
operator