@DOMObjectAttribute @DOMNameAttribute(name="Path2D") public class Path2D extends DOMObject implements ICanvasPathMethods, com.aspose.html.internal.ms.System.IDisposable
The Path2D interface of the Canvas 2D API is used to declare paths that are then later used on CanvasRenderingContext2D objects. The path methods of the CanvasRenderingContext2D interface are present on this interface as well and are allowing you to create paths that you can retain and replay as required on a canvas.
PropertyChanged
Constructor and Description |
---|
Path2D()
returns a newly instantiated Path2D object
|
Path2D(Path2D path)
returns a newly instantiated Path2D object with another path as an argument (creates a copy)
|
Path2D(String d)
returns a newly instantiated Path2D object with a string consisting of SVG path data.
|
Modifier and Type | Method and Description |
---|---|
void |
addPath(Path2D path,
SVGMatrix transformation)
Adds to the path the path given by the argument.
|
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 |
dispose()
Disposes object.
|
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).
|
com.aspose.html.internal.ms.System.Drawing.Drawing2D.GraphicsPath |
getPath() |
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.
|
fireNotifyPropertyChanged, getCurrentValues, getRuntimesBinding, setCurrentValues, setField, setRuntimesBinding
public Path2D()
returns a newly instantiated Path2D object
public Path2D(Path2D path)
returns a newly instantiated Path2D object with another path as an argument (creates a copy)
path
- When invoked with another Path2D object, a copy of the path argument is createdpublic Path2D(String d)
returns a newly instantiated Path2D object with a string consisting of SVG path data.
d
- The string consisting of SVG path datapublic com.aspose.html.internal.ms.System.Drawing.Drawing2D.GraphicsPath getPath()
@DOMNameAttribute(name="addPath") public void addPath(Path2D path, @DOMParameterAttribute(name="transformation",optional=true) SVGMatrix transformation)
Adds to the path the path given by the argument.
path
- A Path2D path to add.transformation
- An SVGMatrix to be used as the transformation matrix for the path that is added.public 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.
closePath
in interface ICanvasPathMethods
public void moveTo(double x, double y)
Moves the starting point of a new sub-path to the (x, y) coordinates.
moveTo
in interface ICanvasPathMethods
x
- The x axis of the pointy
- The y axis of the pointpublic void lineTo(double x, double y)
Connects the last point in the subpath to the x, y coordinates with a straight line.
lineTo
in interface ICanvasPathMethods
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.public void quadraticCurveTo(double cpx, double cpy, double x, double y)
Adds a quadratic Bézier curve to the current path.
quadraticCurveTo
in interface ICanvasPathMethods
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.public 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.
bezierCurveTo
in interface ICanvasPathMethods
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.public 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.
arcTo
in interface ICanvasPathMethods
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.public 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.
rect
in interface ICanvasPathMethods
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.public 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).
arc
in interface ICanvasPathMethods
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.public void arc(double x, double y, double radius, double startAngle, double endAngle, @DOMParameterAttribute(name="counterclockwise",optional=true) 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).
arc
in interface ICanvasPathMethods
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.public 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).
ellipse
in interface ICanvasPathMethods
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.public 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).
ellipse
in interface ICanvasPathMethods
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.public void dispose()
Disposes object.
dispose
in interface com.aspose.html.internal.ms.System.IDisposable