mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00
PixelPaint: Undo and redo actions
The most used feature of any image editor, undo. Each tool now notifies the ImageEditor that they completed an action, where it'll take a snapshot if its current state. For now, a snapshot is just a copy of the whole image and its layers. There's a hard limit on the amount of actions it stores.
This commit is contained in:
parent
5aeab9878e
commit
1c27568ab0
21 changed files with 256 additions and 2 deletions
|
@ -62,6 +62,15 @@ void BrushTool::on_mousemove(Layer& layer, GUI::MouseEvent& event, GUI::MouseEve
|
|||
draw_line(layer.bitmap(), m_editor->color_for(event), m_last_position, event.position());
|
||||
layer.did_modify_bitmap(*m_editor->image());
|
||||
m_last_position = event.position();
|
||||
m_was_drawing = true;
|
||||
}
|
||||
|
||||
void BrushTool::on_mouseup(Layer&, GUI::MouseEvent&, GUI::MouseEvent&)
|
||||
{
|
||||
if (m_was_drawing) {
|
||||
m_editor->did_complete_action();
|
||||
m_was_drawing = false;
|
||||
}
|
||||
}
|
||||
|
||||
void BrushTool::draw_point(Gfx::Bitmap& bitmap, const Gfx::Color& color, const Gfx::IntPoint& point)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue