mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:37:34 +00:00
PixelPaint: Add a Duplicate Layer action
The "Duplicate Layer" action inserts a copy of the selected layer into the layer stack. The new layer is placed above the selected layer.
This commit is contained in:
parent
55feecee36
commit
3faf089be5
7 changed files with 83 additions and 3 deletions
|
@ -405,4 +405,12 @@ Optional<Gfx::IntRect> Layer::nonempty_content_bounding_rect() const
|
|||
};
|
||||
}
|
||||
|
||||
ErrorOr<NonnullRefPtr<Layer>> Layer::duplicate(DeprecatedString name)
|
||||
{
|
||||
auto duplicated_layer = TRY(Layer::create_snapshot(m_image, *this));
|
||||
duplicated_layer->m_name = move(name);
|
||||
duplicated_layer->m_selected = false;
|
||||
return duplicated_layer;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue