Java Reference
In-Depth Information
Figure 7-20.
Select Font from the Demo menu to view the font demonstration.
Transformation
Graphics2D
containsaninternaltransformationmatrix(transform)forgeometrically
reorientinggraphicsprimitivesduringrendering.Primitivescanbe
translated
(moved),
scaled
(resized), rotated,
sheared
(laterally shifted), or transformed in some other
developer-specified fashion.
The internal transformation matrix is an instance of the
java.awt.geom.AffineTransform
class,whichensuresthatstraightlinesmap
tostraightlinesandparallellinesmaptoparallellines.Theinitialaffinetransformrep-
resentsthe
identity transformation
inwhichnothingchanges(e.g.,norotationsareper-
formed).
Youcan modify this matrix in several ways. Forexample, youcan invoke
Graph-
ics2D
's
void setTransform(AffineTransform Tx)
methodtoreplacethe
currenttransformationmatrixwiththeaffinetransformpassedto
Tx
.Alternatively,you