summaryrefslogtreecommitdiff
path: root/Userland/Applications
diff options
context:
space:
mode:
authorJelle Raaijmakers <jelle@gmta.nl>2023-05-19 00:29:05 +0200
committerAndreas Kling <kling@serenityos.org>2023-05-19 06:16:14 +0200
commitd6aefb1bf121b21745410c666dd612ca6fa5f016 (patch)
tree4fd18a683bba6d2698126b8585661bea75b74ccd /Userland/Applications
parent032c2a882aee23ea4ac79ac907e9594ba311764d (diff)
downloadserenity-d6aefb1bf121b21745410c666dd612ca6fa5f016.zip
PixelPaint: Add support for box sampling scaling
Diffstat (limited to 'Userland/Applications')
-rw-r--r--Userland/Applications/PixelPaint/ResizeImageDialog.cpp9
-rw-r--r--Userland/Applications/PixelPaint/ResizeImageDialog.gml8
2 files changed, 14 insertions, 3 deletions
diff --git a/Userland/Applications/PixelPaint/ResizeImageDialog.cpp b/Userland/Applications/PixelPaint/ResizeImageDialog.cpp
index edc2e26d01..dc6b9d9504 100644
--- a/Userland/Applications/PixelPaint/ResizeImageDialog.cpp
+++ b/Userland/Applications/PixelPaint/ResizeImageDialog.cpp
@@ -69,17 +69,18 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize suggested_size, GUI::Window* p
auto nearest_neighbor_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("nearest_neighbor_radio");
auto smooth_pixels_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("smooth_pixels_radio");
auto bilinear_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("bilinear_radio");
+ auto box_sampling_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("box_sampling_radio");
auto resize_canvas_radio = main_widget->find_descendant_of_type_named<GUI::RadioButton>("resize_canvas");
VERIFY(nearest_neighbor_radio);
VERIFY(smooth_pixels_radio);
VERIFY(bilinear_radio);
+ VERIFY(box_sampling_radio);
VERIFY(resize_canvas_radio);
m_scaling_mode = Gfx::Painter::ScalingMode::NearestNeighbor;
- if (bilinear_radio->is_checked()) {
+ if (bilinear_radio->is_checked())
m_scaling_mode = Gfx::Painter::ScalingMode::BilinearBlend;
- }
nearest_neighbor_radio->on_checked = [this](bool is_checked) {
if (is_checked)
@@ -93,6 +94,10 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize suggested_size, GUI::Window* p
if (is_checked)
m_scaling_mode = Gfx::Painter::ScalingMode::BilinearBlend;
};
+ box_sampling_radio->on_checked = [this](bool is_checked) {
+ if (is_checked)
+ m_scaling_mode = Gfx::Painter::ScalingMode::BoxSampling;
+ };
resize_canvas_radio->on_checked = [this](bool is_checked) {
if (is_checked)
m_scaling_mode = Gfx::Painter::ScalingMode::None;
diff --git a/Userland/Applications/PixelPaint/ResizeImageDialog.gml b/Userland/Applications/PixelPaint/ResizeImageDialog.gml
index fa743b49ec..39bcca0a57 100644
--- a/Userland/Applications/PixelPaint/ResizeImageDialog.gml
+++ b/Userland/Applications/PixelPaint/ResizeImageDialog.gml
@@ -1,7 +1,7 @@
@GUI::Widget {
fill_with_background_color: true
min_width: 260
- min_height: 260
+ min_height: 280
layout: @GUI::VerticalBoxLayout {
margins: [4]
}
@@ -94,6 +94,12 @@
}
@GUI::RadioButton {
+ name: "box_sampling_radio"
+ text: "Box Sampling"
+ autosize: true
+ }
+
+ @GUI::RadioButton {
name: "resize_canvas"
text: "Resize Canvas (None)"
autosize: true