public final class Dasher extends java.lang.Object implements PathConsumer2D
Dasher
class takes a series of linear commands
(moveTo
, lineTo
, close
and
end
) and breaks them into smaller segments according to a
dash pattern array and a starting dash phase.
Issues: in J2Se, a zero length dash segment as drawn as a very short dash, whereas Pisces does not draw anything. The PostScript semantics are unclear.
Modifier and Type | Class and Description |
---|---|
private static class |
Dasher.LengthIterator |
Modifier and Type | Field and Description |
---|---|
private float[] |
curCurvepts |
private float[] |
dash |
private boolean |
dashOn |
private int |
firstSegidx |
private float[] |
firstSegmentsBuffer |
private int |
idx |
private Dasher.LengthIterator |
li |
(package private) static float |
MAX_CYCLES |
private boolean |
needsMoveTo |
private PathConsumer2D |
out |
private float |
phase |
private boolean |
startDashOn |
private int |
startIdx |
private boolean |
starting |
private float |
startPhase |
private float |
sx |
private float |
sy |
private float |
x0 |
private float |
y0 |
Constructor and Description |
---|
Dasher(PathConsumer2D out) |
Dasher(PathConsumer2D out,
float[] dash,
float phase)
Constructs a
Dasher . |
Modifier and Type | Method and Description |
---|---|
void |
closePath() |
void |
curveTo(float x1,
float y1,
float x2,
float y2,
float x3,
float y3) |
private void |
emitFirstSegments() |
private void |
emitSeg(float[] buf,
int off,
int type) |
private void |
goTo(float[] pts,
int off,
int type) |
void |
lineTo(float x1,
float y1) |
void |
moveTo(float x0,
float y0) |
void |
pathDone() |
private static boolean |
pointCurve(float[] curve,
int type) |
void |
quadTo(float x1,
float y1,
float x2,
float y2) |
void |
reset(float[] dash,
float phase) |
private void |
somethingTo(int type) |
private final PathConsumer2D out
private float[] dash
private float startPhase
private boolean startDashOn
private int startIdx
private boolean starting
private boolean needsMoveTo
private int idx
private boolean dashOn
private float phase
private float sx
private float sy
private float x0
private float y0
private float[] curCurvepts
static float MAX_CYCLES
private float[] firstSegmentsBuffer
private int firstSegidx
private Dasher.LengthIterator li
public Dasher(PathConsumer2D out, float[] dash, float phase)
Dasher
.out
- an output PathConsumer2D
.dash
- an array of float
s containing the dash patternphase
- a float
containing the dash phasepublic Dasher(PathConsumer2D out)
public void reset(float[] dash, float phase)
public void moveTo(float x0, float y0)
moveTo
in interface PathConsumer2D
private void emitSeg(float[] buf, int off, int type)
private void emitFirstSegments()
private void goTo(float[] pts, int off, int type)
public void lineTo(float x1, float y1)
lineTo
in interface PathConsumer2D
private void somethingTo(int type)
private static boolean pointCurve(float[] curve, int type)
public void curveTo(float x1, float y1, float x2, float y2, float x3, float y3)
curveTo
in interface PathConsumer2D
public void quadTo(float x1, float y1, float x2, float y2)
quadTo
in interface PathConsumer2D
public void closePath()
closePath
in interface PathConsumer2D
public void pathDone()
pathDone
in interface PathConsumer2D