Draw
drawBatch-apply drawing operations to one cel as a single undoable action, so users can revert the entire edit with one Ctrl+Z.
Instructions
Apply a batch of drawing operations to one cel, as a single undoable action. Ops: pixels, line, polyline, rect, ellipse, fill, replace, dither, gradient, clear, blit. Batch aggressively — a whole sprite in one call is normal and correct, and it means the user can undo your work with one Ctrl+Z. Set paletteLock (default true) to snap every colour to the sprite's palette by perceptual distance before anything is written, so you cannot silently widen a curated palette. Ops run in array order, so paint fills before outlines and outlines before highlights.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ops | Yes | Applied in order, in one transaction. | |
| frame | No | 1-based frame number. Omit to use the active frame. | |
| label | No | Name shown in Aseprite's undo history. Describe the intent, e.g. 'shade helmet'. | |
| layer | No | Layer name. Omit to use the active layer. | |
| sprite | No | Sprite filename or id. Omit to use the sprite Aseprite has focused. | |
| createCel | No | Create the cel if the target layer/frame has none. | |
| paletteLock | No | Snap every colour to the nearest palette entry (CIELAB ΔE). Set false only when the user asked to introduce new colours. | |
| selectionOnly | No | Clip every op to the current selection. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| frame | Yes | ||
| layer | Yes | ||
| bounds | No | Bounding box actually touched. | |
| sprite | Yes | ||
| opsApplied | Yes | ||
| colorsSnapped | Yes | Colours palette-lock moved, and how far. A large ΔE means the palette lacks that colour. | |
| pixelsChanged | Yes |