pub const IMG_WIDTH: usize = 256; pub const IMG_HEIGHT: usize = 256; #[derive(Debug, Copy, Clone)] pub struct Pixel { pub r: u8, pub g: u8, pub b: u8, } impl Pixel { pub fn from_frac(r: f32, g: f32, b: f32) -> Self { Self { r: (255.999 * r) as u8, g: (255.999 * g) as u8, b: (255.999 * b) as u8, } } } impl Default for Pixel { fn default() -> Self { Pixel { r:0, g:0, b:0 } } } pub type DisplayBuffer = [[Pixel; IMG_WIDTH]; IMG_HEIGHT];