Java Reference
In-Depth Information
Transformation : Before being stroked and filled, graphics primitives are geo-
metrically transformed. They may be rotated, translated (moved), scaled
(stretched), or otherwise manipulated. The transformation attribute converts
maps 72 user space coordinates to one inch on the output device.
Composite rule : Graphics2D combines graphics primitive colors with the
drawing surface's existing colors byusingacomposite rule, which determines
the manner in which the combining occurs.
Clipping shape : Graphics2D restrictsitsrenderingoperationstotheinterior
of a clipping shape; pixels outside of this shape are not affected. The clipping
shape defaults to the entire drawing surface.
Rendering hints : Graphics2D recognizesvariousrenderinghintsthatcanbe
specifiedtocontrolrendering.Forexample,youcanspecify antialiasing tore-
move the jagged edges that often surround shapes (e.g., lines) and text.
Graphics primitives enter this pipeline via various Graphics methods (e.g.,
drawLine() and fillOval() ) and the following Graphics2D methods:
void fill(Shape s) fillsashape'sinteriorwiththecurrentpaint.Shapes
implement the Shape interface.
void draw(Shape s) draws a shape's outline with the current paint.
• The drawstring() methodsdrawtextviacharactershapeswiththecurrent
• The drawImage() methods draw images.
Note Althoughyoucancall Graphics methodstodrawshapes,thesemethodsare
limited in that they only accept integer coordinates. Furthermore, these shapes (apart
from polygon-based shapes) are not reusable. Regarding polygonal shapes, they can
only consist of straight line-segments. In contrast, Java 2D's Shape classes, which I
briefly introduce later in this chapter don't have these limitations.
Figure 7-16 conceptualizes the rendering pipeline into separate operations. Opera-
tions could be combined in a particular implementation.
Search WWH ::

Custom Search