diff --git a/bin/src/daemon.rs b/bin/src/daemon.rs index e27c396..7eda325 100644 --- a/bin/src/daemon.rs +++ b/bin/src/daemon.rs @@ -146,7 +146,9 @@ async fn update_ui(task_tracker: &TaskTracker, config: &config::Config, mut ui_ Err(e) => panic!("error receiving shutdown message: {e}") } - if img_name.ends_with(".gif"){ + if img_name == "subtle.png" { + fb.draw_line(framebuffer::Color565::Green, 2); + } else if img_name.ends_with(".gif"){ fb.draw_gif(img.contents()); } else { fb.draw_img(img.contents()); diff --git a/bin/src/framebuffer.rs b/bin/src/framebuffer.rs index e1c77e1..a79383b 100644 --- a/bin/src/framebuffer.rs +++ b/bin/src/framebuffer.rs @@ -11,6 +11,17 @@ struct Dimensions { width: u32, } +#[allow(dead_code)] +pub enum Color565 { + Red = 0b1111100000000000, + Green = 0b0000011111100000, + Blue = 0b0000000000011111, + White = 0b1111111111111111, + Black = 0b0000000000000000, + Cyan = 0b0000011111111111, + Yellow = 0b1111111111100000, +} + #[derive(Copy, Clone)] pub struct Framebuffer<'a> { dimensions: Dimensions, @@ -70,4 +81,14 @@ impl Framebuffer<'_>{ let img = image::load_from_memory(img_buffer).unwrap(); self.write(img); } + + pub fn draw_line(&mut self, color: Color565, height: u32){ + let px_num= height * self.dimensions.width; + let color: u16 = color as u16; + let mut buffer: Vec = Vec::new(); + for _ in 0..px_num { + buffer.extend(color.to_le_bytes()); + } + std::fs::write(self.path, &buffer).unwrap(); + } } \ No newline at end of file