public class Stroke extends Object
Graphics#setStroke
,
Graphics#getStroke
Modifier and Type | Field and Description |
---|---|
static int |
CAP_BUTT
Cap style constant to cap strokes with a butt (or flat).
|
static int |
CAP_ROUND
Cap style constant to cap strokes with a round end.
|
static int |
CAP_SQUARE
Cap style constant to cap strokes with a square end.
|
static int |
JOIN_BEVEL
Join style constant to join strokes bevel.
|
static int |
JOIN_MITER
Join style constant to join strokes MITER (i.e.
|
static int |
JOIN_ROUND
Join style constant to join strokes rounded.
|
Constructor and Description |
---|
Stroke()
Creates a stroke with default settings.
|
Stroke(float lineWidth,
int capStyle,
int joinStyle,
float miterLimit)
Creates a stroke with the specified characteristics.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
int |
getCapStyle()
Gets the cap style of the stroke.
|
int |
getJoinStyle()
Returns the join style used for this stroke.
|
float |
getLineWidth()
Returns the line width of the stroke.
|
float |
getMiterLimit()
Gets the miter limit of the stroke.
|
int |
hashCode()
Returns a hash code value for the object.
|
void |
setCapStyle(int capStyle)
Gets the cap style of the stroke.
|
void |
setJoinStyle(int joinStyle)
Sets the join style of the stroke.
|
void |
setLineWidth(float lineWidth)
Sets the line width of the stroke.
|
void |
setMiterLimit(float miterLimit)
Sets the miter limit of the stroke.
|
void |
setStroke(Stroke stroke)
Copies the properties of
stroke into this stroke. |
String |
toString()
Returns a string representation of the object.
|
public static final int JOIN_MITER
setJoinStyle(int)
,
getJoinStyle()
,
Constant Field Valuespublic static final int JOIN_ROUND
setJoinStyle(int)
,
getJoinStyle()
,
Constant Field Valuespublic static final int JOIN_BEVEL
setJoinStyle(int)
,
getJoinStyle()
,
Constant Field Valuespublic static final int CAP_BUTT
setCapStyle(int)
,
getCapStyle()
,
Constant Field Valuespublic static final int CAP_ROUND
setCapStyle(int)
,
getCapStyle()
,
Constant Field Valuespublic static final int CAP_SQUARE
setCapStyle(int)
,
getCapStyle()
,
Constant Field Valuespublic Stroke(float lineWidth, int capStyle, int joinStyle, float miterLimit)
lineWidth
- The width of the stroke pixels.capStyle
- The cap style of the stroke. Should be one of CAP_BUTT
, CAP_ROUND
, or CAP_SQUARE
.joinStyle
- The join style of the strokes. Should be one of JOIN_MITER
, JOIN_ROUND
, or JOIN_BEVEL
.miterLimit
- The Miter limit controls the point at which a Miter join automatically is converted to a Bevel join. If the distance from the inner intersection point to the tip of the triangle measured in stroke widths is more than the Miter limit, the join will be drawn in the Bevel style.public Stroke()
Join style | JOIN_MITER |
Cap style | CAP_BUTT |
Line Width | 1.0 |
Miter Limit | 4.0 |
public void setStroke(Stroke stroke)
stroke
into this stroke.stroke
- The stroke whose properties we wish to copy into the current stroke.public int getJoinStyle()
JOIN_MITER
,
JOIN_ROUND
, and JOIN_BEVEL
.JOIN_MITER
,
JOIN_BEVEL
,
JOIN_ROUND
public void setJoinStyle(int joinStyle)
joinStyle
- the joinStyle to set. This should be one of JOIN_MITER
,
JOIN_ROUND
, and JOIN_BEVEL
.JOIN_MITER
,
JOIN_BEVEL
,
JOIN_ROUND
public int getCapStyle()
CAP_BUTT
, CAP_ROUND
, and CAP_SQUARE
.CAP_BUTT
,
CAP_SQUARE
,
CAP_ROUND
public void setCapStyle(int capStyle)
capStyle
- the capStyle to set. This will be one of CAP_BUTT
, CAP_ROUND
, and CAP_SQUARE
.CAP_BUTT
,
CAP_SQUARE
,
CAP_ROUND
public float getLineWidth()
public void setLineWidth(float lineWidth)
lineWidth
- the lineWidth to setpublic float getMiterLimit()
public void setMiterLimit(float miterLimit)
miterLimit
- the miterLimit to setpublic boolean equals(Object obj)
Object
public String toString()
Object
public int hashCode()
Object