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();