@DOMObjectAttribute @DOMNoInterfaceObjectAttribute public interface ICanvasPathMethods
The ICanvasPathMethods interface is used to manipulate paths of objects.
Modifier and Type | Method and Description |
---|---|
void |
arc(double x,
double y,
double radius,
double startAngle,
double endAngle)
Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
|
void |
arc(double x,
double y,
double radius,
double startAngle,
double endAngle,
boolean counterclockwise)
Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
|
void |
arcTo(double x1,
double y1,
double x2,
double y2,
double radius)
Adds an arc to the path with the given control points and radius, connected to the previous point by a straight line.
|
void |
bezierCurveTo(double cp1x,
double cp1y,
double cp2x,
double cp2y,
double x,
double y)
Adds a cubic Bézier curve to the path.
|
void |
closePath()
Causes the point of the pen to move back to the start of the current sub-path.
|
void |
ellipse(double x,
double y,
double radiusX,
double radiusY,
double rotation,
double startAngle,
double endAngle)
Adds an ellipse to the path which is centered at (x, y) position with the radii radiusX and radiusY starting at startAngle
and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
|
void |
ellipse(double x,
double y,
double radiusX,
double radiusY,
double rotation,
double startAngle,
double endAngle,
boolean anticlockwise)
Adds an ellipse to the path which is centered at (x, y) position with the radii radiusX and radiusY starting at startAngle
and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
|
void |
lineTo(double x,
double y)
Connects the last point in the subpath to the x, y coordinates with a straight line.
|
void |
moveTo(double x,
double y)
Moves the starting point of a new sub-path to the (x, y) coordinates.
|
void |
quadraticCurveTo(double cpx,
double cpy,
double x,
double y)
Adds a quadratic Bézier curve to the current path.
|
void |
rect(double x,
double y,
double w,
double h)
Creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
|
@DOMNameAttribute(name="closePath") void closePath()
Causes the point of the pen to move back to the start of the current sub-path. It tries to draw a straight line from the current point to the start. If the shape has already been closed or has only one point, this function does nothing.
@DOMNameAttribute(name="moveTo") void moveTo(double x, double y)
Moves the starting point of a new sub-path to the (x, y) coordinates.
x
- The x axis of the pointy
- The y axis of the point@DOMNameAttribute(name="lineTo") void lineTo(double x, double y)
Connects the last point in the subpath to the x, y coordinates with a straight line.
x
- The x axis of the coordinate for the end of the line.y
- The y axis of the coordinate for the end of the line.@DOMNameAttribute(name="quadraticCurveTo") void quadraticCurveTo(double cpx, double cpy, double x, double y)
Adds a quadratic Bézier curve to the current path.
cpx
- The x axis of the coordinate for the control point.cpy
- The y axis of the coordinate for the control point.x
- The x axis of the coordinate for the end point.y
- The y axis of the coordinate for the end point.@DOMNameAttribute(name="bezierCurveTo") void bezierCurveTo(double cp1x, double cp1y, double cp2x, double cp2y, double x, double y)
Adds a cubic Bézier curve to the path. It requires three points. The first two points are control points and the third one is the end point. The starting point is the last point in the current path, which can be changed using moveTo() before creating the Bézier curve.
cp1x
- The x axis of the coordinate for the first control point.cp1y
- The y axis of the coordinate for the first control point.cp2x
- The x axis of the coordinate for the second control point.cp2y
- The y axis of the coordinate for the second control point.x
- The x axis of the coordinate for the end point.y
- The y axis of the coordinate for the end point.@DOMNameAttribute(name="arcTo") void arcTo(double x1, double y1, double x2, double y2, double radius)
Adds an arc to the path with the given control points and radius, connected to the previous point by a straight line.
x1
- x-axis coordinates for the first control point.y1
- y-axis coordinates for the first control point.x2
- x-axis coordinates for the second control point.y2
- y-axis coordinates for the second control point.radius
- The arc's radius.@DOMNameAttribute(name="rect") void rect(double x, double y, double w, double h)
Creates a path for a rectangle at position (x, y) with a size that is determined by width and height.
x
- The x axis of the coordinate for the rectangle starting point.y
- The y axis of the coordinate for the rectangle starting point.w
- The rectangle's width.h
- The rectangle's height.@DOMNameAttribute(name="arc") void arc(double x, double y, double radius, double startAngle, double endAngle)
Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
x
- The x coordinate of the arc's center.y
- The y coordinate of the arc's center.radius
- The arc's radius.startAngle
- The angle at which the arc starts, measured clockwise from the positive x axis and expressed in radians.endAngle
- The angle at which the arc ends, measured clockwise from the positive x axis and expressed in radians.@DOMNameAttribute(name="arc") void arc(double x, double y, double radius, double startAngle, double endAngle, boolean counterclockwise)
Adds an arc to the path which is centered at (x, y) position with radius r starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
x
- The x coordinate of the arc's center.y
- The y coordinate of the arc's center.radius
- The arc's radius.startAngle
- The angle at which the arc starts, measured clockwise from the positive x axis and expressed in radians.endAngle
- The angle at which the arc ends, measured clockwise from the positive x axis and expressed in radians.counterclockwise
- Causes the arc to be drawn counter-clockwise between the two angles. By default it is drawn clockwise.@DOMNameAttribute(name="ellipse") void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle)
Adds an ellipse to the path which is centered at (x, y) position with the radii radiusX and radiusY starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
x
- The x axis of the coordinate for the ellipse's center.y
- The y axis of the coordinate for the ellipse's center.radiusX
- The ellipse's major-axis radius.radiusY
- The ellipse's minor-axis radius.rotation
- The rotation for this ellipse, expressed in radians.startAngle
- The starting point, measured from the x axis, from which it will be drawn, expressed in radians.endAngle
- The end ellipse's angle to which it will be drawn, expressed in radians.@DOMNameAttribute(name="ellipse") void ellipse(double x, double y, double radiusX, double radiusY, double rotation, double startAngle, double endAngle, boolean anticlockwise)
Adds an ellipse to the path which is centered at (x, y) position with the radii radiusX and radiusY starting at startAngle and ending at endAngle going in the given direction by anticlockwise (defaulting to clockwise).
x
- The x axis of the coordinate for the ellipse's center.y
- The y axis of the coordinate for the ellipse's center.radiusX
- The ellipse's major-axis radius.radiusY
- The ellipse's minor-axis radius.rotation
- The rotation for this ellipse, expressed in radians.startAngle
- The starting point, measured from the x axis, from which it will be drawn, expressed in radians.endAngle
- The end ellipse's angle to which it will be drawn, expressed in radians.anticlockwise
- An optional boolean which, if true, draws the ellipse anticlockwise (counter-clockwise), otherwise in a clockwise direction.