public class StrokeLib
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
StrokeLib() |
| Modifier and Type | Method and Description |
|---|---|
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.
|
public static final float[] DOTS
public static final float[] DASHES
public static final float[] LONG_DASHES
public static java.awt.BasicStroke getStroke(float width)
width - the requested stroke widthpublic 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.BasicStrokepublic 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_SQUAREjoin - the requested join type, one of
BasicStroke.JOIN_BEVEL,
BasicStroke.JOIN_MITER, or
BasicStroke.JOIN_ROUNDpublic 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_SQUAREjoin - the requested join type, one of
BasicStroke.JOIN_BEVEL,
BasicStroke.JOIN_MITER, or
BasicStroke.JOIN_ROUNDmiterLimit - 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 patternBasicStrokeprotected 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 strokepublic static int getCacheMissCount()
public static int getCacheLookupCount()
public static void clearCache()