Graphics
class is the abstract base class for all graphics contexts that allow an application to draw onto components that are realized on various devices, as well as onto off-screen images. A Graphics
object encapsulates state information needed for the basic rendering operations that Java supports. This state information includes the following properties:
Component
object on which to draw. Coordinates are infinitely thin and lie between the pixels of the output device. Operations that draw the outline of a figure operate by traversing an infinitely thin path between pixels with a pixel-sized pen that hangs down and to the right of the anchor point on the path. Operations that fill a figure operate by filling the interior of that infinitely thin path. Operations that render horizontal text render the ascending portion of character glyphs entirely above the baseline coordinate.
The graphics pen hangs down and to the right from the path it traverses. This has the following implications:
All coordinates that appear as arguments to the methods of this Graphics
object are considered relative to the translation origin of this Graphics
object prior to the invocation of the method.
All rendering operations modify only pixels which lie within the area bounded by the current clip, which is specified by a {@link Shape} in user space and is controlled by the program using the Graphics
object. This user clip is transformed into device space and combined with the device clip, which is defined by the visibility of windows and device extents. The combination of the user clip and device clip defines the composite clip, which determines the final clipping region. The user clip cannot be modified by the rendering system to reflect the resulting composite clip. The user clip can only be changed through the setClip
or clipRect
methods. All drawing or writing is done in the current color, using the current paint mode, and in the current font.
@version 1.74, 02/14/06
@author Sami Shaio
@author Arthur van Hoff
@see java.awt.Component
@see java.awt.Graphics#clipRect(int,int,int,int)
@see java.awt.Graphics#setColor(java.awt.Color)
@see java.awt.Graphics#setPaintMode()
@see java.awt.Graphics#setXORMode(java.awt.Color)
@see java.awt.Graphics#setFont(java.awt.Font)
@since JDK1.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|