summaryrefslogtreecommitdiff
path: root/Userland
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 18:36:36 +0200
commitaebc260940a8e78fdd2fcbf1d09074976312c8a5 (patch)
treedb108b1bc5ea156e847a7c3531bbe0115ecf6f0c /Userland
parent6b079264666cf657204b1508960c82e0b8f9247f (diff)
downloadserenity-aebc260940a8e78fdd2fcbf1d09074976312c8a5.zip
PixelPaint: Add support for box sampling scaling
Diffstat (limited to 'Userland')
-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