Struct palette::Hsv
[−]
[src]
pub struct Hsv { pub hue: RgbHue, pub saturation: f32, pub value: f32, pub alpha: f32, }
Linear HSV color space with an alpha component.
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
The hue of the color, in degrees. Decides if it's red, blue, purple, etc.
saturation: f32
The colorfulness of the color. 0.0 gives gray scale colors and 1.0 will give absolutely clear colors.
value: f32
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.
alpha: f32
The transparency of the color. 0.0 is completely transparent and 1.0 is completely opaque.
Methods
impl Hsv
[src]
fn hsv(hue: RgbHue, saturation: f32, value: f32) -> Hsv
Linear HSV.
fn hsva(hue: RgbHue, saturation: f32, value: f32, alpha: f32) -> Hsv
Linear HSV and transparency.
Trait Implementations
impl PartialEq for Hsv
[src]
fn eq(&self, __arg_0: &Hsv) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Hsv) -> bool
This method tests for !=
.
impl Debug for Hsv
[src]
impl Copy for Hsv
[src]
impl Clone for Hsv
[src]
fn clone(&self) -> Hsv
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 ColorSpace for Hsv
[src]
fn is_valid(&self) -> bool
Check if the color's components are within the expected ranges.
fn clamp(&self) -> Hsv
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 Mix for Hsv
[src]
fn mix(&self, other: &Hsv, factor: f32) -> Hsv
Mix the color with an other color, by factor
. Read more
impl Shade for Hsv
[src]
fn lighten(&self, amount: f32) -> Hsv
Lighten the color by amount
.
fn darken(&self, amount: f32) -> Self
Darken the color by amount
.
impl GetHue for Hsv
[src]
type Hue = RgbHue
The kind of hue unit this color space uses. Read more
fn get_hue(&self) -> Option<RgbHue>
Calculate a hue if possible. Read more
impl Hue for Hsv
[src]
fn with_hue(&self, hue: RgbHue) -> Hsv
Return a new copy of self
, but with a specific hue.
fn shift_hue(&self, amount: RgbHue) -> Hsv
Return a new copy of self
, but with the hue shifted by amount
.
impl Saturate for Hsv
[src]
fn saturate(&self, factor: f32) -> Hsv
Increase the saturation by factor
.
fn desaturate(&self, factor: f32) -> Self
Decrease the saturation by factor
.