feat: add image display mode
This commit is contained in:
parent
8ab9cd7010
commit
7020006e89
1 changed files with 7 additions and 0 deletions
|
@ -5,6 +5,7 @@ use std::{
|
||||||
io::stdout,
|
io::stdout,
|
||||||
net::{Ipv4Addr, SocketAddr, UdpSocket},
|
net::{Ipv4Addr, SocketAddr, UdpSocket},
|
||||||
num::ParseIntError,
|
num::ParseIntError,
|
||||||
|
path::PathBuf,
|
||||||
str::FromStr,
|
str::FromStr,
|
||||||
thread::sleep,
|
thread::sleep,
|
||||||
time::Duration,
|
time::Duration,
|
||||||
|
@ -81,6 +82,7 @@ impl From<Color> for Rgb<u8> {
|
||||||
enum Action {
|
enum Action {
|
||||||
Rainbow,
|
Rainbow,
|
||||||
Solid { color: Color },
|
Solid { color: Color },
|
||||||
|
Image { path: PathBuf },
|
||||||
Clear,
|
Clear,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,6 +192,11 @@ fn main() -> anyhow::Result<()> {
|
||||||
let frame_num: u32 = rand::thread_rng().gen();
|
let frame_num: u32 = rand::thread_rng().gen();
|
||||||
send_frame(&socket, layout, frame_num, &image)?;
|
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 => {
|
Action::Rainbow => {
|
||||||
print!("{}", termion::clear::All);
|
print!("{}", termion::clear::All);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue