From 1759d8f34ed865a5ac059b46e7c2379eda703eef Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Fri, 3 Jun 2022 20:12:25 +0200 Subject: [PATCH] ImageViewer: Add Smooth Pixels image scaling option --- Userland/Applications/ImageViewer/main.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp index 43b303b2972..555b96c4a89 100644 --- a/Userland/Applications/ImageViewer/main.cpp +++ b/Userland/Applications/ImageViewer/main.cpp @@ -240,6 +240,10 @@ ErrorOr serenity_main(Main::Arguments arguments) }); nearest_neighbor_action->set_checked(true); + auto smooth_pixels_action = GUI::Action::create_checkable("&Smooth Pixels", [&](auto&) { + widget->set_scaling_mode(Gfx::Painter::ScalingMode::SmoothPixels); + }); + auto bilinear_action = GUI::Action::create_checkable("&Bilinear", [&](auto&) { widget->set_scaling_mode(Gfx::Painter::ScalingMode::BilinearBlend); }); @@ -314,9 +318,11 @@ ErrorOr serenity_main(Main::Arguments arguments) auto scaling_mode_group = make(); scaling_mode_group->set_exclusive(true); scaling_mode_group->add_action(*nearest_neighbor_action); + scaling_mode_group->add_action(*smooth_pixels_action); scaling_mode_group->add_action(*bilinear_action); TRY(scaling_mode_menu->try_add_action(nearest_neighbor_action)); + TRY(scaling_mode_menu->try_add_action(smooth_pixels_action)); TRY(scaling_mode_menu->try_add_action(bilinear_action)); TRY(view_menu->try_add_separator());