PathScope

class PathScope

Receiver of FreeDrawScope.path — records absolute path commands.

The pen model matches every 2D canvas API: moveTo starts a new subpath, lineTo / quadTo / cubicTo extend it, close joins back to the subpath's starting point.

Functions

Link copied to clipboard
fun close()

Closes the current subpath back to its starting point.

Link copied to clipboard
fun cubicTo(c1x: Float, c1y: Float, c2x: Float, c2y: Float, x: Float, y: Float)

Cubic Bézier with control points (c1x, c1y) / (c2x, c2y) ending at (x, y).

Link copied to clipboard
fun lineTo(x: Float, y: Float)

Straight segment from the current point to (x, y).

Link copied to clipboard
fun moveTo(x: Float, y: Float)

Starts a new subpath at (x, y).

Link copied to clipboard
fun quadTo(cx: Float, cy: Float, x: Float, y: Float)

Quadratic Bézier with control point (cx, cy) ending at (x, y).

Link copied to clipboard
fun rect(x: Float, y: Float, width: Float, height: Float)

Convenience: an axis-aligned rectangle as a closed subpath.