Selection()
Selection(rectangle)Creates a new empty selection, or with the given rectangle.
local rectangle = selection.boundsReturns a rectangle with the bounds of the selection (if the rectangle is empty, is because there is no selection).
local point = selection.origin
selection.origin = newPointGets or sets the selection origin/position (a point). This can be used to move the selection edges (not the content).
local status = selection.isEmptyReturns true if the selection is empty i.e. there are no pixels selected.
selection:deselect()selection:select(rectangle)Replaces the selection with the given rectangle. If you want to add a rectangle to the selection, you can use Selection:add().
selection:selectAll()Selected the whole sprite canvas. Only valid for a sprite.selection.
selection:add(rectangle)
selection:add(otherSelection)Adds a new rectangle (or otherSelection) to the
selection. Creating an union between the existent selected area and
the given rectangle/otherSelection.
selection:subtract(rectangle)
selection:subtract(otherSelection)Subtracts the given rectangle (or otherSelection) from selection.
selection:intersect(rectangle)
selection:intersect(otherSelection)Creates an intersection in selection between the given rectangle
(or otherSelection) and the already selected area in selection.
local status = selection:contains(point)
local status = selection:contains(x, y)Returns true or false if the given point is inside the selection.