1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 01:47:35 +00:00

PixelPaint: Add "Apply Mask" action

This commit adds a "Apply Mask" action which merges the active layer
mask with the layer bitmap. The option is only displayed if the active
layer is masked.
This commit is contained in:
Tim Ledbetter 2023-02-25 06:46:18 +00:00 committed by Andreas Kling
parent 062c9efa88
commit 799d570afc
4 changed files with 20 additions and 0 deletions

View file

@ -324,6 +324,14 @@ void Layer::delete_mask()
update_cached_bitmap();
}
void Layer::apply_mask()
{
m_content_bitmap->fill(Color::Transparent);
Gfx::Painter painter(m_content_bitmap);
painter.blit({}, m_cached_display_bitmap, m_cached_display_bitmap->rect());
delete_mask();
}
Gfx::Bitmap& Layer::currently_edited_bitmap()
{
switch (edit_mode()) {