|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--java.awt.BasicStroke
The BasicStroke class defines a basic set of rendering
attributes for the outlines of graphics primitives.
These attributes describe the shape of the mark made by a pen drawn along
the outline of a Shape object and the decorations applied at
the ends and joins of path segments of the Shape object.
These attributes include:
| Field Summary | |
static int |
CAP_BUTT
Ends unclosed subpaths and dash segments with no added decoration. |
static int |
CAP_ROUND
Ends unclosed subpaths and dash segments with a round decoration that has a radius equal to half of the width of the pen. |
static int |
CAP_SQUARE
Ends unclosed subpaths and dash segments with a square projection that extends beyond the end of the segment to a distance equal to half of the line width. |
static int |
JOIN_BEVEL
Joins path segments by connecting the outer corners of their wide outlines with a straight segment. |
static int |
JOIN_MITER
Joins path segments by extending their outside edges until they meet. |
static int |
JOIN_ROUND
Joins path segments by rounding off the corner at a radius of half the line width. |
| Constructor Summary | |
BasicStroke()
Constructs a new BasicStroke with defaults for all
attributes. |
|
BasicStroke(float width)
Constructs a solid BasicStroke with the specified
line width and with default values for the cap and join
styles. |
|
BasicStroke(float width,
int cap,
int join)
Constructs a solid BasicStroke with the specified
attributes. |
|
BasicStroke(float width,
int cap,
int join,
float miterlimit)
Constructs a solid BasicStroke with the specified
attributes. |
|
BasicStroke(float width,
int cap,
int join,
float miterlimit,
float[] dash,
float dash_phase)
Constructs a new BasicStroke with the specified
attributes. |
|
| Method Summary | |
Shape |
createStrokedShape(Shape s)
Returns a Shape whose interior defines the
stroked outline of a specified Shape. |
boolean |
equals(Object obj)
Tests if a specified object is equal to this BasicStroke
by first testing if it is a BasicStroke and then comparing
its width, join, cap, miter limit, dash, and dash phase attributes with
those of this BasicStroke. |
float[] |
getDashArray()
Returns the array representing the lengths of the dash segments. |
float |
getDashPhase()
Returns the current dash phase. |
int |
getEndCap()
Returns the end cap style. |
int |
getLineJoin()
Returns the line join style. |
float |
getLineWidth()
Returns the line width. |
float |
getMiterLimit()
Returns the limit of miter joins. |
int |
hashCode()
Returns the hashcode for this stroke. |
| Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int JOIN_MITER
public static final int JOIN_ROUND
public static final int JOIN_BEVEL
public static final int CAP_BUTT
public static final int CAP_ROUND
public static final int CAP_SQUARE
| Constructor Detail |
public BasicStroke(float width,
int cap,
int join,
float miterlimit,
float[] dash,
float dash_phase)
BasicStroke with the specified
attributes.width - the width of the BasicStrokecap - the decoration of the ends of a BasicStrokejoin - the decoration applied where path segments meetmiterlimit - the limit to trim the miter joindash - the array representing the dashing patterndash_phase - the offset to start the dashing patternIllegalArgumentException - if width is negativeIllegalArgumentException - if cap is not either
CAP_BUTT, CAP_ROUND or CAP_SQUAREIllegalArgumentException - if miterlimit is less
than 1 and join is JOIN_MITERIllegalArgumentException - if join is not
either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITERIllegalArgumentException - if dash_phase
is negative and dash is not nullIllegalArgumentException - if the length of
dash is zeroIllegalArgumentException - if dash lengths are all zero.
public BasicStroke(float width,
int cap,
int join,
float miterlimit)
BasicStroke with the specified
attributes.width - the width of the BasicStrokecap - the decoration of the ends of a BasicStrokejoin - the decoration applied where path segments meetmiterlimit - the limit to trim the miter joinIllegalArgumentException - if width is negativeIllegalArgumentException - if cap is not either
CAP_BUTT, CAP_ROUND or CAP_SQUAREIllegalArgumentException - if miterlimit is less
than 1 and join is JOIN_MITERIllegalArgumentException - if join is not
either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
public BasicStroke(float width,
int cap,
int join)
BasicStroke with the specified
attributes. The miterlimit parameter is
unnecessary in cases where the default is allowable or the
line joins are not specified as JOIN_MITER.width - the width of the BasicStrokecap - the decoration of the ends of a BasicStrokejoin - the decoration applied where path segments meetIllegalArgumentException - if width is negativeIllegalArgumentException - if cap is not either
CAP_BUTT, CAP_ROUND or CAP_SQUAREIllegalArgumentException - if join is not
either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITERpublic BasicStroke(float width)
BasicStroke with the specified
line width and with default values for the cap and join
styles.width - the width of the BasicStrokeIllegalArgumentException - if width is negativepublic BasicStroke()
BasicStroke with defaults for all
attributes.
The default attributes are a solid line of width 1.0, CAP_SQUARE,
JOIN_MITER, a miter limit of 10.0.| Method Detail |
public Shape createStrokedShape(Shape s)
Shape whose interior defines the
stroked outline of a specified Shape.createStrokedShape in interface Strokes - the Shape boundary be strokedShape of the stroked outline.public float getLineWidth()
BasicStroke.public int getEndCap()
BasicStroke as one
of the static int values that define possible end cap
styles.public int getLineJoin()
BasicStroke as one
of the static int values that define possible line
join styles.public float getMiterLimit()
BasicStroke.public float[] getDashArray()
Shape
to be stroked, the user space
distance that the pen travels is accumulated. The distance
value is used to index into the dash array.
The pen is opaque when its current cumulative distance maps
to an even element of the dash array and transparent otherwise.public float getDashPhase()
float value.public int hashCode()
hashCode in class Objectpublic boolean equals(Object obj)
BasicStroke
by first testing if it is a BasicStroke and then comparing
its width, join, cap, miter limit, dash, and dash phase attributes with
those of this BasicStroke.equals in class Objectobj - the specified object to compare to this
BasicStroketrue if the width, join, cap, miter limit, dash, and
dash phase are the same for both objects;
false otherwise.
|
JavaTM 2 Platform Std. Ed. v1.3 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
Java, Java 2D, and JDBC are trademarks or registered trademarks of Sun Microsystems, Inc. in the US and other countries.
Copyright 1993-2000 Sun Microsystems, Inc. 901 San Antonio Road
Palo Alto, California, 94303, U.S.A. All Rights Reserved.