mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 22:47:44 +00:00
PixelPaint: Add function to visualize editing-masks
This patch adds a function to make the editing-eask visible while beeing in mask-mode so that the user can see which parts are covered by the masks and can therefore be modified by other tools that support editing masks.
This commit is contained in:
parent
69650a5812
commit
660d6f171c
6 changed files with 76 additions and 0 deletions
|
@ -290,6 +290,9 @@ Gfx::IntRect ImageEditor::mouse_indicator_rect_y() const
|
|||
|
||||
void ImageEditor::second_paint_event(GUI::PaintEvent& event)
|
||||
{
|
||||
if (m_active_layer && m_active_layer->mask_type() != Layer::MaskType::None)
|
||||
m_active_layer->on_second_paint(*this);
|
||||
|
||||
if (m_active_tool) {
|
||||
if (m_show_rulers) {
|
||||
auto clipped_event = GUI::PaintEvent(subtract_rulers_from_rect(event.rect()), event.window_size());
|
||||
|
@ -945,4 +948,15 @@ DeprecatedString ImageEditor::generate_unique_layer_name(DeprecatedString const&
|
|||
return new_layer_name.to_deprecated_string();
|
||||
}
|
||||
|
||||
Gfx::IntRect ImageEditor::active_layer_visible_rect()
|
||||
{
|
||||
if (!active_layer())
|
||||
return {};
|
||||
|
||||
auto scaled_layer_rect = active_layer()->relative_rect().to_type<float>().scaled(scale(), scale()).to_type<int>().translated(content_rect().location());
|
||||
auto visible_editor_rect = ruler_visibility() ? subtract_rulers_from_rect(rect()) : rect();
|
||||
scaled_layer_rect.intersect(visible_editor_rect);
|
||||
return scaled_layer_rect;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue