
CHAPTER 16
Thejava.awt.geom Package
The java.awt.geom package contains Java 2D classes and interfaces related to shapes
and geometry; the package is new in Java 1.2. Most of the classes in this package
ar e java.awt.Shape implementations that can be drawn and filled by a java.awt.Graph-
ics2D object. Note that some implementations store data using single-precision
floating-point coordinates, while others use double-precision coordinates. Other
important classes include AffineTransfor m, Area, GeneralPath, and PathIterator. Figur e
16-1 shows the class hierarchy of this package.
AffineTransfor m Ja va 1.2
java.awt.geom cloneable serializable
An AffineTransfor m repr esents an arbitrary linear transformation of a point, vector, shape,
or coordinate system by any combination of translation, rotation, scaling, flipping, and
skewing. This is one of the most fundamental classes in Java 2D: the Java 2D rendering
pr ocess uses an AffineTransfor m to convert from user coordinate space to the coordinate
space of the physical device. In addition to this implicit use of AffineTransfor m, the class is
often used explicitly in Java 2D programming.
The transformations specified by AffineTransfor m objects are quite general. But they are
all linear: straight lines remain straight, and parallel lines remain parallel under any
AffineTransfor m. Although it is possible to imagine more general, nonlinear, transfor ma-
tions, ...