use super::*;
use super::utils::*;
#[derive(Clone)]
#[derive(Copy)]
pub struct HSV {
pub hue: f32,
pub saturation: f32,
pub value: f32
}
impl Color for HSV {
fn to_rgb(&self) -> RGB {
let c = self.value * self.saturation;
let m = self.value - c;
rgb_from_hcm(self.hue, c, m)
}
fn to_hsv(&self) -> HSV { *self }
fn to_hsl(&self) -> HSL { HSL { hue: self.hue, saturation: get_hsl_saturation(self.to_rgb()), lightness: get_lightness(self.to_rgb()) } }
fn get_hue(&self) -> f32 where Self: Sized { self.hue }
fn get_hsv_saturation(&self) -> f32 where Self: Sized { self.saturation }
fn get_value(&self) -> f32 where Self: Sized { self.value }
}
impl Pixel for HSV {}
impl FromPixel for HSV {}
impl FromColor for HSV {
fn from<C: Color>(color: &C) -> HSV { color.to_hsv() }
}