Java Reference
In-Depth Information
Chapter 27
Displaying Graphic Images
Vector and Raster Graphics
Twotechnologiesareusedincreatinganddisplayingimagesonthegraph-
icsscreen,theyarecalled vector and rastergraphics .Asthenameimplies,
vectorimagesaredescribedmathematically.Invectorgraphicsastraight
lineisdefinedbythescreenlocationofitsstartandendpoints,whilecir-
clesandellipsesaredefinedbythedimensionandcoordinatesoftherect-
anglethattightlycontainsthefigure.Inotherwords,invectorgraphicsa
complexgraphicalobjectconsistsofthedescriptionsofallthesimpler
componentthatformit.Sincevector-definedobjectsareanumericalex-
pression,theobjectscanbemanipulatedbytransformingthevaluesthat
representit.Thus,vectorimagescanbemoved,scaled,androtatedonthe
screenbyperformingmathematicaloperationsonitsdata.
Rastergraphics,ontheotherhand,consistofimagesdefinedinterms
oftheirindividualscreendots.Thepatternofdotsisarrangedinrows
andcolumns;eachdotusuallyassociatedwithacolorattribute.AWTand
otherJavagraphicspackagessupportbothvectorandrastergraphics.
The frame origin
Beforeyouattempttodrawgraphicsobjectsonthevideodisplayyoumust
considerapeculiarityofJavagraphics.Thereisageometricalissuethat
shouldbeaddressedbeforeweattempttodrawgraphicobjectsonthe
videodisplay. Figure27-1 showsatypicalJavaframe.
Search WWH ::




Custom Search