1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:27:45 +00:00

Add a simple spray fill tool

Could do with some more tweaking no doubt, and it'd be nice to have a
circular spray, but this is better than nothing.
This commit is contained in:
Robin Burchell 2019-06-16 11:33:20 +02:00 committed by Andreas Kling
parent 940eb1bbeb
commit 502c54e39a
11 changed files with 143 additions and 32 deletions

View file

@ -44,15 +44,15 @@ static void flood_fill(GraphicsBitmap& bitmap, const Point& start_position, Colo
}
}
void BucketTool::on_mousedown(PaintableWidget& paintable_widget, GMouseEvent& event)
void BucketTool::on_mousedown(GMouseEvent& event)
{
if (!paintable_widget.rect().contains(event.position()))
if (!m_widget->rect().contains(event.position()))
return;
GPainter painter(paintable_widget.bitmap());
auto target_color = paintable_widget.bitmap().get_pixel(event.x(), event.y());
GPainter painter(m_widget->bitmap());
auto target_color = m_widget->bitmap().get_pixel(event.x(), event.y());
flood_fill(paintable_widget.bitmap(), event.position(), target_color, paintable_widget.color_for(event));
flood_fill(m_widget->bitmap(), event.position(), target_color, m_widget->color_for(event));
paintable_widget.update();
m_widget->update();
}