lib8: implement scale8 from fastled
This commit is contained in:
parent
386b454fb7
commit
61b28179d1
@ -2,6 +2,11 @@ use palette::encoding::srgb::Srgb;
|
|||||||
|
|
||||||
use rgb::RGB8;
|
use rgb::RGB8;
|
||||||
|
|
||||||
|
pub fn scale8(i: u8, scale: u8) -> u8 {
|
||||||
|
// borrowed from FastLED
|
||||||
|
(i as u16 * scale as u16).wrapping_shr(8) as u8
|
||||||
|
}
|
||||||
|
|
||||||
pub trait Rgb8Blend {
|
pub trait Rgb8Blend {
|
||||||
fn saturating_add(self, b: Self) -> Self;
|
fn saturating_add(self, b: Self) -> Self;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user