From f279c3aa15fc700ecae5ff28afe50c9562fe35f9 Mon Sep 17 00:00:00 2001 From: electria Date: Thu, 30 Jul 2026 19:19:23 -0700 Subject: [PATCH] feat: f to switch FilterMethod useful to scale pixelart images nicely. This makes me consider expanding the status bar to include info; partially because I don't use window decorations usually (so I don't see the info in the title) --- src/main.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main.rs b/src/main.rs index 18d35a0..9ff87f7 100644 --- a/src/main.rs +++ b/src/main.rs @@ -20,6 +20,7 @@ enum Message { struct State { image: Option, image_display: Option, + image_filter: widget::image::FilterMethod, error: Option, } @@ -40,6 +41,7 @@ impl State { widget::column([ if let Some(allocation) = self.image_display.as_ref() { widget::image::viewer(allocation.handle().clone()) + .filter_method(self.image_filter) .width(Length::Fill) .height(Length::Fill) .into() @@ -107,6 +109,12 @@ impl State { } }; } + Key::Character("f") => { + self.image_filter = match self.image_filter { + widget::image::FilterMethod::Linear => widget::image::FilterMethod::Nearest, + widget::image::FilterMethod::Nearest => widget::image::FilterMethod::Linear, + } + } Key::Character("s") => { self.save_image();