Skip to content

Path2D

Generated from idl/canvas.webidl when the site was built at 7aa23e2.

Path2D is an interface in idl/canvas.webidl, exposed in Window, Worker. It includes CanvasPath. What it does is on MDN; this page says what niso has of it.

The web features its members belong to, each with its Baseline status on the web and how much of the feature’s WPT suite passes in niso (see Web platform support).

Feature On the web In niso Members
2D canvas Widely available Partial 77% 1209 of 1553 subtests pass 13
constructor
[NisoGlue] constructor(optional any path);
static operation not in JS
[NisoInternal] static Path2D create(Path2D? copy, DOMString? svg);
int32_t niso_path2_d_create(niso_dom* dom, niso_handle copy, const char* svg, size_t svg_len, niso_handle* out);

A copy of copy, the path svg describes, or an empty path.

operation
[NisoGlue] undefined addPath(Path2D path, optional any transform = null);
operation not in JS
[NisoInternal] undefined addPathWith(Path2D path, unrestricted double a, unrestricted double b, unrestricted double c, unrestricted double d, unrestricted double e, unrestricted double f);
int32_t niso_path2_d_add_path_with(niso_dom* dom, niso_handle self, niso_handle path, double a, double b, double c, double d, double e, double f);
operation from CanvasPath
undefined closePath();
int32_t niso_canvas_path_close_path(niso_dom* dom, niso_handle self);
operation from CanvasPath
undefined moveTo(unrestricted double x, unrestricted double y);
int32_t niso_canvas_path_move_to(niso_dom* dom, niso_handle self, double x, double y);
operation from CanvasPath
undefined lineTo(unrestricted double x, unrestricted double y);
int32_t niso_canvas_path_line_to(niso_dom* dom, niso_handle self, double x, double y);
operation from CanvasPath
undefined quadraticCurveTo(unrestricted double cpx, unrestricted double cpy, unrestricted double x, unrestricted double y);
int32_t niso_canvas_path_quadratic_curve_to(niso_dom* dom, niso_handle self, double cpx, double cpy, double x, double y);
operation from CanvasPath
undefined bezierCurveTo(unrestricted double cp1x, unrestricted double cp1y, unrestricted double cp2x, unrestricted double cp2y, unrestricted double x, unrestricted double y);
int32_t niso_canvas_path_bezier_curve_to(niso_dom* dom, niso_handle self, double cp1x, double cp1y, double cp2x, double cp2y, double x, double y);
operation from CanvasPath
undefined arcTo(unrestricted double x1, unrestricted double y1, unrestricted double x2, unrestricted double y2, unrestricted double radius);
int32_t niso_canvas_path_arc_to(niso_dom* dom, niso_handle self, double x1, double y1, double x2, double y2, double radius);
operation from CanvasPath
undefined rect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h);
int32_t niso_canvas_path_rect(niso_dom* dom, niso_handle self, double x, double y, double w, double h);
operation from CanvasPath
[NisoGlue] undefined roundRect(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h, optional any radii = 0);
operation not in JS from CanvasPath
[NisoInternal] undefined roundRectWith(unrestricted double x, unrestricted double y, unrestricted double w, unrestricted double h, Float64Array radii);
int32_t niso_canvas_path_round_rect_with(niso_dom* dom, niso_handle self, double x, double y, double w, double h, const uint8_t* radii, size_t radii_len);

radii: an x and y radius for each corner, upper left first.

operation from CanvasPath
undefined arc(unrestricted double x, unrestricted double y, unrestricted double radius, unrestricted double startAngle, unrestricted double endAngle, optional boolean counterclockwise = false);
int32_t niso_canvas_path_arc(niso_dom* dom, niso_handle self, double x, double y, double radius, double start_angle, double end_angle, bool counterclockwise);
operation from CanvasPath
undefined ellipse(unrestricted double x, unrestricted double y, unrestricted double radiusX, unrestricted double radiusY, unrestricted double rotation, unrestricted double startAngle, unrestricted double endAngle, optional boolean counterclockwise = false);
int32_t niso_canvas_path_ellipse(niso_dom* dom, niso_handle self, double x, double y, double radius_x, double radius_y, double rotation, double start_angle, double end_angle, bool counterclockwise);