diff options
author | iximeow <me@iximeow.net> | 2020-10-16 13:02:22 -0700 |
---|---|---|
committer | iximeow <me@iximeow.net> | 2020-10-16 13:02:22 -0700 |
commit | 1f014480b45b5a224aa61c4ee99c62905f032bf9 (patch) | |
tree | e6b1f0e8014ca674eb2c506eb1ca28f1bcb81613 /src/main.rs | |
parent | 6ba1324af6fcaf7e239605d04a93a616322d30df (diff) |
add more incremental changes
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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<u8> { + 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); |