mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:17:35 +00:00
PixelPaint: Alternate selection outline between black and white
This commit is contained in:
parent
7597cca5c6
commit
4aff4249aa
1 changed files with 5 additions and 2 deletions
|
@ -22,7 +22,7 @@ Selection::Selection(ImageEditor& editor)
|
||||||
{
|
{
|
||||||
m_marching_ants_timer = Core::Timer::create_repeating(80, [this] {
|
m_marching_ants_timer = Core::Timer::create_repeating(80, [this] {
|
||||||
++m_marching_ants_offset;
|
++m_marching_ants_offset;
|
||||||
m_marching_ants_offset %= marching_ant_length;
|
m_marching_ants_offset %= (marching_ant_length * 2);
|
||||||
if (!is_empty() || m_in_interactive_selection)
|
if (!is_empty() || m_in_interactive_selection)
|
||||||
m_editor.update();
|
m_editor.update();
|
||||||
});
|
});
|
||||||
|
@ -34,8 +34,11 @@ void Selection::draw_marching_ants(Gfx::Painter& painter, Gfx::IntRect const& re
|
||||||
int offset = m_marching_ants_offset;
|
int offset = m_marching_ants_offset;
|
||||||
|
|
||||||
auto draw_pixel = [&](int x, int y) {
|
auto draw_pixel = [&](int x, int y) {
|
||||||
if ((offset % marching_ant_length) != 0)
|
if ((offset % (marching_ant_length * 2)) < marching_ant_length) {
|
||||||
painter.set_pixel(x, y, Color::Black);
|
painter.set_pixel(x, y, Color::Black);
|
||||||
|
} else {
|
||||||
|
painter.set_pixel(x, y, Color::White);
|
||||||
|
}
|
||||||
offset++;
|
offset++;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue