From e9fb349352eb13cdd7f7edeb1b4363e3956337c0 Mon Sep 17 00:00:00 2001 From: electria Date: Tue, 30 Jun 2026 22:53:14 -0700 Subject: [PATCH] feat: "o" to open image --- src/main.rs | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/main.rs b/src/main.rs index 604f98b..2866ca7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -88,6 +88,29 @@ impl State { return self.allocate_image(); } + Key::Character("o") => { + let Some(path) = FileDialog::new() + .add_filter( + "image", + &[ + "png", "PNG", "jpg", "JPG", "jpeg", "JPEG", "avif", "bmp", "exr", + "ff", "gif", "hdr", "ico", "pnm", "qoi", "tga", "tiff", "webp", + ], + ) + .pick_file() + else { + eprintln!("no path to open provided"); + return Task::none(); + }; + + self.image = ImageReader::open(path) + .unwrap() + .decode() + .unwrap() + .into_rgba8(); + + return self.allocate_image(); + } Key::Character("s") => { let Some(path) = FileDialog::new().save_file() else { eprintln!("no path to save provided");