properties: rewrite properties (whoops)
This commit is contained in:
@ -2,8 +2,6 @@ pub mod interpolate;
|
||||
pub mod noise;
|
||||
pub mod trig;
|
||||
|
||||
use palette::encoding::srgb::Srgb;
|
||||
|
||||
use rgb::Rgb;
|
||||
|
||||
use crate::lib8::interpolate::scale8;
|
||||
@ -18,7 +16,23 @@ impl IntoRgb8 for Rgb<u8> {
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoRgb8 for palette::Hsv<Srgb, u8> {
|
||||
pub struct Hsv {
|
||||
pub hue: u8,
|
||||
pub saturation: u8,
|
||||
pub value: u8
|
||||
}
|
||||
|
||||
impl Hsv {
|
||||
pub fn new(hue: u8, saturation: u8, value: u8) -> Self {
|
||||
Hsv {
|
||||
hue,
|
||||
saturation,
|
||||
value
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl IntoRgb8 for Hsv {
|
||||
//TODO: Borrowed from FastLED
|
||||
fn into_rgb8(self) -> Rgb<u8> {
|
||||
const HSV_SECTION_3: u8 = 0x40;
|
||||
@ -27,7 +41,7 @@ impl IntoRgb8 for palette::Hsv<Srgb, u8> {
|
||||
return Rgb::new(self.value, self.value, self.value)
|
||||
}
|
||||
|
||||
let mock_hue = scale8(191, self.hue.into_inner());
|
||||
let mock_hue = scale8(191, self.hue);
|
||||
let value: u8 = self.value;
|
||||
let saturation: u8 = self.saturation;
|
||||
let invsat: u8 = 255 - saturation;
|
||||
@ -52,4 +66,4 @@ impl IntoRgb8 for palette::Hsv<Srgb, u8> {
|
||||
_ => Rgb::new(rampup_adj_with_floor, brightness_floor, rampdown_adj_with_floor)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user