From 7020006e896a97029006ec7bdf6ca7d0894a7881 Mon Sep 17 00:00:00 2001 From: Xiretza Date: Fri, 17 Jun 2022 21:06:04 +0200 Subject: [PATCH] feat: add image display mode --- src/main.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/main.rs b/src/main.rs index 102c80c..452c281 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,6 +5,7 @@ use std::{ io::stdout, net::{Ipv4Addr, SocketAddr, UdpSocket}, num::ParseIntError, + path::PathBuf, str::FromStr, thread::sleep, time::Duration, @@ -81,6 +82,7 @@ impl From for Rgb { enum Action { Rainbow, Solid { color: Color }, + Image { path: PathBuf }, Clear, } @@ -190,6 +192,11 @@ fn main() -> anyhow::Result<()> { let frame_num: u32 = rand::thread_rng().gen(); send_frame(&socket, layout, frame_num, &image)?; } + Action::Image { path } => { + let image = RgbImage::new(layout.width_px(), layout.height_px()); + let frame_num: u32 = rand::thread_rng().gen(); + send_frame(&socket, layout, frame_num, &image)?; + } Action::Rainbow => { print!("{}", termion::clear::All);