diff options
author | Rosyid Haryadi <rosyid_haryadi@protonmail.com> | 2025-02-26 14:44:11 +0700 |
---|---|---|
committer | Rosyid Haryadi <rosyid_haryadi@protonmail.com> | 2025-02-26 14:44:11 +0700 |
commit | 7b0375eee4a945cc8fbb3c03cfc0657e0f1ee443 (patch) | |
tree | 6dd01fb883b806ef540a40b1c8ae26a0b81f967f /src/main.rs | |
parent | 20be72c501397a45e3c8f4bc95a3451f103e3a28 (diff) |
upd: mapping 0-1 to byte
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/src/main.rs b/src/main.rs index 2c81847..abad7ff 100644 --- a/src/main.rs +++ b/src/main.rs @@ -24,11 +24,7 @@ fn test_render(data: &mut DisplayBuffer) { let g = j as f32 / IMG_HEIGHT as f32; let b = 0.0f32; - let ir = (255.999 * r) as u8; - let ig = (255.999 * g) as u8; - let ib = (255.999 * b) as u8; - - data[i][j] = Pixel { r: ir, g: ig, b: ib}; + data[i][j] = Pixel::from_frac(r, g, b); }) }); } |