Skip to content

Documentation / @ripl/terminal / createClipMask

Function: createClipMask() ​

createClipMask(contours, width, height, previous?): ClipMask

Defined in: terminal/src/clip.ts:39

Builds a clip mask covering the interior of the given contours, intersected with an existing mask.

Intersection rather than replacement is what makes nested clips behave the way they do on canvas and SVG: an inner clip narrows the outer one, it never widens it.

Parameters ​

ParameterTypeDescription
contoursVertex[][]The clip geometry, in raster space.
widthnumberWidth of the raster grid.
heightnumberHeight of the raster grid.
previous?ClipMask | nullThe mask already in force, if any.

Returns ​

ClipMask

The intersected mask.