# Graphics.CanvasAction.Path

- Package
- purescript-canvas-action
- Repository
- artemisSystem/purescript-canvas-action

### #Path2D Source

`data Path2D`

A data type that contains a JavaScript `Path2D`

object and `PathData`

. The
constructor is not exported because that would allow for desync between the
JS `Path2D`

and its data.

### #PathAction Source

`newtype PathAction a`

#### Instances

### #getSubpathStart Source

`getSubpathStart :: PathAction (Maybe (Vector2 Number))`

Get the start position of the current subpath

### #moveTo Source

`moveTo :: forall p. ToPos Number p => p -> PathAction Unit`

Start a new sub-path at the given position

### #closePath Source

`closePath :: PathAction Unit`

Draw a line from the current position to the starting position of the sub-path

### #lineTo Source

`lineTo :: forall p. ToPos Number p => p -> PathAction Unit`

Draw a line from the last point in the sub-path to the given position

### #quadraticCurveTo Source

`quadraticCurveTo :: forall p. ToPos Number p => p -> p -> PathAction Unit`

Adds a quadratic Bézier curve to the path. The first point is the control point and the second one is the end point.

### #bezierCurveTo Source

`bezierCurveTo :: forall p. ToPos Number p => p -> p -> p -> PathAction Unit`

Adds a cubic Bézier curve to the path. The first two points are control points and the third one is the end point.

### #addPath' Source

`addPath' :: DOMMatrix -> Path2D -> PathAction Unit`

Add the contents of a `Path2D`

to the current path, transforming it
according to the provided `DOMMatrix`

### #runPath Source

`runPath :: forall m. MonadEffect m => PathAction Unit -> m Path2D`

Create a `Path2D`

from a `PathAction`

### #fillWith Source

`fillWith :: forall m r. MonadCanvasAction m => CanvasStyle r => r -> FillRule -> Path2D -> m Unit`

Fill a `Path2D`

with the given style

### #strokeWith Source

`strokeWith :: forall m r. MonadCanvasAction m => CanvasStyle r => r -> Path2D -> m Unit`

Stroke a `Path2D`

with the given style

### #clip Source

`clip :: forall m. MonadCanvasAction m => FillRule -> Path2D -> m Unit`

Clip subsequent canvas drawings to a `Path2D`

### #moveBy Source

`moveBy :: forall p. ToPos Number p => p -> PathAction Unit`

Move the cursor to a new position relative to its old position

### #lineBy Source

`lineBy :: forall p. ToPos Number p => p -> PathAction Unit`

Draw a line from the last point in the sub-path to the given position, measured relative to its old position

### #line Source

`line :: forall p. ToPos Number p => p -> p -> PathAction Unit`

Move to the first point and draw a line to the second point

### #abortSubpath Source

`abortSubpath :: PathAction Unit`

Aborts the current subpath and starts a new one at the cursor position