java.awt
Class BasicStroke

java.lang.Object
  |
  +--java.awt.BasicStroke
All Implemented Interfaces:
Stroke

public class BasicStroke
extends Object
implements Stroke

Safe:


Field Summary
(package private)  int cap
           
static int CAP_BUTT
          Enabled: Ends unclosed subpaths and dash segments with no added decoration.
static int CAP_ROUND
          Enabled: 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
          Enabled: 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.
(package private)  float[] dash
           
(package private)  float dash_phase
           
(package private)  int join
           
static int JOIN_BEVEL
          Enabled: Joins path segments by connecting the outer corners of their wide outlines with a straight segment.
static int JOIN_MITER
          Enabled: Joins path segments by extending their outside edges until they meet.
static int JOIN_ROUND
          Enabled: Joins path segments by rounding off the corner at a radius of half the line width.
(package private)  float miterlimit
           
private static int[] RasterizerCaps
           
private static int[] RasterizerCorners
           
(package private)  float width
           
 
Constructor Summary
BasicStroke()
          Enabled: Constructs a new BasicStroke with defaults for all attributes.
BasicStroke(float width)
          Enabled: 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)
          Enabled: Constructs a solid BasicStroke with the specified attributes.
BasicStroke(float width, int cap, int join, float miterlimit)
          Enabled: Constructs a solid BasicStroke with the specified attributes.
BasicStroke(float width, int cap, int join, float miterlimit, float[] dash, float dash_phase)
          Enabled: Constructs a new BasicStroke with the specified attributes.
 
Method Summary
 Shape createStrokedShape(Shape s)
          Enabled: Returns a Shape whose interior defines the stroked outline of a specified Shape.
 boolean equals(Object obj)
          Suppressed: 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()
          Enabled: Returns the array representing the lengths of the dash segments.
 float getDashPhase()
          Enabled: Returns the current dash phase.
 int getEndCap()
          Enabled: Returns the end cap style.
 int getLineJoin()
          Enabled: Returns the line join style.
 float getLineWidth()
          Enabled: Returns the line width.
 float getMiterLimit()
          Enabled: Returns the limit of miter joins.
 int hashCode()
          Suppressed: Returns the hashcode for this stroke.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

JOIN_MITER

public static final int JOIN_MITER
Enabled: Joins path segments by extending their outside edges until they meet.


JOIN_ROUND

public static final int JOIN_ROUND
Enabled: Joins path segments by rounding off the corner at a radius of half the line width.


JOIN_BEVEL

public static final int JOIN_BEVEL
Enabled: Joins path segments by connecting the outer corners of their wide outlines with a straight segment.


CAP_BUTT

public static final int CAP_BUTT
Enabled: Ends unclosed subpaths and dash segments with no added decoration.


CAP_ROUND

public static final int CAP_ROUND
Enabled: Ends unclosed subpaths and dash segments with a round decoration that has a radius equal to half of the width of the pen.


CAP_SQUARE

public static final int CAP_SQUARE
Enabled: 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.


width

float width

join

int join

cap

int cap

miterlimit

float miterlimit

dash

float[] dash

dash_phase

float dash_phase

RasterizerCaps

private static final int[] RasterizerCaps

RasterizerCorners

private static final int[] RasterizerCorners
Constructor Detail

BasicStroke

public BasicStroke(float width,
                   int cap,
                   int join,
                   float miterlimit,
                   float[] dash,
                   float dash_phase)
Enabled: Constructs a new BasicStroke with the specified attributes.

Parameters:
width - the width of this BasicStroke. The width must be greater than or equal to 0.0f. If width is set to 0.0f, the stroke is rendered as the thinnest possible line for the target device and the antialias hint setting.
cap - the decoration of the ends of a BasicStroke
join - the decoration applied where path segments meet
miterlimit - the limit to trim the miter join. The miterlimit must be greater than or equal to 1.0f.
dash - the array representing the dashing pattern
dash_phase - the offset to start the dashing pattern
Throws:
IllegalArgumentException - if width is negative
IllegalArgumentException - if cap is not either CAP_BUTT, CAP_ROUND or CAP_SQUARE
IllegalArgumentException - if miterlimit is less than 1 and join is JOIN_MITER
IllegalArgumentException - if join is not either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER
IllegalArgumentException - if dash_phase is negative and dash is not null
IllegalArgumentException - if the length of dash is zero
IllegalArgumentException - if dash lengths are all zero.

BasicStroke

public BasicStroke(float width,
                   int cap,
                   int join,
                   float miterlimit)
Enabled: Constructs a solid BasicStroke with the specified attributes.

Parameters:
width - the width of the BasicStroke
cap - the decoration of the ends of a BasicStroke
join - the decoration applied where path segments meet
miterlimit - the limit to trim the miter join
Throws:
IllegalArgumentException - if width is negative
IllegalArgumentException - if cap is not either CAP_BUTT, CAP_ROUND or CAP_SQUARE
IllegalArgumentException - if miterlimit is less than 1 and join is JOIN_MITER
IllegalArgumentException - if join is not either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER

BasicStroke

public BasicStroke(float width,
                   int cap,
                   int join)
Enabled: Constructs a solid 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.

Parameters:
width - the width of the BasicStroke
cap - the decoration of the ends of a BasicStroke
join - the decoration applied where path segments meet
Throws:
IllegalArgumentException - if width is negative
IllegalArgumentException - if cap is not either CAP_BUTT, CAP_ROUND or CAP_SQUARE
IllegalArgumentException - if join is not either JOIN_ROUND, JOIN_BEVEL, or JOIN_MITER

BasicStroke

public BasicStroke(float width)
Enabled: Constructs a solid BasicStroke with the specified line width and with default values for the cap and join styles.

Parameters:
width - the width of the BasicStroke
Throws:
IllegalArgumentException - if width is negative

BasicStroke

public BasicStroke()
Enabled: Constructs a new 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

createStrokedShape

public Shape createStrokedShape(Shape s)
Enabled: Returns a Shape whose interior defines the stroked outline of a specified Shape.

Specified by:
createStrokedShape in interface Stroke
Parameters:
s - the Shape boundary be stroked
Returns:
the Shape of the stroked outline.

getLineWidth

public float getLineWidth()
Enabled: Returns the line width. Line width is represented in user space, which is the default-coordinate space used by Java 2D. See the Graphics2D class comments for more information on the user space coordinate system.

Returns:
the line width of this BasicStroke.
See Also:
Graphics2D

getEndCap

public int getEndCap()
Enabled: Returns the end cap style.

Returns:
the end cap style of this BasicStroke as one of the static int values that define possible end cap styles.

getLineJoin

public int getLineJoin()
Enabled: Returns the line join style.

Returns:
the line join style of the BasicStroke as one of the static int values that define possible line join styles.

getMiterLimit

public float getMiterLimit()
Enabled: Returns the limit of miter joins.

Returns:
the limit of miter joins of the BasicStroke.

getDashArray

public float[] getDashArray()
Enabled: Returns the array representing the lengths of the dash segments. Alternate entries in the array represent the user space lengths of the opaque and transparent segments of the dashes. As the pen moves along the outline of the 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.

Returns:
the dash array.

getDashPhase

public float getDashPhase()
Enabled: Returns the current dash phase. The dash phase is a distance specified in user coordinates that represents an offset into the dashing pattern. In other words, the dash phase defines the point in the dashing pattern that will correspond to the beginning of the stroke.

Returns:
the dash phase as a float value.

hashCode

public int hashCode()
Suppressed: Returns the hashcode for this stroke.

Overrides:
hashCode in class Object
Returns:
a hash code for this stroke.
See Also:
java.lang.Object#equals(java.lang.Object), java.util.Hashtable

equals

public boolean equals(Object obj)
Suppressed: 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.

Overrides:
equals in class Object
Parameters:
obj - the specified object to compare to this BasicStroke
Returns:
true if the width, join, cap, miter limit, dash, and dash phase are the same for both objects; false otherwise.
See Also:
Object.hashCode(), java.util.Hashtable


comments?