drawComposition

fun drawComposition(documentBounds: CompositionDimensions = defaultCompositionDimensions, composition: Composition? = null, cursor: GroupNode? = composition?.root as? GroupNode, drawFunction: CompositionDrawer.() -> Unit): Composition(source)

Draws a vector composition by applying a provided drawing function.

Return

The resulting Composition after applying the drawing function.

Parameters

documentBounds

Defines the dimensions and bounds of the composition. Defaults to defaultCompositionDimensions.

composition

The target composition to be drawn on. If null, a new composition will be created.

cursor

Specifies the current position within the composition structure. Defaults to the root of the given composition cast as a GroupNode.

drawFunction

The actual drawing logic that will be executed in the drawing context of the CompositionDrawer.


fun Program.drawComposition(documentBounds: CompositionDimensions = CompositionDimensions(0.0.pixels, 0.0.pixels, this.drawer.width.toDouble().pixels, this.drawer.height.toDouble().pixels), composition: Composition? = null, cursor: GroupNode? = composition?.root as? GroupNode, drawFunction: CompositionDrawer.() -> Unit): Composition(source)

Draws a composition within the specified document bounds or an existing composition. This function utilizes a customizable draw function to define the drawing behavior.

Return

The resulting composition after applying the draw function.

Parameters

documentBounds

Specifies the dimensions for the drawing area. Defaults to the full drawable area of the program.

composition

An optional existing composition to draw onto. If not provided, a new composition is created.

cursor

An optional cursor representing the current position in the composition hierarchy. Defaults to the root of the provided composition.

drawFunction

A lambda function defining the drawing operations to be performed using the CompositionDrawer.


fun Program.drawComposition(documentBounds: Rectangle, composition: Composition? = null, cursor: GroupNode? = composition?.root as? GroupNode, drawFunction: CompositionDrawer.() -> Unit): Composition(source)

Draws a composition using the specified document bounds and drawing logic. Optionally, an existing composition and cursor can be passed to update or build upon them.

Return

The resulting Composition object after performing the drawing operations.

Parameters

documentBounds

The bounding rectangle representing the area to be drawn.

composition

An optional existing composition to update. If null, a new composition will be created.

cursor

An optional cursor GroupNode used as the starting position for appending new elements. Defaults to the root of the provided composition if available.

drawFunction

A lambda function containing the drawing operations to be applied.