1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 21:47:46 +00:00

PixelPaint: Add lasso selection tool

Lasso selection works by allowing the user to draw an arbitrary shape
much like the pen tool and ensuring the shape is closed by connecting
the start/end points when the user is done drawing. Everything inside
the shape becomes the selection.

Selection is determined via an outer flood fill. We begin a flood fill
from a point that is guaranteed to be outside of the drawn shape, and
anything the fill doesn't touch is determined to be the selection
region.
This commit is contained in:
Timothy Slater 2022-09-07 07:46:16 -05:00 committed by Andreas Kling
parent dc5402f61e
commit 3d542b0c38
5 changed files with 281 additions and 0 deletions

View file

@ -12,6 +12,7 @@
#include "Tools/EllipseTool.h"
#include "Tools/EraseTool.h"
#include "Tools/GuideTool.h"
#include "Tools/LassoSelectTool.h"
#include "Tools/LineTool.h"
#include "Tools/MoveTool.h"
#include "Tools/PenTool.h"
@ -85,6 +86,7 @@ void ToolboxWidget::setup_tools()
add_tool("rectangle-select"sv, { 0, Key_R }, make<RectangleSelectTool>());
add_tool("wand-select"sv, { 0, Key_W }, make<WandSelectTool>());
add_tool("polygonal-select"sv, { Mod_Shift, Key_P }, make<PolygonalSelectTool>());
add_tool("lasso-select"sv, { 0, Key_L }, make<LassoSelectTool>());
add_tool("guides"sv, { 0, Key_G }, make<GuideTool>());
add_tool("clone"sv, { 0, Key_C }, make<CloneTool>());
}