
java.awt.geom.FlatteningPathIterator,animplementation of PathIterator that
appr oximates the curved segments in a given path with multiple line segments.
The
flatness argument to getPathIterator() is a measure of how closely these
line segments must approximate the original curve segments, where smaller values
of
flatness imply a better approximation.
Stroking Lines
One of the new graphic attributes defined by Java 2D is the java.awt.Stroke;itis
set with the
setStroke() method of a Graphics2D object. The Stroke attribute is
used by Java 2D whenever it draws a line. Conceptually, the
Stroke describes the
pen or brush that is used to draw the line: it controls all line-drawing attributes,
such as line width and dash pattern. Java 2D defines a single implementation of
the
Stroke inter face, java.awt.BasicStroke, that is suitable for almost all line
drawing needs.
BasicStroke
A BasicStroke object encapsulates several differ ent line drawing attributes: the
line width, the dash pattern, the end cap style for the line, and the join style for
the line. You specify values for these attributes when you call the
BasicStroke()
constructor. BasicStroke objects are immutable, so that they can be safely cached
and shared. This means, however, that they don’t have
set() methods that allow
you to change the attribute values.
The line-width attribute specifies (obviously) the width of the line. This line width
is measured in ...