select_region
Select a rectangular, elliptical, or polygonal region so later pixel edits only affect that area until cleared.
Instructions
Select a region, so later edits only affect that area.
The selection persists until `deselect`, and every pixel-writing tool honours it.
There is no per-call override: to draw outside the selection, clear it first. Tools
that wrote fewer pixels than asked report `selection_applied` and
`pixels_outside_selection`, so a forgotten selection shows up in the result rather
than as a mysteriously incomplete edit.
Args:
shape: "rect", "ellipse" (both use x/y/width/height) or "polygon" (uses points).
x, y, width, height: The region. width/height default to the rest of the canvas.
points: For "polygon", a list of {"x": int, "y": int}, at least 3.
mode: "replace" the selection, or "add"/"subtract"/"intersect" with the current
one. Building a selection from several shapes is how you scope an edit to
an awkward area, such as everything except a character's eyes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| x | No | Default: 0. | |
| y | No | Default: 0. | |
| mode | No | Default: "replace". | replace |
| shape | No | Default: "rect". | rect |
| width | No | ||
| height | No | ||
| points | No | ||
| filename | Yes |