|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object prefuse.util.StrokeLib
public class StrokeLib
Library maintaining a cache of drawing strokes and other useful stroke computation routines.
Field Summary | |
---|---|
static float[] |
DASHES
Dash pattern for regular uniform dashes |
static float[] |
DOTS
Dash pattern for a dotted line |
static float[] |
LONG_DASHES
Dash pattern for longer uniform dashes |
Constructor Summary | |
---|---|
StrokeLib()
|
Method Summary | |
---|---|
static void |
clearCache()
Clear the Stroke object cache. |
static int |
getCacheLookupCount()
Get the number of cache lookups to the Stroke object cache. |
static int |
getCacheMissCount()
Get the number of cache misses to the Stroke object cache. |
static java.awt.BasicStroke |
getDerivedStroke(java.awt.BasicStroke s,
float width)
Get a stroke with the same properties as the given stroke, but with a modified width value. |
static java.awt.BasicStroke |
getStroke(float width)
Get a square capped, miter joined, non-dashed stroke of the given width. |
static java.awt.BasicStroke |
getStroke(float width,
float[] dashes)
Get a square capped, miter joined, dashed stroke with the given width and dashing attributes. |
static java.awt.BasicStroke |
getStroke(float width,
int cap,
int join)
Get a non-dashed stroke of the given width, cap, and join |
static java.awt.BasicStroke |
getStroke(float width,
int cap,
int join,
float miterLimit,
float[] dashes,
float dashPhase)
Get a dashed stroke of the given width, cap, join, miter limit, and dashing attributes. |
protected static int |
getStrokeKey(float width,
int cap,
int join,
float miterLimit,
float[] dashes,
float dashPhase)
Compute a hash-key for stroke storage and lookup. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final float[] DOTS
public static final float[] DASHES
public static final float[] LONG_DASHES
Constructor Detail |
---|
public StrokeLib()
Method Detail |
---|
public static java.awt.BasicStroke getStroke(float width)
width
- the requested stroke width
public static java.awt.BasicStroke getStroke(float width, float[] dashes)
width
- the requested stroke widthdashes
- an array describing the alternation pattern of
a dashed line. For example [5f, 3f] will create dashes of length 5
with spaces of length 3 between them. A null value indicates no
dashing.
BasicStroke
public static java.awt.BasicStroke getStroke(float width, int cap, int join)
width
- the requested stroke widthcap
- the requested cap type, one of
BasicStroke.CAP_BUTT
,
BasicStroke.CAP_ROUND
, or
BasicStroke.CAP_SQUARE
join
- the requested join type, one of
BasicStroke.JOIN_BEVEL
,
BasicStroke.JOIN_MITER
, or
BasicStroke.JOIN_ROUND
public static java.awt.BasicStroke getStroke(float width, int cap, int join, float miterLimit, float[] dashes, float dashPhase)
width
- the requested stroke widthcap
- the requested cap type, one of
BasicStroke.CAP_BUTT
,
BasicStroke.CAP_ROUND
, or
BasicStroke.CAP_SQUARE
join
- the requested join type, one of
BasicStroke.JOIN_BEVEL
,
BasicStroke.JOIN_MITER
, or
BasicStroke.JOIN_ROUND
miterLimit
- the miter limit at which to bevel miter joinsdashes
- an array describing the alternation pattern of
a dashed line. For example [5f, 3f] will create dashes of length 5
with spaces of length 3 between them. A null value indicates no
dashing.dashPhase
- the phase or offset from which to begin the
dash pattern
BasicStroke
protected static int getStrokeKey(float width, int cap, int join, float miterLimit, float[] dashes, float dashPhase)
public static java.awt.BasicStroke getDerivedStroke(java.awt.BasicStroke s, float width)
s
- the stroke to base the returned stroke onwidth
- the desired width of the derived stroke
public static int getCacheMissCount()
public static int getCacheLookupCount()
public static void clearCache()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |