diff options
author | Jelle Raaijmakers <jelle@gmta.nl> | 2023-05-19 00:28:51 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2023-05-19 18:36:36 +0200 |
commit | 6b079264666cf657204b1508960c82e0b8f9247f (patch) | |
tree | 890a5dd8a1f360e4f4c09e66253e1e856481d868 | |
parent | 6242d8e023d1344f15a2e689297d481fb50d565a (diff) | |
download | serenity-6b079264666cf657204b1508960c82e0b8f9247f.zip |
ImageViewer: Add support for box sampling scaling
-rw-r--r-- | Userland/Applications/ImageViewer/main.cpp | 6 |
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)); |