feat: "o" to open image

This commit is contained in:
electria 2026-06-30 22:53:14 -07:00
commit e9fb349352
Signed by: electria
SSH key fingerprint: SHA256:8LlB3ucPbBHqozqkhsNbaV5oG3SlzzqUj8FZDL6IPQs

View file

@ -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");