mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:27:35 +00:00
PaintBrush: Make the line, rectangle and ellipsis preview work again
You can now see what you're drawing before committing to it. This works by passing the second_paint_event from the ImageEditor to the tool. We also pass the active layer which makes it easier for the tool to keep his logic in layer-relative coordinates even while drawing preview states directly into the ImageEditor backing bitmap.
This commit is contained in:
parent
8318842c7e
commit
96d03546ef
9 changed files with 20 additions and 17 deletions
|
@ -97,17 +97,15 @@ void RectangleTool::on_mousemove(Layer&, GUI::MouseEvent& event, GUI::MouseEvent
|
|||
m_editor->update();
|
||||
}
|
||||
|
||||
void RectangleTool::on_second_paint(GUI::PaintEvent& event)
|
||||
void RectangleTool::on_second_paint(const Layer& layer, GUI::PaintEvent& event)
|
||||
{
|
||||
if (m_drawing_button == GUI::MouseButton::None)
|
||||
return;
|
||||
|
||||
(void)event;
|
||||
#if 0
|
||||
GUI::Painter painter(*m_widget);
|
||||
GUI::Painter painter(*m_editor);
|
||||
painter.add_clip_rect(event.rect());
|
||||
painter.translate(layer.location());
|
||||
draw_using(painter);
|
||||
#endif
|
||||
}
|
||||
|
||||
void RectangleTool::on_keydown(GUI::KeyEvent& event)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue