public class IlvStrokedPathDecoration extends IlvClippedPathDecoration implements IlvPersistentObject
BasicStroke
as base stroke.
The stroke is defined using the same parameters as
java.awt.BasicStroke
. This stroke can be either filled,
stroked, or both.
A zoomable IlvStrokedPathDecoration
behaves like a
java.awt.BasicStroke
that is clipped to the visible part
of the shape it strokes.IlvStrokedPathDecoration
has its width
and dash always at a specified pixel size.IlvClippedPathDecoration
,
IlvPathDecoration
,
Serialized FormConstructor and Description |
---|
IlvStrokedPathDecoration(double width,
double flatness,
boolean zoomable)
Constructs a new
IlvStrokedPathDecoration with the
specified flattening factor, the default BasicStroke.CAP_SQUARE cap style,
the default BasicStroke.JOIN_MITER join style, the default
miter limit of 10.0 and no dash. |
IlvStrokedPathDecoration(double width,
int cap,
int join,
double miterlimit,
double[] dash,
double dash_offset,
double flatness,
boolean zoomable)
Constructs a new
IlvStrokedPathDecoration with the
specified flattening factor. |
IlvStrokedPathDecoration(IlvInputStream stream)
Reads an
IlvStrokedPathDecoration from the specified input stream. |
Modifier and Type | Method and Description |
---|---|
IlvRect |
boundingBox(Shape shape,
IlvRect r,
IlvTransformer t)
Returns the bounding box of the specified shape, if it is decorated
using this decoration.
|
void |
draw(Graphics2D graphics,
Shape subshape,
double phase,
IlvTransformer t)
Draws the decoration for the specified shape in the specified
graphics.
|
double |
equivalentWidth(IlvTransformer t)
Returns an equivalent line width to this path decoration,
if it is drawn using the specified transformer.
|
int |
getCap()
Returns the line cap of this stroke.
|
double[] |
getDash()
Returns the dash of this stroke, or
null if this stroke is not
dashed. |
double |
getDashOffset()
Returns the dash offset of dashes used by this stroke.
|
int |
getJoin()
Returns the line join of this stroke.
|
double |
getMiterLimit()
Returns the miter limit of this stroke, if join style is
BasicStroke.JOIN_MITER . |
double |
getWidth()
Returns the width of this stroke.
|
boolean |
isZoomable()
Returns
true if this path decoration is zoomable. |
void |
setZoomable(boolean zoomable)
Indicates whether the line width of the decoration should be zoomable
|
void |
write(IlvOutputStream stream)
Writes this stroked path decoration to the specified stream.
|
draw, getFlatness
public IlvStrokedPathDecoration(double width, double flatness, boolean zoomable)
IlvStrokedPathDecoration
with the
specified flattening factor, the default BasicStroke.CAP_SQUARE
cap style,
the default BasicStroke.JOIN_MITER
join style, the default
miter limit of 10.0 and no dash.width
- The width of this stroke.flatness
- The flatness used when drawing the stroke.zoomable
- If true
, this stroke is zoomable.public IlvStrokedPathDecoration(double width, int cap, int join, double miterlimit, double[] dash, double dash_offset, double flatness, boolean zoomable)
IlvStrokedPathDecoration
with the
specified flattening factor.width
- The width of this stroke.cap
- The decoration of the ends of this stroke.
Valid values are java.awt.BasicStroke.CAP_BUTT
,
java.awt.BasicStroke.CAP_ROUND
and
java.awt.BasicStroke.CAP_SQUARE
.join
- The decoration applied where path segments meet.
Valid values are java.awt.BasicStroke.JOIN_BEVEL
,
java.awt.BasicStroke.JOIN_MITER
and
java.awt.BasicStroke.JOIN_ROUND
.miterlimit
- The limit to trim the miter join.dash
- The array representing the dashing pattern.dash_offset
- The offset to start the dashing pattern.flatness
- The flatness used when drawing the stroke.zoomable
- If true
, this stroke is zoomable.public IlvStrokedPathDecoration(IlvInputStream stream) throws IlvReadFileException
IlvStrokedPathDecoration
from the specified input stream.stream
- The IlvInputStream
to read from.IlvReadFileException
- If an error occurs while reading
a stroked path from the specified stream.public void write(IlvOutputStream stream) throws IOException
write
in interface IlvPersistentObject
write
in class IlvClippedPathDecoration
stream
- The IlvInputStream
to write to.IOException
- If an error occurs while writing this path
decoration to the stream.public void draw(Graphics2D graphics, Shape subshape, double phase, IlvTransformer t)
draw
in class IlvClippedPathDecoration
graphics
- The Graphics2D
to draw in.subshape
- The Shape
to draw.phase
- The phase to draw this decoration.t
- The viewing transformer.public double equivalentWidth(IlvTransformer t)
equivalentWidth
in interface IlvPathDecoration
t
- The transformer to compute the equivalent width.public IlvRect boundingBox(Shape shape, IlvRect r, IlvTransformer t)
r
is non null, the result is put in r
and
returned, otherwise the result is returned in a newly allocated
IlvRect
.boundingBox
in interface IlvPathDecoration
boundingBox
in class IlvClippedPathDecoration
shape
- The shape which bounding box is to be computed.r
- The IlvRect
that will contain the result.t
- The transformer for this bounding box.public boolean isZoomable()
true
if this path decoration is zoomable.isZoomable
in interface IlvPathDecoration
public void setZoomable(boolean zoomable)
zoomable
- if true
, the line width will be adapted according to the transfromer zoom factor.public double getWidth()
public int getCap()
public int getJoin()
public double getMiterLimit()
BasicStroke.JOIN_MITER
.public double[] getDash()
null
if this stroke is not
dashed.public double getDashOffset()
© Copyright Rogue Wave Software, Inc. 1997, 2018. All Rights Reserved.