public class BevelIterator
extends java.lang.Object
BevelIterator class handles the geometry calculations involved in
creating a bevel effect around the edge of a shape. Like a FlatteningPathIterator,
it iterates over a set of line segments that follows the shape's boundary. For each segment
it provides four points, of which the 2nd and 3rd are the endpoints of the current segment,
and the 1st and 4th are the endpoints of the neighboring segments. From these four points
relevant vectors for drawing a bevel are automatically calculated and provided.
Points and vectors are specified by (x,y) coordinates in an array.
PathIterator| Modifier and Type | Field and Description |
|---|---|
float[] |
inset2
a vector pointing inwards from
pt2, bisecting the angle at that point,
scaled to have a length appropriate for a bevel of thickness 1.0 (in other words, lying
on the line that is parallel to the current segment and a distance of 1.0 inwards). |
float[] |
inset3
a vector pointing inwards from
pt3, bisecting the angle at that point,
scaled to have a length appropriate for a bevel of thickness 1.0 (in other words, lying
on the line that is parallel to the current segment and a distance of 1.0 inwards). |
float[] |
perpVec
a unit vector perpendicular to the current segment, pointing outwards
|
float[] |
pt1
the point that comes before the current segment's start-point
|
float[] |
pt2
the start-point of the current segment
|
float[] |
pt3
the end-point of the current segment
|
float[] |
pt4
the point that comes after the current segment's end-point
|
| Constructor and Description |
|---|
BevelIterator(java.awt.Shape area,
double flatness)
Constructs a BevelIterator for a given shape.
|
| Modifier and Type | Method and Description |
|---|---|
float[] |
insetPoint2(float scalar,
float[] f)
Scales the vector
inset2 by the factor scalar and adds it to pt2. |
float[] |
insetPoint3(float scalar,
float[] f)
Scales the vector
inset3 by the factor scalar and adds it to pt3. |
boolean |
isDone()
Returns
true if a call to nextSegment will move to a new segment. |
void |
nextSegment()
Fills in this class's fields with information about the next segment.
|
public float[] pt1
public float[] pt2
public float[] pt3
public float[] pt4
public float[] inset2
pt2, bisecting the angle at that point,
scaled to have a length appropriate for a bevel of thickness 1.0 (in other words, lying
on the line that is parallel to the current segment and a distance of 1.0 inwards).public float[] inset3
pt3, bisecting the angle at that point,
scaled to have a length appropriate for a bevel of thickness 1.0 (in other words, lying
on the line that is parallel to the current segment and a distance of 1.0 inwards).public float[] perpVec
public BevelIterator(java.awt.Shape area,
double flatness)
flatness parameter has
the same meaning as in the constructor of FlatteningPathIterator. The fields of this class
are undefined until nextSegment is first called.area - the region whose boundary is to be beveledflatness - the maximum allowable distance by which the segments can deviate from the actual boundarypublic void nextSegment()
public boolean isDone()
true if a call to nextSegment will move to a new segment.public float[] insetPoint2(float scalar,
float[] f)
inset2 by the factor scalar and adds it to pt2.
The returned point is pt2 inset by an amount appropriate for a bevel of
thickness scalar.scalar - amount to scale inset2 byf - receives the new pointfpublic float[] insetPoint3(float scalar,
float[] f)
inset3 by the factor scalar and adds it to pt3.
The returned point is pt3 inset by an amount appropriate for a bevel of
thickness scalar.scalar - amount to scale inset3 byf - receives the new pointf