1
Fork 0
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:
Tim Ledbetter 2023-03-24 17:51:24 +00:00 committed by Jelle Raaijmakers
parent 55feecee36
commit 3faf089be5
7 changed files with 83 additions and 3 deletions

View file

@ -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;
}
}