Package com.kitfox.svg.pathcmd
Class Arc
- java.lang.Object
-
- com.kitfox.svg.pathcmd.PathCommand
-
- com.kitfox.svg.pathcmd.Arc
-
public class Arc extends PathCommand
This is a little used SVG function, as most editors will save curves as Beziers. To reduce the need to rely on the Batik library, this functionallity is being bypassed for the time being. In the future, it would be nice to extend the GeneralPath command to include the arcTo ability provided by Batik.
-
-
Field Summary
Fields Modifier and Type Field Description boolean
largeArc
float
rx
float
ry
boolean
sweep
float
x
float
xAxisRot
float
y
-
Fields inherited from class com.kitfox.svg.pathcmd.PathCommand
isRelative
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
appendPath(java.awt.geom.GeneralPath path, BuildHistory hist)
void
arcTo(java.awt.geom.GeneralPath path, float rx, float ry, float angle, boolean largeArcFlag, boolean sweepFlag, float x, float y, float x0, float y0)
Adds an elliptical arc, defined by two radii, an angle from the x-axis, a flag to choose the large arc or not, a flag to indicate if we increase or decrease the angles and the final point of the arc.static java.awt.geom.Arc2D
computeArc(double x0, double y0, double rx, double ry, double angle, boolean largeArcFlag, boolean sweepFlag, double x, double y)
This constructs an unrotated Arc2D from the SVG specification of an Elliptical arc.int
getNumKnotsAdded()
java.lang.String
toString()
-
-
-
Method Detail
-
appendPath
public void appendPath(java.awt.geom.GeneralPath path, BuildHistory hist)
- Specified by:
appendPath
in classPathCommand
-
getNumKnotsAdded
public int getNumKnotsAdded()
- Specified by:
getNumKnotsAdded
in classPathCommand
-
arcTo
public void arcTo(java.awt.geom.GeneralPath path, float rx, float ry, float angle, boolean largeArcFlag, boolean sweepFlag, float x, float y, float x0, float y0)
Adds an elliptical arc, defined by two radii, an angle from the x-axis, a flag to choose the large arc or not, a flag to indicate if we increase or decrease the angles and the final point of the arc.- Parameters:
path
- The path that the arc will be appended to.rx
- the x radius of the ellipsery
- the y radius of the ellipseangle
- the angle from the x-axis of the current coordinate system to the x-axis of the ellipse in degrees.largeArcFlag
- the large arc flag. If true the arc spanning less than or equal to 180 degrees is chosen, otherwise the arc spanning greater than 180 degrees is chosensweepFlag
- the sweep flag. If true the line joining center to arc sweeps through decreasing angles otherwise it sweeps through increasing anglesx
- the absolute x coordinate of the final point of the arc.y
- the absolute y coordinate of the final point of the arc.x0
- - The absolute x coordinate of the initial point of the arc.y0
- - The absolute y coordinate of the initial point of the arc.
-
computeArc
public static java.awt.geom.Arc2D computeArc(double x0, double y0, double rx, double ry, double angle, boolean largeArcFlag, boolean sweepFlag, double x, double y)
This constructs an unrotated Arc2D from the SVG specification of an Elliptical arc. To get the final arc you need to apply a rotation transform such as: AffineTransform.getRotateInstance (angle, arc.getX()+arc.getWidth()/2, arc.getY()+arc.getHeight()/2);- Parameters:
x0
- origin of arc in xy0
- origin of arc in yrx
- radius of arc in xry
- radius of arc in yangle
- number of radians in arclargeArcFlag
-sweepFlag
-x
- ending coordinate of arc in xy
- ending coordinate of arc in y- Returns:
- arc shape
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-