diff options
author | FrHun <28605587+frhun@users.noreply.github.com> | 2022-12-04 22:09:42 +0100 |
---|---|---|
committer | Sam Atkins <atkinssj@gmail.com> | 2022-12-23 12:16:46 +0000 |
commit | 808eafcf1e7d227da9055b0c784cda7cc1afbb3e (patch) | |
tree | cd644a60e964bf118023b5946983082feea1b00f /Userland/Applications/Magnifier/MagnifierWidget.cpp | |
parent | 2b635b5330804bf6ba79a40d81d25e5ae14c1a4f (diff) | |
download | serenity-808eafcf1e7d227da9055b0c784cda7cc1afbb3e.zip |
Magnifier: Add option to choose grid color
Diffstat (limited to 'Userland/Applications/Magnifier/MagnifierWidget.cpp')
-rw-r--r-- | Userland/Applications/Magnifier/MagnifierWidget.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/Userland/Applications/Magnifier/MagnifierWidget.cpp b/Userland/Applications/Magnifier/MagnifierWidget.cpp index 66953b1c0d..941fb27d9a 100644 --- a/Userland/Applications/Magnifier/MagnifierWidget.cpp +++ b/Userland/Applications/Magnifier/MagnifierWidget.cpp @@ -40,6 +40,14 @@ void MagnifierWidget::show_grid(bool new_value) update(); } +void MagnifierWidget::set_grid_color(Gfx::Color new_color) +{ + if (m_grid_color == new_color) + return; + m_grid_color = new_color; + update(); +} + void MagnifierWidget::set_color_filter(OwnPtr<Gfx::ColorBlindnessFilter> color_filter) { m_color_filter = move(color_filter); @@ -92,8 +100,6 @@ void MagnifierWidget::paint_event(GUI::PaintEvent& event) painter.draw_scaled_bitmap(frame_inner_rect(), *m_grabbed_bitmap, m_grabbed_bitmap->rect(), 1.0, Gfx::Painter::ScalingMode::NearestFractional); if (m_show_grid) { - auto line_color = Color(Color::NamedColor::Magenta); - line_color.set_alpha(100); auto grid_rect = frame_inner_rect(); if (m_grabbed_bitmap) @@ -109,10 +115,10 @@ void MagnifierWidget::paint_event(GUI::PaintEvent& event) end_x = grid_rect.right(); for (int current_y = start_y; current_y <= end_y; current_y += m_scale_factor) - painter.draw_line({ start_x, current_y }, { end_x, current_y }, line_color); + painter.draw_line({ start_x, current_y }, { end_x, current_y }, m_grid_color); for (int current_x = start_y; current_x <= end_x; current_x += m_scale_factor) - painter.draw_line({ current_x, start_y }, { current_x, end_y }, line_color); + painter.draw_line({ current_x, start_y }, { current_x, end_y }, m_grid_color); } } |