Skip to content

packages/core/src/lib/geometry/svg-path.ts

Read as Markdown

This is the source snapshot used to build these API details. View this revision on GitHub.

Back to reference

1 /**
2  * Geometry and construction options for a svg path.
3  *
4  * @see {@link createSvgPath}
5  */
6 export interface SvgPathOptions {
7   /**
8    * Geometry to draw or clip, supplied in the declared path representation. See
9    * {@link SvgPathOptions}.
10    */
11   d: string;
12 }
13 
14 /**
15  * Creates a Canvas Path2D for svg geometry from validated options.
16  *
17  * @param options - SVG path data to parse. See {@link SvgPathOptions}.
18  * @returns A native Canvas path parsed from the supplied data.
19  *
20  * @see {@link SvgPathOptions}
21  */
22 export function createSvgPath(options: Readonly<SvgPathOptions>): Path2D {
23   return new Path2D(options.d);
24 }
25 

Documentation built with @pibbl/core 0.0.2, revision 2dccb19. ALPHA — NOT FOR PRODUCTION USE.