summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2023-05-19 00:28:51 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-19 06:16:14 +0200
commit032c2a882aee23ea4ac79ac907e9594ba311764d (patch)
treed21d09203c3bd10152f4a073ed5181de805a0ec6 /Userland/Applications
parenteb418bec32dbd2371d2f6ead973ff7e93b16c919 (diff)
downloadserenity-032c2a882aee23ea4ac79ac907e9594ba311764d.zip
ImageViewer: Add support for box sampling scaling
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/ImageViewer/main.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/Userland/Applications/ImageViewer/main.cpp b/Userland/Applications/ImageViewer/main.cpp
index f77a72cee7..13d9602928 100644
--- a/Userland/Applications/ImageViewer/main.cpp
+++ b/Userland/Applications/ImageViewer/main.cpp
@@ -261,6 +261,10 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
widget->set_scaling_mode(Gfx::Painter::ScalingMode::BilinearBlend);
});
+ auto box_sampling_action = GUI::Action::create_checkable("B&ox Sampling", [&](auto&) {
+ widget->set_scaling_mode(Gfx::Painter::ScalingMode::BoxSampling);
+ });
+
widget->on_image_change = [&](Gfx::Bitmap const* bitmap) {
bool should_enable_image_actions = (bitmap != nullptr);
bool should_enable_forward_actions = (widget->is_next_available() && should_enable_image_actions);
@@ -345,10 +349,12 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
scaling_mode_group->add_action(*nearest_neighbor_action);
scaling_mode_group->add_action(*smooth_pixels_action);
scaling_mode_group->add_action(*bilinear_action);
+ scaling_mode_group->add_action(*box_sampling_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(scaling_mode_menu->try_add_action(box_sampling_action));
TRY(view_menu->try_add_separator());
TRY(view_menu->try_add_action(hide_show_toolbar_action));