mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 22:57:44 +00:00
PixelPaint: Add support for box sampling scaling
This commit is contained in:
parent
032c2a882a
commit
d6aefb1bf1
2 changed files with 14 additions and 3 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue