Skip to main content
Provides functions for drawing paths and images, managing clipping, and applying transforms during rendering.

Methods

drawPath

Draws the given Path using the specified Paint. For a more detailed explanation and working examples, see Drawing with Node Scripts.

drawImage

Draws an Image using the ImageSampler, BlendMode, and opacity. Check out Scripting demos to see a working example.

drawImageMesh

Draws an image using mesh data defined by vertices, texture coordinates, and triangle indices. Check out Scripting demos to see a working example.

drawImageMeshInstanced

Draws one mesh once per entry of a MeshInstances, in a single call. The blend mode is always srcOver. Opacity and the UV transform come from each instance.

clipPath

Restricts subsequent drawing to the area defined by the given Path. Clipping remains in effect until the next restore call. Check out Scripting demos to see a working example.

save

Saves the current rendering state, including transforms and clipping.

restore

Restores the most recently saved rendering state.

transform

Applies a transform to the current rendering state. Transforms are applied cumulatively until restored.

modulateOpacity

Multiplies the opacity of subsequent draw calls by opacity (0..1). Stacks multiplicatively and is captured by save()/restore(), so the common pattern is: renderer:save(); renderer:modulateOpacity(a); … draw …; renderer:restore().

modulateColor

Multiplies color into subsequent draw calls, channel by channel. Stacks and is captured by save()/restore() like modulateOpacity.

setColorModulation

Sets the modulation color outright rather than multiplying, which lets an inner scope undo an outer one: draw an artboard under black, then set the color for the drawables that should keep their paint. Captured by save()/restore(); inside a draw visitor it ends with the visit, so the visitor needs no save()/restore() of its own.