From 8b7792d6aa27578221fee7cc8be1ceb202602a5a Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 7 Dec 2022 23:08:11 +0100 Subject: implement broken value scale --- evc/src/helpers/pixel.rs | 3 +++ 1 file changed, 3 insertions(+) (limited to 'evc/src/helpers') diff --git a/evc/src/helpers/pixel.rs b/evc/src/helpers/pixel.rs index f7d6621..964040d 100644 --- a/evc/src/helpers/pixel.rs +++ b/evc/src/helpers/pixel.rs @@ -29,6 +29,7 @@ impl Pixel { ); SQRT[rd + gd + bd] } + #[inline] pub fn average(a: Pixel, b: Pixel) -> Pixel { //? this functions is broken @@ -39,6 +40,8 @@ impl Pixel { b: (a.b >> 1) + (b.b >> 1), } } + + #[inline] pub fn scale(&self, factor: f32) -> Pixel { Pixel { r: ((self.r as f32) * factor).clamp(0.0, 255.0) as u8, -- cgit v1.2.3-70-g09d2