pub mod display; pub mod imageproc; use crate::display::DisplayWrapper; use crate::imageproc::{Ditherer, EInkBuffer, NNDither}; use clap::{Parser, Subcommand}; use image::RgbImage; /// Display images over #[derive(Debug, Parser)] #[command(version, about)] struct Cli { #[command(subcommand)] command: Command, } #[derive(Debug, Subcommand)] enum Command { /// Load a single image Show, /// Start the HTTP sever Serve, } fn main() -> anyhow::Result<()> { let cli = Cli::parse(); println!("CLI {cli:?}"); if let Command::Show = cli.command { let img: RgbImage = image::io::Reader::open("myimage.png")?.decode()?.into(); let mut display = DisplayWrapper::new()?; let mut eink_buf = EInkBuffer::new(800, 480); let dither = NNDither {}; dither.dither(&img, &mut eink_buf); let raw_buf = eink_buf.into_display_buffer(); display.display(&raw_buf)?; } Ok(()) }