From 1f014480b45b5a224aa61c4ee99c62905f032bf9 Mon Sep 17 00:00:00 2001 From: iximeow Date: Fri, 16 Oct 2020 13:02:22 -0700 Subject: add more incremental changes --- src/main.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 7edf300..c892d97 100644 --- a/src/main.rs +++ b/src/main.rs @@ -113,6 +113,18 @@ fn main() { } return result; } + // make a 16bpp image into an 8bpp image + fn monoize(data: &[u8], width: u32, height: u32) -> Vec { + let mut result = vec![0; (width * height) as usize]; + for h in 0..height { + for w in 0..width { + result[(h * width + w) as usize] = data[(h * width + w) as usize * 2]; + } + } + return result; + } + // for 16bpp aka qhy600m +// let monoed = monoize(data.as_slice(), dimensions.width, dimensions.height); let scale_factor = 2; if scale_factor != 1 { let downscaled = downscale(data.as_slice(), dimensions.width, dimensions.height, scale_factor); -- cgit v1.1