Java Reference
In-Depth Information
You can control how the arc is closed using the property
type:ArcType
. Supported arc
types include:
F
ArcType.OPEN
—this is the default type where no segments connect the arc ends
F
ArcType.ROUND
—this type draws a line segment from the start to the center and
from the center to the end of the arc (see previous image)
F
ArcType.CHORD
—a straight line connects the start and end of the arc
Bézier curves
Finally, the Shape API offers two Bézier curve classes: QuadCurve and CubicCurve. The
QuadCurve
class represents a quadratic Bézier curve with control points specified by
properties
controlX
and
controlY
; the curve's endpoints are specified by properties
startX
,
startY
,
endX
, and
endY
(see the figure alongside). The full listing of the code
can be found in
ch02/source-code/src/shapes/QuadCurveShape.fx
.
QuadCurve {
startX: 200.0
startY: 50.0
endX: 200.0
endY: 150.0
controlX: 300.0
controlY: 100.0
}
The
CubicCurve
class represents a cubic Bézier curve with the two control points represented
by properties
controlX1
,
controlY1
,
controlX2
,
controlY2
; the curve's endpoints are
specified by properties
startX
,
startY
,
endX
, and
endY
(see next figure ). The full source can
be found in
ch02/source-code/src/shapes/CubicCurveShape.fx
.
CubicCurve {
startX: 50
startY: 100
endX: 325
endY: 100
controlX1: 100
controlY1: 0
controlX2: 300
controlY2: 200
}
See also
F
Creating complex shapes using Path

















