PixelPaint: Expose more complex selection operations

Now that we use RectMask internally to store the selection, we can
expose more powerful APIs to allow for better control over the image
selection.
This commit is contained in:
Davipb 2021-06-20 10:53:41 -03:00 committed by Andreas Kling
commit 22585e2845
Notes: sideshowbarker 2024-07-18 11:55:55 +09:00
4 changed files with 38 additions and 3 deletions

View file

@ -107,6 +107,26 @@ void Selection::clear()
m_editor.update();
}
void Selection::merge(Mask const& mask, MergeMode mode)
{
switch (mode) {
case MergeMode::Set:
m_mask = mask;
break;
case MergeMode::Add:
m_mask.add(mask);
break;
case MergeMode::Subtract:
m_mask.subtract(mask);
break;
case MergeMode::Intersect:
m_mask.intersect(mask);
break;
default:
VERIFY_NOT_REACHED();
}
}
void Selection::draw_marching_ants_pixel(Gfx::Painter& painter, int x, int y) const
{
int pattern_index = x + y + m_marching_ants_offset;