The Java2D API
- The java2D API provides advanced two-dimensional graphics capabilities for programmers
who require detailed and complex graphical manipulations. - The API includes features for processing line art, text and images in packages
- java.awt,
- java.awt.image,
java.awt.color, - java.awt.font,
- java.awt.geom,
- java.awt.print and
java.awt.image.renderable. - The capabilities of the API are far too broad to cover
in this textbook. In this section, we present an overview of several Java2D capabilities. - Drawing with the Java2D API is accomplished with an instance of class
Graphics2D (package java.awt). Class Graphics2D is a subclass of class
Graphics - In fact, the actual object we have used to draw in every paint method is a Graphics2D
object that is passed to method paint and accessed via the superclass Graphics reference
g. - To access the Graphics2D capabilities, we must downcast the Graphics reference
passed to paint to a Graphics2D reference with a statement such as
Graphics2D g2d = ( Graphics2D ) g;
The programs of the next several sections use this technique.
Buy It Now
0 comments:
Post a Comment