Path
declare class Path {}
The Path class encapsulates compound (multiple contour) geometric paths consisting of straight line segments, quadratic curves. It can be drawn with canvas.drawPath(path, paint), either filled or stroked (based on the paint's Style), or it can be used for clipping or to draw text on a path.
Instance Method
constructor
Signature
declare class Path {
constructor()
constructor(path: Path)
}
Description
Create a new path
arcTo
Signature
declare class Path {
arcTo(oval:Rect, startAngle: number, sweepAngle: number): void
arcTo(oval: Rect, startAngle: number, sweepAngle: number, forceMoveTo: boolean): void
}
Description
Append the specified arc to the path as a new contour.
addRect
Signature
declare class Path {
addRect(rect: Rect, dir: Path.Direction): void
addRect(left: number, top: number, right: number, bottom: number, dir: Path.Direction): void
}
Description
Add a closed rectangle contour to the path
addOval
Signature
declare class Path {
addOval(oval: Rect, dir: Path.Direction): void
}
Description
Add a closed oval contour to the path
addCircle
Signature
declare class Path {
addCircle(x: number, y: number, radius: number, dir: Path.Direction): void
}
Description
Add a closed circle contour to the path
addArc
Signature
declare class Path {
addArc(oval:Rect, startAngle: number, sweepAngle: number): void
}
Description
Add the specified arc to the path as a new contour.
addPath
Signature
declare class Path {
addPath(src: Path): void
}
Description
Add a copy of src to the path
addPath
Signature
declare class Path {
addPath(src: Path, matrix: Matrix): void
}
Description
Add a copy of src to the path, transformed by matrix
addPath
Signature
declare class Path {
addPath(src: Path, dx: number, dy: number): void
}
Description
Add a copy of src to the path, offset by (dx,dy)
addRoundRect
Signature
declare class Path {
addRoundRect(rect: Rect, radii: number[], dir: Path.Direction): void
addRoundRect(rect: Rect, rx: number, ry: number, dir: Path.Direction): void
}
Description
Add a closed round-rectangle contour to the path
offset
Signature
declare class Path {
offset(dx: number, dy: number): void
offset(dx: number, dy: number, dst: Path): void
}
Description
Offset the path by (dx,dy)
setLastPoint
Signature
declare class Path {
setLastPoint(dx: number, dy: number): void
}
Description
Sets the last point of the path.
transform
Signature
declare class Path {
transform(matrix: Matrix): void
}
Description
Transform the points in this path by matrix.
transform
Signature
declare class Path {
transform(matrix: Matrix, dst: Path): void
}
Description
Transform the points in this path by matrix, and write the answer into dst.
quadTo
Signature
declare class Path {
quadTo(x1: number, y1: number, x2: number, y2: number): void
}
Description
Add a quadratic bezier from the last point, approaching control point (x1,y1), and ending at (x2,y2).
rQuadTo
Signature
declare class Path {
rQuadTo(dx1: number, dy1: number, dx2: number, dy2: number): void
}
Description
Same as quadTo, but the coordinates are considered relative to the last point on this contour.
reWind
Signature
declare class Path {
reWind(): void
}
Description
Rewinds the path: clears any lines and curves from the path but keeps the internal data structure for faster reuse.
reset
Signature
declare class Path {
reset(): void
}
Description
Clear any lines and curves from the path, making it empty.
isEmpty
Signature
declare class Path {
isEmpty(): boolean
}
Description
Returns true if the path is empty (contains no lines or curves).
isRect
Signature
declare class Path {
isRect(rect: Rect): boolean
}
Description
Returns true if the path specifies a rectangle.
close
Signature
declare class Path {
close(): void
}
Description
Close the current contour.
moveTo
Signature
declare class Path {
moveTo(x: number, y: number): void
}
Description
Set the beginning of the next contour to the point (x,y).
rMoveTo
Signature
declare class Path {
rMoveTo(dx: number, dy: number): void
}
Description
Set the beginning of the next contour relative to the last point on the previous contour.
lineTo
Signature
declare class Path {
lineTo(x: number, y: number): void
}
Description
Add a line from the last point to the specified point (x,y).
rLineTo
Signature
declare class Path {
rLineTo(dx: number, dy: number): void
}
Description
Same as lineTo, but the coordinates are considered relative to the last point on this contour.
cubicTo
Signature
declare class Path {
cubicTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void
}
Description
Add a cubic bezier from the last point, approaching control points (x1,y1) and (x2,y2), and ending at (x3,y3).
rCubicTo
Signature
declare class Path {
rCubicTo(x1: number, y1: number, x2: number, y2: number, x3: number, y3: number): void
}
Description
Same as cubicTo, but the coordinates are considered relative to the current point on this contour.
Path.Direction
Direction
enum Direction {
CW, CCW
}
Static Property
CW
Type
declare enum Direction {
CW
}
Description
clockwise.
CCW
Type
declare enum Direction {
CCW
}
Description
counter-clockwise.
Path.FillType
FillType
enum Direction {
WINDING, EVEN_ODD, INVERSE_WINDING, INVERSE_EVEN_ODD
}
Static Property
WINDING
Type
declare enum FillType {
WINDING
}
Description
Specifies that "inside" is computed by a non-zero sum of signed edge crossings.
EVEN_ODD
Type
declare enum FillType {
EVEN_ODD
}
Description
Specifies that "inside" is computed by an odd number of edge crossings.
INVERSE_WINDING
Type
declare enum FillType {
INVERSE_WINDING
}
Description
Same asWINDING
, but draws outside of the path, rather than inside.
INVERSE_EVEN_ODD
Type
declare enum FillType {
INVERSE_EVEN_ODD
}
Description
Same asEVEN_ODD
, but draws outside of the path, rather than inside.