Path2D Class
A path that can be filled, stroked or used as a clip by the 2D contexts (https://html.spec.whatwg.org/multipage/canvas.html#path2d-objects): its subpaths are in the coordinates of the drawing operations that use it (transformed by their current transformation matrix).
public sealed class Path2DConstructors
| Name | Description |
|---|---|
| Path2D() | Creates an empty path (https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d). |
| Path2D(object?) | Creates a copy of a path, or the path of SVG path data (https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d): the commands up to the first error of the path data. |
Path2D overloads
Path2D()
Path2D.csCreates an empty path (https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d).
public Path2D()Path2D(object?)
Path2D.csCreates a copy of a path, or the path of SVG path data (https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d): the commands up to the first error of the path data.
public Path2D(object? path)Parameters
See also
Methods
| Name | Description |
|---|---|
| AddPath(Path2D, DomMatrix2DInit?) | Adds the subpaths of a path, transformed by a matrix (https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d-addpath): a matrix with a non-finite component is ignored (nothing is added). |
| Arc(double, double, double, double, double, bool) | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-arc |
| ArcTo(double, double, double, double, double) | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-arcto |
| BezierCurveTo(double, double, double, double, double, double) | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-beziercurveto |
| ClosePath() | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-closepath |
| Ellipse(double, double, double, double, double, double, double, bool) | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-ellipse |
| LineTo(double, double) | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-lineto |
| MoveTo(double, double) | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-moveto |
| QuadraticCurveTo(double, double, double, double) | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-quadraticcurveto |
| Rect(double, double, double, double) | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-rect |
| RoundRect(double, double, double, double, object?) | https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-roundrect |
AddPath(Path2D, DomMatrix2DInit?)
Path2D.csAdds the subpaths of a path, transformed by a matrix (https://html.spec.whatwg.org/multipage/canvas.html#dom-path2d-addpath): a matrix with a non-finite component is ignored (nothing is added).
public void AddPath(Path2D path, DomMatrix2DInit? transform = null)Parameters
pathPath2DtransformDomMatrix2DInit?
Exceptions
TypeErrorException- The members of the dictionary are inconsistent.
See also
Arc(double, double, double, double, double, bool)
Path2D.csArcTo(double, double, double, double, double)
Path2D.cshttps://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-arcto
BezierCurveTo(double, double, double, double, double, double)
Path2D.cshttps://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-beziercurveto
ClosePath()
Path2D.cshttps://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-closepath
public void ClosePath()Ellipse(double, double, double, double, double, double, double, bool)
Path2D.cshttps://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-ellipse
public void Ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, bool counterclockwise = false)LineTo(double, double)
Path2D.csMoveTo(double, double)
Path2D.csQuadraticCurveTo(double, double, double, double)
Path2D.csRect(double, double, double, double)
Path2D.csRoundRect(double, double, double, double, object?)
Path2D.cshttps://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-roundrect
Parameters
xdouble- The x coordinate of the rectangle.
ydouble- The y coordinate of the rectangle.
wdouble- The width of the rectangle.
hdouble- The height of the rectangle.
radiiobject?- A radius (a number or a
DomPointInit), or a list of 1 to 4 radii.
Exceptions
RangeErrorException- The number of radii is not between 1 and 4, or a radius is negative.