mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
PixelPaint: Add Smooth Pixels scaling option
This commit is contained in:
parent
1759d8f34e
commit
54687c63af
2 changed files with 13 additions and 1 deletions
|
@ -24,7 +24,7 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize const& suggested_size, GUI::Wi
|
||||||
m_starting_aspect_ratio = m_desired_size.width() / static_cast<float>(m_desired_size.height());
|
m_starting_aspect_ratio = m_desired_size.width() / static_cast<float>(m_desired_size.height());
|
||||||
|
|
||||||
set_title("Resize Image");
|
set_title("Resize Image");
|
||||||
resize(260, 210);
|
resize(260, 228);
|
||||||
set_icon(parent_window->icon());
|
set_icon(parent_window->icon());
|
||||||
|
|
||||||
auto& main_widget = set_main_widget<GUI::Widget>();
|
auto& main_widget = set_main_widget<GUI::Widget>();
|
||||||
|
@ -68,9 +68,11 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize const& suggested_size, GUI::Wi
|
||||||
};
|
};
|
||||||
|
|
||||||
auto nearest_neighbor_radio = main_widget.find_descendant_of_type_named<GUI::RadioButton>("nearest_neighbor_radio");
|
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 bilinear_radio = main_widget.find_descendant_of_type_named<GUI::RadioButton>("bilinear_radio");
|
||||||
|
|
||||||
VERIFY(nearest_neighbor_radio);
|
VERIFY(nearest_neighbor_radio);
|
||||||
|
VERIFY(smooth_pixels_radio);
|
||||||
VERIFY(bilinear_radio);
|
VERIFY(bilinear_radio);
|
||||||
|
|
||||||
m_scaling_mode = Gfx::Painter::ScalingMode::NearestNeighbor;
|
m_scaling_mode = Gfx::Painter::ScalingMode::NearestNeighbor;
|
||||||
|
@ -82,6 +84,10 @@ ResizeImageDialog::ResizeImageDialog(Gfx::IntSize const& suggested_size, GUI::Wi
|
||||||
if (is_checked)
|
if (is_checked)
|
||||||
m_scaling_mode = Gfx::Painter::ScalingMode::NearestNeighbor;
|
m_scaling_mode = Gfx::Painter::ScalingMode::NearestNeighbor;
|
||||||
};
|
};
|
||||||
|
smooth_pixels_radio->on_checked = [this](bool is_checked) {
|
||||||
|
if (is_checked)
|
||||||
|
m_scaling_mode = Gfx::Painter::ScalingMode::SmoothPixels;
|
||||||
|
};
|
||||||
bilinear_radio->on_checked = [this](bool is_checked) {
|
bilinear_radio->on_checked = [this](bool is_checked) {
|
||||||
if (is_checked)
|
if (is_checked)
|
||||||
m_scaling_mode = Gfx::Painter::ScalingMode::BilinearBlend;
|
m_scaling_mode = Gfx::Painter::ScalingMode::BilinearBlend;
|
||||||
|
|
|
@ -81,6 +81,12 @@
|
||||||
autosize: true
|
autosize: true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GUI::RadioButton {
|
||||||
|
name: "smooth_pixels_radio"
|
||||||
|
text: "Smooth Pixels"
|
||||||
|
autosize: true
|
||||||
|
}
|
||||||
|
|
||||||
@GUI::RadioButton {
|
@GUI::RadioButton {
|
||||||
name: "bilinear_radio"
|
name: "bilinear_radio"
|
||||||
text: "Bilinear"
|
text: "Bilinear"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue