Skip to main content
Module

x/canvas/mod.ts>PathConstructorAndFactory

Canvas API for Deno, ported from canvaskit-wasm (Skia).
Latest
interface PathConstructorAndFactory
import { type PathConstructorAndFactory } from "https://deno.land/x/canvas@v1.4.1/mod.ts";

Contains the ways to create an Path.

Methods

MakeFromCmds(cmds: InputCommands): Path | null

Creates a new path from the given list of path commands. If this fails, null will be returned instead.

MakeFromOp(
one: Path,
two: Path,
op: PathOp,
): Path | null

Creates a new path by combining the given paths according to op. If this fails, null will be returned instead.

MakeFromSVGString(str: string): Path | null

Creates a new path from the provided SVG string. If this fails, null will be returned instead.

MakeFromVerbsPointsWeights(
verbs: VerbList,
weights?: WeightList,
): Path

Creates a new path using the provided verbs and associated points and weights. The process reads the first verb from verbs and then the appropriate number of points from the FlattenedPointArray (e.g. 2 points for moveTo, 4 points for quadTo, etc). If the verb is a conic, a weight will be read from the WeightList. If the data is malformed (e.g. not enough points), the resulting path will be incomplete.