Package-level declarations
Types
A point of a stroke, in working-frame pixels.
One stroke of the artist's brush on frame of a clip's mask; stored per clip in profile.json, in the order painted. It stamps a disc of radius pixels along points, in working-frame pixels, and strokes on one frame apply in that order, so a later one wins where they cross.
Connected regions of a Mask. Foreground connects through all eight neighbours and background through the four edge neighbours — the usual pairing, so a diagonal chain of foreground pixels is one region and background never leaks through it.
Masks frames against one clean plate:
The mask stage: one ForegroundMask per frame of a clip, against the clip's clean plate. Cached under the frames, the plate and the MaskSettings, so changing a threshold masks again and nothing upstream is touched.
Two-level thresholding. A pixel at or above high is certainly foreground; one at or above low is foreground only when it connects, through all eight neighbours, to a certain one. So the soft edge of the figure is kept while equally faint noise elsewhere in the frame is not.
Applies BrushStrokes to a mask: pure, so the same strokes always give the same mask.
The mask fix stage: a clip's masks with the artist's BrushStrokes applied by MaskBrush, cached under the masks and the strokes. With no strokes it is the masks themselves, so an unfixed clip stores nothing twice and keeps every downstream key.
Binary morphology with a square structuring element of side 2 × radius + 1. A square is separable, so each operation runs along rows and then columns, with a sliding count that makes the cost independent of the radius.