All Packages Class Hierarchy This Package Previous Next Index
Class java.awt.BasicStroke
java.lang.Object
|
+----java.awt.BasicStroke
- public class BasicStroke
- extends Object
- implements Stroke
Defines a basic set of rendering attributes for stroked graphics
primitives.
These attributes describe the shape of a pen drawn along the
trajectory of the path and the decorations applied where path
segments are joined and where they begin and end.
These attributes include:
- width
- The width of the pen measured perpendicular to its trajectory.
- end caps
- The decoration of the path where line segments begin and end.
- line joins
- The decoration of the path between connected line segments.
- dash attributes
- The definition of how to make a dash pattern along the
trajectory of the path by creating new segments which alternate
between opaque and transparent sections.
CAP_BUTT- End unclosed subpaths and dash segments with no added
decoration.
CAP_ROUND- End unclosed subpaths and dash segments with a round
decoration with radius equal to half of the line width.
CAP_SQUARE- End 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.
JOIN_BEVEL- Join line segments by connecting the outer corners of their
wide outlines with a straight segment.
JOIN_MITER- Join line segments by extending their outside edges until
they meet.
JOIN_ROUND- Join line segments by rounding off the corner at a radius
of half the line width.
BasicStroke()
- Construct a new stroke with defaults for all attributes.
BasicStroke(float, int, int)
- Construct a new stroke with the specified attributes, but
no dashing.
BasicStroke(float, int, int, float)
- Construct a new stroke with the specified attributes, but
no dashing.
BasicStroke(float, int, int, float, float[], float)
- Construct a new stroke with the specified attributes.
createStrokedShape(Shape)
- Returns a shape whose interior defines the stroked outline of
a given shape.
equals(Object)
- Compares two Objects for equality.
getDashArray()
- Return the array representing the lengths of the dash segments.
getDashPhase()
- Returns the dash phase.
getEndCap()
- Returns the end cap style.
getLineJoin()
- Returns the line join style.
getLineWidth()
- Returns the line width.
getMiterLimit()
- Returns the limit of miter joins.
JOIN_MITER
public static final int JOIN_MITER
- Join line segments by extending their outside edges until
they meet.
JOIN_ROUND
public static final int JOIN_ROUND
- Join line segments by rounding off the corner at a radius
of half the line width.
JOIN_BEVEL
public static final int JOIN_BEVEL
- Join line segments by connecting the outer corners of their
wide outlines with a straight segment.
CAP_BUTT
public static final int CAP_BUTT
- End unclosed subpaths and dash segments with no added
decoration.
CAP_ROUND
public static final int CAP_ROUND
- End unclosed subpaths and dash segments with a round
decoration with radius equal to half of the line width.
CAP_SQUARE
public static final int CAP_SQUARE
- End 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.
BasicStroke
public BasicStroke(float width,
int cap,
int join,
float miterlimit,
float[] dash,
float dash_phase)
- Construct a new stroke with the specified attributes.
- Parameters:
- width - The width of the stroke.
- cap - The style of the ends of a stroke.
- join - The style to join strokes together.
- miterlimit - The limit to trim the miter join.
- dash - The array representing the dashing pattern.
- dash_phase - The offset to start the dashing pattern.
BasicStroke
public BasicStroke(float width,
int cap,
int join,
float miterlimit)
- Construct a new stroke with the specified attributes, but
no dashing.
- Parameters:
- width - The width of the stroke.
- cap - The style of the ends of a stroke.
- join - The style to join strokes together.
- miterlimit - The limit to trim the miter join.
BasicStroke
public BasicStroke(float width,
int cap,
int join)
- Construct a new stroke with the specified attributes, but
no dashing. The miter limit 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 stroke.
- cap - The style of the ends of a stroke.
- join - The style to join strokes together.
BasicStroke
public BasicStroke()
- Construct a new stroke with defaults for all attributes.
The default attributes are a line width of 1.0, CAP_SQUARE,
JOIN_MITER, a miter limit of 10.0, and no dashing.
createStrokedShape
public Shape createStrokedShape(Shape s)
- Returns a shape whose interior defines the stroked outline of
a given shape.
- Parameters:
- s - The shape whose boundary should be stroked.
- Returns:
- The shape of the stroked outline.
- See Also:
- createStrokedShape
getLineWidth
public float getLineWidth()
- Returns the line width. Line width is represented in user space.
- Returns:
- The line width of the stroke.
getEndCap
public int getEndCap()
- Returns the end cap style.
- Returns:
- The end cap style of the stroke.
getLineJoin
public int getLineJoin()
- Returns the line join style.
- Returns:
- The line join style of the stroke.
getMiterLimit
public float getMiterLimit()
- Returns the limit of miter joins.
- Returns:
- The limit of miter joins.
getDashArray
public float[] getDashArray()
- Return 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 path to be stroked, the user space
distance that the pen travels will be accumulated to index
into the dash array.
The pen will be opaque when its current cumulative distance maps
to an odd element of the dash array and transparent otherwise.
- Returns:
- The dash array.
getDashPhase
public float getDashPhase()
- Returns the dash phase.
The dash phase is a user space distance that is used to initialize
the path distance accumulation variable before the first segment
of the first subpath is stroked.
- Returns:
- the dash phase.
equals
public boolean equals(Object obj)
- Compares two Objects for equality.
- Overrides:
- equals in class Object
All Packages Class Hierarchy This Package Previous Next Index
Submit a bug or feature