diff options
Diffstat (limited to 'vgcodec/src/main.rs')
-rw-r--r-- | vgcodec/src/main.rs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/vgcodec/src/main.rs b/vgcodec/src/main.rs index 7fb0750..2be0793 100644 --- a/vgcodec/src/main.rs +++ b/vgcodec/src/main.rs @@ -7,8 +7,9 @@ pub mod paint; use app::App; use approximate::Approximator; +use clap::Parser; use helper::write_texture; -use image::EncodableLayout; +use log::info; use wgpu::TextureUsages; fn main() { @@ -16,12 +17,21 @@ fn main() { pollster::block_on(run()); } +#[derive(Parser)] +#[clap(about)] +struct Args { + #[clap(short = 'I', long)] + iterations: usize, + infile: String, +} + async fn run() { + let args = Args::parse(); let app = app::App::new().await; let App { device, queue, .. } = app.as_ref(); - let img_target = image::open("a/a.png").unwrap().into_rgba8(); + let img_target = image::open(&args.infile).unwrap().into_rgba8(); let size = wgpu::Extent3d { width: img_target.width(), @@ -39,8 +49,10 @@ async fn run() { label: None, }); - write_texture(queue, &tex_target, img_target.as_bytes(), size); + let img_raw = img_target.into_raw(); + info!("{}", img_raw.len()); + write_texture(queue, &tex_target, &img_raw, size); let mut a = Approximator::new(&app, tex_target, size); - a.run().await; + a.run(args.iterations).await; } |