tweaking the color

This commit is contained in:
devdesk 2024-02-20 21:02:14 +02:00
parent a512e710fa
commit 005292adfc

View File

@ -119,13 +119,15 @@ fn main() -> anyhow::Result<()> {
} else { } else {
pixel = pixel_to_celcius(pixel); pixel = pixel_to_celcius(pixel);
let cutoff = args.red_cutoff.unwrap(); let cutoff = args.red_cutoff.unwrap();
let r = if pixel > (256.0 * cutoff) as u16 { let (r, g, b) = if pixel > (256.0 * cutoff) as u16 {
255 let p = pixel - (256.0 * cutoff) as u16;
let p = (p / 256).max(127);
((128 + p) as u8, 0, 0)
} else { } else {
0
};
let g = frame[i * 2]; let g = frame[i * 2];
let b = frame[i * 2 + 1]; let b = frame[i * 2 + 1];
(0, g, b)
};
let out_i = ((HEIGHT - 1 - y) + (WIDTH - 1 - x) * HEIGHT) * 4; let out_i = ((HEIGHT - 1 - y) + (WIDTH - 1 - x) * HEIGHT) * 4;
swapped[out_i..out_i + 4].copy_from_slice(&[0, r, g, b]); swapped[out_i..out_i + 4].copy_from_slice(&[0, r, g, b]);
} }