jdk/src/share/classes/java/awt/Graphics2D.java
author malenkov
Tue, 29 Oct 2013 17:01:06 +0400
changeset 21278 ef8a3a2a72f2
parent 5506 202f599c92aa
child 21777 c0a423e43b0d
permissions -rw-r--r--
8022746: List of spelling errors in API doc Reviewed-by: alexsch, smarks
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     2
 * Copyright (c) 1996, 2005, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 2
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.awt.RenderingHints.Key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.awt.geom.AffineTransform;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.image.ImageObserver;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.awt.image.BufferedImageOp;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
import java.awt.image.BufferedImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
import java.awt.image.RenderedImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
import java.awt.image.renderable.RenderableImage;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
import java.awt.font.GlyphVector;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
import java.awt.font.FontRenderContext;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
import java.awt.font.TextAttribute;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
import java.text.AttributedCharacterIterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
import java.util.Map;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
 * This <code>Graphics2D</code> class extends the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * {@link Graphics} class to provide more sophisticated
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * control over geometry, coordinate transformations, color management,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * and text layout.  This is the fundamental class for rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * 2-dimensional shapes, text and images on the  Java(tm) platform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * <h2>Coordinate Spaces</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * All coordinates passed to a <code>Graphics2D</code> object are specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * in a device-independent coordinate system called User Space, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 * used by applications.  The <code>Graphics2D</code> object contains
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * an {@link AffineTransform} object as part of its rendering state
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * that defines how to convert coordinates from user space to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * device-dependent coordinates in Device Space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * Coordinates in device space usually refer to individual device pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * and are aligned on the infinitely thin gaps between these pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * Some <code>Graphics2D</code> objects can be used to capture rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * operations for storage into a graphics metafile for playback on a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * concrete device of unknown physical resolution at a later time.  Since
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * the resolution might not be known when the rendering operations are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * captured, the <code>Graphics2D</code> <code>Transform</code> is set up
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * to transform user coordinates to a virtual device space that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * approximates the expected resolution of the target device. Further
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * transformations might need to be applied at playback time if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
 * estimate is incorrect.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * Some of the operations performed by the rendering attribute objects
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * occur in the device space, but all <code>Graphics2D</code> methods take
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * user space coordinates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * Every <code>Graphics2D</code> object is associated with a target that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * defines where rendering takes place. A
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * {@link GraphicsConfiguration} object defines the characteristics
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * of the rendering target, such as pixel format and resolution.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * The same rendering target is used throughout the life of a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * <code>Graphics2D</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * When creating a <code>Graphics2D</code> object,  the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * <code>GraphicsConfiguration</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * specifies the <a name="#deftransform">default transform</a> for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * the target of the <code>Graphics2D</code> (a
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * {@link Component} or {@link Image}).  This default transform maps the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * user space coordinate system to screen and printer device coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * such that the origin maps to the upper left hand corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * target region of the device with increasing X coordinates extending
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * to the right and increasing Y coordinates extending downward.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * The scaling of the default transform is set to identity for those devices
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * that are close to 72 dpi, such as screen devices.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * The scaling of the default transform is set to approximately 72 user
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * space coordinates per square inch for high resolution devices, such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * printers.  For image buffers, the default transform is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 * <code>Identity</code> transform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * <h2>Rendering Process</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * The Rendering Process can be broken down into four phases that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * controlled by the <code>Graphics2D</code> rendering attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * The renderer can optimize many of these steps, either by caching the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * results for future calls, by collapsing multiple virtual steps into
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * a single operation, or by recognizing various attributes as common
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * simple cases that can be eliminated by modifying other parts of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
 * The steps in the rendering process are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
 * <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
 * Determine what to render.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
 * Constrain the rendering operation to the current <code>Clip</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
 * The <code>Clip</code> is specified by a {@link Shape} in user
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
 * space and is controlled by the program using the various clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
 * manipulation methods of <code>Graphics</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
 * <code>Graphics2D</code>.  This <i>user clip</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
 * is transformed into device space by the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
 * <code>Transform</code> and combined with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
 * <i>device clip</i>, which is defined by the visibility of windows and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
 * device extents.  The combination of the user clip and device clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
 * defines the <i>composite clip</i>, which determines the final clipping
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
 * region.  The user clip is not modified by the rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
 * system to reflect the resulting composite clip.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
 * Determine what colors to render.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
 * Apply the colors to the destination drawing surface using the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
 * {@link Composite} attribute in the <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
 * </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
 * <br>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
 * The three types of rendering operations, along with details of each
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
 * of their particular rendering processes are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
 * <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
 * <b><a name="rendershape"><code>Shape</code> operations</a></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
 * <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
 * If the operation is a <code>draw(Shape)</code> operation, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
 * the  {@link Stroke#createStrokedShape(Shape) createStrokedShape}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
 * method on the current {@link Stroke} attribute in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
 * <code>Graphics2D</code> context is used to construct a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
 * <code>Shape</code> object that contains the outline of the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
 * <code>Shape</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
 * The <code>Shape</code> is transformed from user space to device space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
 * using the current <code>Transform</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
 * in the <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
 * The outline of the <code>Shape</code> is extracted using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
 * {@link Shape#getPathIterator(AffineTransform) getPathIterator} method of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
 * <code>Shape</code>, which returns a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
 * {@link java.awt.geom.PathIterator PathIterator}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
 * object that iterates along the boundary of the <code>Shape</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
 * If the <code>Graphics2D</code> object cannot handle the curved segments
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
 * that the <code>PathIterator</code> object returns then it can call the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
 * alternate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
 * {@link Shape#getPathIterator(AffineTransform, double) getPathIterator}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
 * method of <code>Shape</code>, which flattens the <code>Shape</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
 * The current {@link Paint} in the <code>Graphics2D</code> context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
 * is queried for a {@link PaintContext}, which specifies the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
 * colors to render in device space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
 * </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
 * <b><a name=rendertext>Text operations</a></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
 * <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
 * The following steps are used to determine the set of glyphs required
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
 * to render the indicated <code>String</code>:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
 * <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
 * If the argument is a <code>String</code>, then the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
 * <code>Font</code> in the <code>Graphics2D</code> context is asked to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
 * convert the Unicode characters in the <code>String</code> into a set of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
 * glyphs for presentation with whatever basic layout and shaping
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
 * algorithms the font implements.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
 * If the argument is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
 * {@link AttributedCharacterIterator},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
 * the iterator is asked to convert itself to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
 * {@link java.awt.font.TextLayout TextLayout}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
 * using its embedded font attributes. The <code>TextLayout</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
 * implements more sophisticated glyph layout algorithms that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
 * perform Unicode bi-directional layout adjustments automatically
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
 * for multiple fonts of differing writing directions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
  * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
 * If the argument is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
 * {@link GlyphVector}, then the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
 * <code>GlyphVector</code> object already contains the appropriate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
 * font-specific glyph codes with explicit coordinates for the position of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
 * each glyph.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
 * </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
 * The current <code>Font</code> is queried to obtain outlines for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
 * indicated glyphs.  These outlines are treated as shapes in user space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
 * relative to the position of each glyph that was determined in step 1.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
 * The character outlines are filled as indicated above
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
 * under <a href="#rendershape"><code>Shape</code> operations</a>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
 * The current <code>Paint</code> is queried for a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
 * <code>PaintContext</code>, which specifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
 * the colors to render in device space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
 * </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
 * <b><a name= renderingimage><code>Image</code> Operations</a></b>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
 * <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
 * The region of interest is defined by the bounding box of the source
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
 * <code>Image</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
 * This bounding box is specified in Image Space, which is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
 * <code>Image</code> object's local coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
 * If an <code>AffineTransform</code> is passed to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
 * {@link #drawImage(java.awt.Image, java.awt.geom.AffineTransform, java.awt.image.ImageObserver) drawImage(Image, AffineTransform, ImageObserver)},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
 * the <code>AffineTransform</code> is used to transform the bounding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
 * box from image space to user space. If no <code>AffineTransform</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
 * is supplied, the bounding box is treated as if it is already in user space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
 * The bounding box of the source <code>Image</code> is transformed from user
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
 * space into device space using the current <code>Transform</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
 * Note that the result of transforming the bounding box does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
 * necessarily result in a rectangular region in device space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
 * The <code>Image</code> object determines what colors to render,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
 * sampled according to the source to destination
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
 * coordinate mapping specified by the current <code>Transform</code> and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
 * optional image transform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
 * </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
 * </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
 * <h2>Default Rendering Attributes</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
 * The default values for the <code>Graphics2D</code> rendering attributes are:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
 * <dl compact>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
 * <dt><i><code>Paint</code></i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
 * <dd>The color of the <code>Component</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
 * <dt><i><code>Font</code></i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
 * <dd>The <code>Font</code> of the <code>Component</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
 * <dt><i><code>Stroke</code></i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
 * <dd>A square pen with a linewidth of 1, no dashing, miter segment joins
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
 * and square end caps.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
 * <dt><i><code>Transform</code></i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
 * <dd>The
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
 * {@link GraphicsConfiguration#getDefaultTransform() getDefaultTransform}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
 * for the <code>GraphicsConfiguration</code> of the <code>Component</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
 * <dt><i><code>Composite</code></i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
 * <dd>The {@link AlphaComposite#SRC_OVER} rule.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
 * <dt><i><code>Clip</code></i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
 * <dd>No rendering <code>Clip</code>, the output is clipped to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
 * <code>Component</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
 * </dl>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
 * <h2>Rendering Compatibility Issues</h2>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
 * The JDK(tm) 1.1 rendering model is based on a pixelization model
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
 * that specifies that coordinates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
 * are infinitely thin, lying between the pixels.  Drawing operations are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
 * performed using a one-pixel wide pen that fills the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
 * pixel below and to the right of the anchor point on the path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
 * The JDK 1.1 rendering model is consistent with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
 * capabilities of most of the existing class of platform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
 * renderers that need  to resolve integer coordinates to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
 * discrete pen that must fall completely on a specified number of pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
 * The Java 2D(tm) (Java(tm) 2 platform) API supports antialiasing renderers.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
 * A pen with a width of one pixel does not need to fall
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
 * completely on pixel N as opposed to pixel N+1.  The pen can fall
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
 * partially on both pixels. It is not necessary to choose a bias
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
 * direction for a wide pen since the blending that occurs along the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
 * pen traversal edges makes the sub-pixel position of the pen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
 * visible to the user.  On the other hand, when antialiasing is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
 * turned off by setting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
 * {@link RenderingHints#KEY_ANTIALIASING KEY_ANTIALIASING} hint key
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
 * to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
 * {@link RenderingHints#VALUE_ANTIALIAS_OFF VALUE_ANTIALIAS_OFF}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
 * hint value, the renderer might need
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
 * to apply a bias to determine which pixel to modify when the pen
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
 * is straddling a pixel boundary, such as when it is drawn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
 * along an integer coordinate in device space.  While the capabilities
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
 * of an antialiasing renderer make it no longer necessary for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
 * rendering model to specify a bias for the pen, it is desirable for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
 * antialiasing and non-antialiasing renderers to perform similarly for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
 * the common cases of drawing one-pixel wide horizontal and vertical
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
 * lines on the screen.  To ensure that turning on antialiasing by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
 * setting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
 * {@link RenderingHints#KEY_ANTIALIASING KEY_ANTIALIASING} hint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
 * key to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
 * {@link RenderingHints#VALUE_ANTIALIAS_ON VALUE_ANTIALIAS_ON}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
 * does not cause such lines to suddenly become twice as wide and half
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
 * as opaque, it is desirable to have the model specify a path for such
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
 * lines so that they completely cover a particular set of pixels to help
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
 * increase their crispness.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
 * Java 2D API maintains compatibility with JDK 1.1 rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
 * behavior, such that legacy operations and existing renderer
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
 * behavior is unchanged under Java 2D API.  Legacy
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
 * methods that map onto general <code>draw</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
 * <code>fill</code> methods are defined, which clearly indicates
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
 * how <code>Graphics2D</code> extends <code>Graphics</code> based
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
 * on settings of <code>Stroke</code> and <code>Transform</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
 * attributes and rendering hints.  The definition
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
 * performs identically under default attribute settings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
 * For example, the default <code>Stroke</code> is a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
 * <code>BasicStroke</code> with a width of 1 and no dashing and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
 * default Transform for screen drawing is an Identity transform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
 * The following two rules provide predictable rendering behavior whether
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
 * aliasing or antialiasing is being used.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
 * <li> Device coordinates are defined to be between device pixels which
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
   308
 * avoids any inconsistent results between aliased and antialiased
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
 * rendering.  If coordinates were defined to be at a pixel's center, some
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
 * of the pixels covered by a shape, such as a rectangle, would only be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
 * half covered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
 * With aliased rendering, the half covered pixels would either be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
 * rendered inside the shape or outside the shape.  With anti-aliased
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
 * rendering, the pixels on the entire edge of the shape would be half
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
 * covered.  On the other hand, since coordinates are defined to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
 * between pixels, a shape like a rectangle would have no half covered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
 * pixels, whether or not it is rendered using antialiasing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
 * <li> Lines and paths stroked using the <code>BasicStroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
 * object may be "normalized" to provide consistent rendering of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
 * outlines when positioned at various points on the drawable and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
 * whether drawn with aliased or antialiased rendering.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
 * normalization process is controlled by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
 * {@link RenderingHints#KEY_STROKE_CONTROL KEY_STROKE_CONTROL} hint.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
 * The exact normalization algorithm is not specified, but the goals
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
 * of this normalization are to ensure that lines are rendered with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
 * consistent visual appearance regardless of how they fall on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
 * pixel grid and to promote more solid horizontal and vertical
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
 * lines in antialiased mode so that they resemble their non-antialiased
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
 * counterparts more closely.  A typical normalization step might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
 * promote antialiased line endpoints to pixel centers to reduce the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
 * amount of blending or adjust the subpixel positioning of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
 * non-antialiased lines so that the floating point line widths
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
 * round to even or odd pixel counts with equal likelihood.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
 * process can move endpoints by up to half a pixel (usually towards
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
 * positive infinity along both axes) to promote these consistent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
 * results.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
 * The following definitions of general legacy methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
 * perform identically to previously specified behavior under default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
 * attribute settings:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
 * For <code>fill</code> operations, including <code>fillRect</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
 * <code>fillRoundRect</code>, <code>fillOval</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
 * <code>fillArc</code>, <code>fillPolygon</code>, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
 * <code>clearRect</code>, {@link #fill(Shape) fill} can now be called
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
 * with the desired <code>Shape</code>.  For example, when filling a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
 * rectangle:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
 * fill(new Rectangle(x, y, w, h));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
 * is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
 * Similarly, for draw operations, including <code>drawLine</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
 * <code>drawRect</code>, <code>drawRoundRect</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
 * <code>drawOval</code>, <code>drawArc</code>, <code>drawPolyline</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
 * and <code>drawPolygon</code>, {@link #draw(Shape) draw} can now be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
 * called with the desired <code>Shape</code>.  For example, when drawing a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
 * rectangle:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
 * draw(new Rectangle(x, y, w, h));
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
 * is called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
 * The <code>draw3DRect</code> and <code>fill3DRect</code> methods were
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
 * implemented in terms of the <code>drawLine</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
 * <code>fillRect</code> methods in the <code>Graphics</code> class which
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
 * would predicate their behavior upon the current <code>Stroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
 * and <code>Paint</code> objects in a <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
 * This class overrides those implementations with versions that use
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
 * the current <code>Color</code> exclusively, overriding the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
 * <code>Paint</code> and which uses <code>fillRect</code> to describe
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
 * the exact same behavior as the preexisting methods regardless of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
 * setting of the current <code>Stroke</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
 * The <code>Graphics</code> class defines only the <code>setColor</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
 * method to control the color to be painted.  Since the Java 2D API extends
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
 * the <code>Color</code> object to implement the new <code>Paint</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
 * interface, the existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
 * <code>setColor</code> method is now a convenience method for setting the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
 * current <code>Paint</code> attribute to a <code>Color</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
 * <code>setColor(c)</code> is equivalent to <code>setPaint(c)</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
 * The <code>Graphics</code> class defines two methods for controlling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
 * how colors are applied to the destination.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
 * <ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
 * The <code>setPaintMode</code> method is implemented as a convenience
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
 * method to set the default <code>Composite</code>, equivalent to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
 * <code>setComposite(new AlphaComposite.SrcOver)</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
 * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
 * The <code>setXORMode(Color xorcolor)</code> method is implemented
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
 * as a convenience method to set a special <code>Composite</code> object that
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
 * ignores the <code>Alpha</code> components of source colors and sets the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
 * destination color to the value:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
 * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
 * dstpixel = (PixelOf(srccolor) ^ PixelOf(xorcolor) ^ dstpixel);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
 * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
 * </ol>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
 * @author Jim Graham
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
 * @see java.awt.RenderingHints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
public abstract class Graphics2D extends Graphics {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     * Constructs a new <code>Graphics2D</code> object.  Since
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * <code>Graphics2D</code> is an abstract class, and since it must be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * customized by subclasses for different output devices,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * <code>Graphics2D</code> objects cannot be created directly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * Instead, <code>Graphics2D</code> objects must be obtained from another
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     * <code>Graphics2D</code> object, created by a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
     * <code>Component</code>, or obtained from images such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
     * {@link BufferedImage} objects.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
     * @see java.awt.Component#getGraphics
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * @see java.awt.Graphics#create
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    protected Graphics2D() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * Draws a 3-D highlighted outline of the specified rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     * The edges of the rectangle are highlighted so that they
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * appear to be beveled and lit from the upper left corner.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * The colors used for the highlighting effect are determined
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * based on the current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * The resulting rectangle covers an area that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * <code>width&nbsp;+&nbsp;1</code> pixels wide
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     * by <code>height&nbsp;+&nbsp;1</code> pixels tall.  This method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
     * uses the current <code>Color</code> exclusively and ignores
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
     * the current <code>Paint</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
     * @param x the x coordinate of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
     * @param y the y coordinate of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
     * @param width the width of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
     * @param height the height of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
     * @param raised a boolean that determines whether the rectangle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
     *                      appears to be raised above the surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
     *                      or sunk into the surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
     * @see         java.awt.Graphics#fill3DRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
    public void draw3DRect(int x, int y, int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
                           boolean raised) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
        Paint p = getPaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
        Color c = getColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
        Color brighter = c.brighter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
        Color darker = c.darker();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
        setColor(raised ? brighter : darker);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        //drawLine(x, y, x, y + height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        fillRect(x, y, 1, height + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        //drawLine(x + 1, y, x + width - 1, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        fillRect(x + 1, y, width - 1, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
        setColor(raised ? darker : brighter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        //drawLine(x + 1, y + height, x + width, y + height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
        fillRect(x + 1, y + height, width, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        //drawLine(x + width, y, x + width, y + height - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        fillRect(x + width, y, 1, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        setPaint(p);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * Paints a 3-D highlighted rectangle filled with the current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     * The edges of the rectangle are highlighted so that it appears
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
     * as if the edges were beveled and lit from the upper left corner.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
     * The colors used for the highlighting effect and for filling are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
     * determined from the current <code>Color</code>.  This method uses
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * the current <code>Color</code> exclusively and ignores the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * <code>Paint</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * @param x the x coordinate of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * @param y the y coordinate of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * @param       width the width of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * @param       height the height of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * @param       raised a boolean value that determines whether the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     *                      rectangle appears to be raised above the surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     *                      or etched into the surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * @see         java.awt.Graphics#draw3DRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
    public void fill3DRect(int x, int y, int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
                           boolean raised) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
        Paint p = getPaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
        Color c = getColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
        Color brighter = c.brighter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
        Color darker = c.darker();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        if (!raised) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
            setColor(darker);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        } else if (p != c) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
            setColor(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
        fillRect(x+1, y+1, width-2, height-2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
        setColor(raised ? brighter : darker);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
        //drawLine(x, y, x, y + height - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
        fillRect(x, y, 1, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
        //drawLine(x + 1, y, x + width - 2, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
        fillRect(x + 1, y, width - 2, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
        setColor(raised ? darker : brighter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        //drawLine(x + 1, y + height - 1, x + width - 1, y + height - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
        fillRect(x + 1, y + height - 1, width - 1, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
        //drawLine(x + width - 1, y, x + width - 1, y + height - 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
        fillRect(x + width - 1, y, 1, height - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
        setPaint(p);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     * Strokes the outline of a <code>Shape</code> using the settings of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * current <code>Graphics2D</code> context.  The rendering attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * applied include the <code>Clip</code>, <code>Transform</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * <code>Paint</code>, <code>Composite</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * <code>Stroke</code> attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * @param s the <code>Shape</code> to be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * @see #setStroke
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * @see #setPaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * @see java.awt.Graphics#setColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     * @see #transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * @see #clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    public abstract void draw(Shape s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
     * Renders an image, applying a transform from image space into user space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
     * before drawing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
     * The transformation from user space into device space is done with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
     * the current <code>Transform</code> in the <code>Graphics2D</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
     * The specified transformation is applied to the image before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
     * transform attribute in the <code>Graphics2D</code> context is applied.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
     * The rendering attributes applied include the <code>Clip</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
     * <code>Transform</code>, and <code>Composite</code> attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
     * Note that no rendering is done if the specified transform is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
     * noninvertible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
     * @param img the specified image to be rendered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
     *            This method does nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
     * @param xform the transformation from image space into user space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
     * @param obs the {@link ImageObserver}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
     * to be notified as more of the <code>Image</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
     * is converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * @return <code>true</code> if the <code>Image</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     * fully loaded and completely rendered, or if it's null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * <code>false</code> if the <code>Image</code> is still being loaded.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * @see #transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     * @see #clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    public abstract boolean drawImage(Image img,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
                                      AffineTransform xform,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
                                      ImageObserver obs);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
     * Renders a <code>BufferedImage</code> that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
     * filtered with a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
     * {@link BufferedImageOp}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
     * The rendering attributes applied include the <code>Clip</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
     * <code>Transform</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
     * and <code>Composite</code> attributes.  This is equivalent to:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
     * img1 = op.filter(img, null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
     * drawImage(img1, new AffineTransform(1f,0f,0f,1f,x,y), null);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
     * @param op the filter to be applied to the image before rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
     * @param img the specified <code>BufferedImage</code> to be rendered.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
     *            This method does nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
     * @param x the x coordinate of the location in user space where
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
     * the upper left corner of the image is rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
     * @param y the y coordinate of the location in user space where
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
     * the upper left corner of the image is rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
     * @see #transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     * @see #clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    public abstract void drawImage(BufferedImage img,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
                                   BufferedImageOp op,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
                                   int x,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
                                   int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * Renders a {@link RenderedImage},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     * applying a transform from image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     * space into user space before drawing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * The transformation from user space into device space is done with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     * the current <code>Transform</code> in the <code>Graphics2D</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     * The specified transformation is applied to the image before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * transform attribute in the <code>Graphics2D</code> context is applied.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     * The rendering attributes applied include the <code>Clip</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
     * <code>Transform</code>, and <code>Composite</code> attributes. Note
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * that no rendering is done if the specified transform is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * noninvertible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * @param img the image to be rendered. This method does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     *            nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     * @param xform the transformation from image space into user space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     * @see #transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
     * @see #clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
    public abstract void drawRenderedImage(RenderedImage img,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
                                           AffineTransform xform);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     * Renders a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     * {@link RenderableImage},
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     * applying a transform from image space into user space before drawing.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     * The transformation from user space into device space is done with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     * the current <code>Transform</code> in the <code>Graphics2D</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * The specified transformation is applied to the image before the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * transform attribute in the <code>Graphics2D</code> context is applied.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     * The rendering attributes applied include the <code>Clip</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     * <code>Transform</code>, and <code>Composite</code> attributes. Note
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * that no rendering is done if the specified transform is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     * noninvertible.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     *<p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     * Rendering hints set on the <code>Graphics2D</code> object might
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     * be used in rendering the <code>RenderableImage</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * If explicit control is required over specific hints recognized by a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     * specific <code>RenderableImage</code>, or if knowledge of which hints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     * are used is required, then a <code>RenderedImage</code> should be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     * obtained directly from the <code>RenderableImage</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     * and rendered using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     *{@link #drawRenderedImage(RenderedImage, AffineTransform) drawRenderedImage}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     * @param img the image to be rendered. This method does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     *            nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     * @param xform the transformation from image space into user space
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     * @see #transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
     * @see #clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     * @see #drawRenderedImage
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
    public abstract void drawRenderableImage(RenderableImage img,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
                                             AffineTransform xform);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
     * Renders the text of the specified <code>String</code>, using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
     * current text attribute state in the <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
     * The baseline of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
     * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
     * the User Space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     * The rendering attributes applied include the <code>Clip</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     * <code>Transform</code>, <code>Paint</code>, <code>Font</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     * <code>Composite</code> attributes.  For characters in script
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     * systems such as Hebrew and Arabic, the glyphs can be rendered from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     * right to left, in which case the coordinate supplied is the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
     * location of the leftmost character on the baseline.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
     * @param str the string to be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
     * @param x the x coordinate of the location where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     * <code>String</code> should be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     * @param y the y coordinate of the location where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     * <code>String</code> should be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     * @throws NullPointerException if <code>str</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     *         <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
     * @see         java.awt.Graphics#drawBytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     * @see         java.awt.Graphics#drawChars
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     * @since       JDK1.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
    public abstract void drawString(String str, int x, int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     * Renders the text specified by the specified <code>String</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * using the current text attribute state in the <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * The baseline of the first character is at position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * (<i>x</i>,&nbsp;<i>y</i>) in the User Space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     * The rendering attributes applied include the <code>Clip</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     * <code>Transform</code>, <code>Paint</code>, <code>Font</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     * <code>Composite</code> attributes. For characters in script systems
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * such as Hebrew and Arabic, the glyphs can be rendered from right to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     * left, in which case the coordinate supplied is the location of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * leftmost character on the baseline.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     * @param str the <code>String</code> to be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     * @param x the x coordinate of the location where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     * <code>String</code> should be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     * @param y the y coordinate of the location where the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
     * <code>String</code> should be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
     * @throws NullPointerException if <code>str</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
     *         <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
     * @see #setPaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * @see java.awt.Graphics#setColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     * @see java.awt.Graphics#setFont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
    public abstract void drawString(String str, float x, float y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     * Renders the text of the specified iterator applying its attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     * in accordance with the specification of the {@link TextAttribute} class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
     * The baseline of the first character is at position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
     * (<i>x</i>,&nbsp;<i>y</i>) in User Space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
     * For characters in script systems such as Hebrew and Arabic,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
     * the glyphs can be rendered from right to left, in which case the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
     * coordinate supplied is the location of the leftmost character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     * on the baseline.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * @param iterator the iterator whose text is to be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * @param x the x coordinate where the iterator's text is to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * @param y the y coordinate where the iterator's text is to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     * rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * @throws NullPointerException if <code>iterator</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     *         <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * @see #setPaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     * @see java.awt.Graphics#setColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
    public abstract void drawString(AttributedCharacterIterator iterator,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
                                    int x, int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
     * Renders the text of the specified iterator applying its attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
     * in accordance with the specification of the {@link TextAttribute} class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
     * The baseline of the first character is at position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
     * (<i>x</i>,&nbsp;<i>y</i>) in User Space.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * For characters in script systems such as Hebrew and Arabic,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     * the glyphs can be rendered from right to left, in which case the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
     * coordinate supplied is the location of the leftmost character
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
     * on the baseline.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
     * @param iterator the iterator whose text is to be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
     * @param x the x coordinate where the iterator's text is to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
     * rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
     * @param y the y coordinate where the iterator's text is to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
     * rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * @throws NullPointerException if <code>iterator</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     *         <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     * @see #setPaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     * @see java.awt.Graphics#setColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
    public abstract void drawString(AttributedCharacterIterator iterator,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
                                    float x, float y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     * Renders the text of the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     * {@link GlyphVector} using
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * the <code>Graphics2D</code> context's rendering attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     * The rendering attributes applied include the <code>Clip</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     * <code>Transform</code>, <code>Paint</code>, and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     * <code>Composite</code> attributes.  The <code>GlyphVector</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
     * specifies individual glyphs from a {@link Font}.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
     * The <code>GlyphVector</code> can also contain the glyph positions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
     * This is the fastest way to render a set of characters to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
     * screen.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     * @param g the <code>GlyphVector</code> to be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
     * @param x the x position in User Space where the glyphs should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
     * be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     * @param y the y position in User Space where the glyphs should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
     * be rendered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     * @throws NullPointerException if <code>g</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     * @see java.awt.Font#createGlyphVector
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
     * @see java.awt.font.GlyphVector
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
     * @see #setPaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
     * @see java.awt.Graphics#setColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
    public abstract void drawGlyphVector(GlyphVector g, float x, float y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
     * Fills the interior of a <code>Shape</code> using the settings of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
     * <code>Graphics2D</code> context. The rendering attributes applied
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     * include the <code>Clip</code>, <code>Transform</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * <code>Paint</code>, and <code>Composite</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * @param s the <code>Shape</code> to be filled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     * @see #setPaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     * @see java.awt.Graphics#setColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
     * @see #transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
     * @see #clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
    public abstract void fill(Shape s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
     * Checks whether or not the specified <code>Shape</code> intersects
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
     * the specified {@link Rectangle}, which is in device
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
     * space. If <code>onStroke</code> is false, this method checks
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
     * whether or not the interior of the specified <code>Shape</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     * intersects the specified <code>Rectangle</code>.  If
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     * <code>onStroke</code> is <code>true</code>, this method checks
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     * whether or not the <code>Stroke</code> of the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     * <code>Shape</code> outline intersects the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     * <code>Rectangle</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     * The rendering attributes taken into account include the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     * <code>Clip</code>, <code>Transform</code>, and <code>Stroke</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     * attributes.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     * @param rect the area in device space to check for a hit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     * @param s the <code>Shape</code> to check for a hit
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
     * @param onStroke flag used to choose between testing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
     * stroked or the filled shape.  If the flag is <code>true</code>, the
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
   809
     * <code>Stroke</code> outline is tested.  If the flag is
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     * <code>false</code>, the filled <code>Shape</code> is tested.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     * @return <code>true</code> if there is a hit; <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
     * otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     * @see #setStroke
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
     * @see #fill
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     * @see #draw
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
     * @see #transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * @see #clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     * @see #setClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
    public abstract boolean hit(Rectangle rect,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
                                Shape s,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
                                boolean onStroke);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     * Returns the device configuration associated with this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     * <code>Graphics2D</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
     * @return the device configuration of this <code>Graphics2D</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
    public abstract GraphicsConfiguration getDeviceConfiguration();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     * Sets the <code>Composite</code> for the <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * The <code>Composite</code> is used in all drawing methods such as
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * <code>drawImage</code>, <code>drawString</code>, <code>draw</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     * and <code>fill</code>.  It specifies how new pixels are to be combined
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
     * with the existing pixels on the graphics device during the rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
     * process.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
     * <p>If this <code>Graphics2D</code> context is drawing to a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
     * <code>Component</code> on the display screen and the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
     * <code>Composite</code> is a custom object rather than an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     * instance of the <code>AlphaComposite</code> class, and if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * there is a security manager, its <code>checkPermission</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     * method is called with an <code>AWTPermission("readDisplayPixels")</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     * permission.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
     * @throws SecurityException
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
     *         if a custom <code>Composite</code> object is being
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
     *         used to render to the screen and a security manager
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
     *         is set and its <code>checkPermission</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
     *         does not allow the operation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
     * @param comp the <code>Composite</code> object to be used for rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
     * @see java.awt.Graphics#setXORMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
     * @see java.awt.Graphics#setPaintMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
     * @see #getComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
     * @see AlphaComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
     * @see SecurityManager#checkPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
     * @see java.awt.AWTPermission
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
    public abstract void setComposite(Composite comp);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
     * Sets the <code>Paint</code> attribute for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
     * <code>Graphics2D</code> context.  Calling this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
     * with a <code>null</code> <code>Paint</code> object does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
     * not have any effect on the current <code>Paint</code> attribute
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
     * of this <code>Graphics2D</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
     * @param paint the <code>Paint</code> object to be used to generate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     * color during the rendering process, or <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
     * @see java.awt.Graphics#setColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
     * @see #getPaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
     * @see GradientPaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
     * @see TexturePaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
    public abstract void setPaint( Paint paint );
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
     * Sets the <code>Stroke</code> for the <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
     * @param s the <code>Stroke</code> object to be used to stroke a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
     * <code>Shape</code> during the rendering process
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
     * @see BasicStroke
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
     * @see #getStroke
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
    public abstract void setStroke(Stroke s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
     * Sets the value of a single preference for the rendering algorithms.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
     * Hint categories include controls for rendering quality and overall
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
     * time/quality trade-off in the rendering process.  Refer to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
     * <code>RenderingHints</code> class for definitions of some common
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
     * keys and values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
     * @param hintKey the key of the hint to be set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
     * @param hintValue the value indicating preferences for the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
     * hint category.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
     * @see #getRenderingHint(RenderingHints.Key)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
     * @see RenderingHints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
    public abstract void setRenderingHint(Key hintKey, Object hintValue);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
     * Returns the value of a single preference for the rendering algorithms.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     * Hint categories include controls for rendering quality and overall
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
     * time/quality trade-off in the rendering process.  Refer to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
     * <code>RenderingHints</code> class for definitions of some common
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
     * keys and values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
     * @param hintKey the key corresponding to the hint to get.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
     * @return an object representing the value for the specified hint key.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
     * Some of the keys and their associated values are defined in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
     * <code>RenderingHints</code> class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
     * @see RenderingHints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
     * @see #setRenderingHint(RenderingHints.Key, Object)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
    public abstract Object getRenderingHint(Key hintKey);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
     * Replaces the values of all preferences for the rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
     * algorithms with the specified <code>hints</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
     * The existing values for all rendering hints are discarded and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
     * the new set of known hints and values are initialized from the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
     * specified {@link Map} object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
     * Hint categories include controls for rendering quality and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
     * overall time/quality trade-off in the rendering process.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
     * Refer to the <code>RenderingHints</code> class for definitions of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
     * some common keys and values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
     * @param hints the rendering hints to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
     * @see #getRenderingHints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     * @see RenderingHints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
    public abstract void setRenderingHints(Map<?,?> hints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
     * Sets the values of an arbitrary number of preferences for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
     * rendering algorithms.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
     * Only values for the rendering hints that are present in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
     * specified <code>Map</code> object are modified.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
     * All other preferences not present in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
     * object are left unmodified.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
     * Hint categories include controls for rendering quality and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
     * overall time/quality trade-off in the rendering process.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
     * Refer to the <code>RenderingHints</code> class for definitions of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
     * some common keys and values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
     * @param hints the rendering hints to be set
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
     * @see RenderingHints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
    public abstract void addRenderingHints(Map<?,?> hints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     * Gets the preferences for the rendering algorithms.  Hint categories
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
     * include controls for rendering quality and overall time/quality
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
     * trade-off in the rendering process.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
     * Returns all of the hint key/value pairs that were ever specified in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
     * one operation.  Refer to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
     * <code>RenderingHints</code> class for definitions of some common
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
     * keys and values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
     * @return a reference to an instance of <code>RenderingHints</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
     * that contains the current preferences.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
     * @see RenderingHints
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
     * @see #setRenderingHints(Map)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
    public abstract RenderingHints getRenderingHints();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
     * Translates the origin of the <code>Graphics2D</code> context to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
     * point (<i>x</i>,&nbsp;<i>y</i>) in the current coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
     * Modifies the <code>Graphics2D</code> context so that its new origin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
     * corresponds to the point (<i>x</i>,&nbsp;<i>y</i>) in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
     * <code>Graphics2D</code> context's former coordinate system.  All
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
     * coordinates used in subsequent rendering operations on this graphics
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
     * context are relative to this new origin.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
     * @param  x the specified x coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
     * @param  y the specified y coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
     * @since   JDK1.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
    public abstract void translate(int x, int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
     * Concatenates the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
     * <code>Graphics2D</code> <code>Transform</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
     * with a translation transform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
     * Subsequent rendering is translated by the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
     * distance relative to the previous position.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
     * This is equivalent to calling transform(T), where T is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     * <code>AffineTransform</code> represented by the following matrix:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     *          [   1    0    tx  ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     *          [   0    1    ty  ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     *          [   0    0    1   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
     * @param tx the distance to translate along the x-axis
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
     * @param ty the distance to translate along the y-axis
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
    public abstract void translate(double tx, double ty);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
     * Concatenates the current <code>Graphics2D</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * <code>Transform</code> with a rotation transform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     * Subsequent rendering is rotated by the specified radians relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     * to the previous origin.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     * This is equivalent to calling <code>transform(R)</code>, where R is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     * <code>AffineTransform</code> represented by the following matrix:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
     *          [   cos(theta)    -sin(theta)    0   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
     *          [   sin(theta)     cos(theta)    0   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
     *          [       0              0         1   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
     * Rotating with a positive angle theta rotates points on the positive
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
     * x axis toward the positive y axis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
     * @param theta the angle of rotation in radians
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
    public abstract void rotate(double theta);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
     * Concatenates the current <code>Graphics2D</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
     * <code>Transform</code> with a translated rotation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
     * transform.  Subsequent rendering is transformed by a transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
     * which is constructed by translating to the specified location,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
     * rotating by the specified radians, and translating back by the same
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
     * amount as the original translation.  This is equivalent to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
     * following sequence of calls:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
     *          translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
     *          rotate(theta);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
     *          translate(-x, -y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
     * Rotating with a positive angle theta rotates points on the positive
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
     * x axis toward the positive y axis.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
     * @param theta the angle of rotation in radians
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
     * @param x the x coordinate of the origin of the rotation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
     * @param y the y coordinate of the origin of the rotation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
    public abstract void rotate(double theta, double x, double y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
     * Concatenates the current <code>Graphics2D</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
     * <code>Transform</code> with a scaling transformation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
     * Subsequent rendering is resized according to the specified scaling
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
     * factors relative to the previous scaling.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
     * This is equivalent to calling <code>transform(S)</code>, where S is an
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
     * <code>AffineTransform</code> represented by the following matrix:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
     *          [   sx   0    0   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
     *          [   0    sy   0   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
     *          [   0    0    1   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
     * @param sx the amount by which X coordinates in subsequent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
     * rendering operations are multiplied relative to previous
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
     * rendering operations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
     * @param sy the amount by which Y coordinates in subsequent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
     * rendering operations are multiplied relative to previous
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
     * rendering operations.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
    public abstract void scale(double sx, double sy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
     * Concatenates the current <code>Graphics2D</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
     * <code>Transform</code> with a shearing transform.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
     * Subsequent renderings are sheared by the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
     * multiplier relative to the previous position.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
     * This is equivalent to calling <code>transform(SH)</code>, where SH
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
     * is an <code>AffineTransform</code> represented by the following
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
     * matrix:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
     * <pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
     *          [   1   shx   0   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
     *          [  shy   1    0   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
     *          [   0    0    1   ]
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
     * </pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
     * @param shx the multiplier by which coordinates are shifted in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
     * the positive X axis direction as a function of their Y coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
     * @param shy the multiplier by which coordinates are shifted in
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
     * the positive Y axis direction as a function of their X coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
    public abstract void shear(double shx, double shy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
     * Composes an <code>AffineTransform</code> object with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
     * <code>Transform</code> in this <code>Graphics2D</code> according
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
     * to the rule last-specified-first-applied.  If the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
     * <code>Transform</code> is Cx, the result of composition
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
     * with Tx is a new <code>Transform</code> Cx'.  Cx' becomes the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
     * current <code>Transform</code> for this <code>Graphics2D</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
     * Transforming a point p by the updated <code>Transform</code> Cx' is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
     * equivalent to first transforming p by Tx and then transforming
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
     * the result by the original <code>Transform</code> Cx.  In other
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
     * words, Cx'(p) = Cx(Tx(p)).  A copy of the Tx is made, if necessary,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
     * so further modifications to Tx do not affect rendering.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
     * @param Tx the <code>AffineTransform</code> object to be composed with
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
     * the current <code>Transform</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
     * @see AffineTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
    public abstract void transform(AffineTransform Tx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
     * Overwrites the Transform in the <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
     * WARNING: This method should <b>never</b> be used to apply a new
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
     * coordinate transform on top of an existing transform because the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
     * <code>Graphics2D</code> might already have a transform that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
     * needed for other purposes, such as rendering Swing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
     * components or applying a scaling transformation to adjust for the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
     * resolution of a printer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
     * <p>To add a coordinate transform, use the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
     * <code>transform</code>, <code>rotate</code>, <code>scale</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
     * or <code>shear</code> methods.  The <code>setTransform</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
     * method is intended only for restoring the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
     * <code>Graphics2D</code> transform after rendering, as shown in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
     * example:
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
     * <pre><blockquote>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
     * // Get the current transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
     * AffineTransform saveAT = g2.getTransform();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
     * // Perform transformation
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
     * g2d.transform(...);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
     * // Render
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
     * g2d.draw(...);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
     * // Restore original transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
     * g2d.setTransform(saveAT);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
     * </blockquote></pre>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
     * @param Tx the <code>AffineTransform</code> that was retrieved
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
     *           from the <code>getTransform</code> method
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
     * @see #transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
     * @see #getTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
     * @see AffineTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
    public abstract void setTransform(AffineTransform Tx);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
     * Returns a copy of the current <code>Transform</code> in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
     * <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
     * @return the current <code>AffineTransform</code> in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
     *             <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
     * @see #transform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
     * @see #setTransform
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
    public abstract AffineTransform getTransform();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
     * Returns the current <code>Paint</code> of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
     * <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
     * @return the current <code>Graphics2D</code> <code>Paint</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
     * which defines a color or pattern.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
     * @see #setPaint
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
     * @see java.awt.Graphics#setColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
    public abstract Paint getPaint();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
     * Returns the current <code>Composite</code> in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
     * <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
     * @return the current <code>Graphics2D</code> <code>Composite</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
     *              which defines a compositing style.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
     * @see #setComposite
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
    public abstract Composite getComposite();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
     * Sets the background color for the <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
     * The background color is used for clearing a region.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
     * When a <code>Graphics2D</code> is constructed for a
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
     * <code>Component</code>, the background color is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
     * inherited from the <code>Component</code>. Setting the background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
     * in the <code>Graphics2D</code> context only affects the subsequent
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
     * <code>clearRect</code> calls and not the background color of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
     * <code>Component</code>.  To change the background
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
     * of the <code>Component</code>, use appropriate methods of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
     * the <code>Component</code>.
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
  1165
     * @param color the background color that is used in
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
     * subsequent calls to <code>clearRect</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
     * @see #getBackground
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
     * @see java.awt.Graphics#clearRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
    public abstract void setBackground(Color color);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
     * Returns the background color used for clearing a region.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
     * @return the current <code>Graphics2D</code> <code>Color</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
     * which defines the background color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
     * @see #setBackground
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
    public abstract Color getBackground();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
     * Returns the current <code>Stroke</code> in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
     * <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
     * @return the current <code>Graphics2D</code> <code>Stroke</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
     *                 which defines the line style.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
     * @see #setStroke
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
    public abstract Stroke getStroke();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
     * Intersects the current <code>Clip</code> with the interior of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
     * specified <code>Shape</code> and sets the <code>Clip</code> to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
     * resulting intersection.  The specified <code>Shape</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
     * transformed with the current <code>Graphics2D</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
     * <code>Transform</code> before being intersected with the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
     * <code>Clip</code>.  This method is used to make the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
     * <code>Clip</code> smaller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
     * To make the <code>Clip</code> larger, use <code>setClip</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
     * The <i>user clip</i> modified by this method is independent of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
     * clipping associated with device bounds and visibility.  If no clip has
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
     * previously been set, or if the clip has been cleared using
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
     * {@link Graphics#setClip(Shape) setClip} with a <code>null</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
     * argument, the specified <code>Shape</code> becomes the new
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
     * user clip.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
     * @param s the <code>Shape</code> to be intersected with the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
     *          <code>Clip</code>.  If <code>s</code> is <code>null</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
     *          this method clears the current <code>Clip</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
     public abstract void clip(Shape s);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
     /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
     * Get the rendering context of the <code>Font</code> within this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
     * <code>Graphics2D</code> context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
     * The {@link FontRenderContext}
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
     * encapsulates application hints such as anti-aliasing and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
     * fractional metrics, as well as target device specific information
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
     * such as dots-per-inch.  This information should be provided by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
     * application when using objects that perform typographical
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
     * formatting, such as <code>Font</code> and
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
     * <code>TextLayout</code>.  This information should also be provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
     * by applications that perform their own layout and need accurate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
     * measurements of various characteristics of glyphs such as advance
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
     * and line height when various rendering hints have been applied to
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
     * the text rendering.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
     * @return a reference to an instance of FontRenderContext.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
     * @see java.awt.font.FontRenderContext
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
     * @see java.awt.Font#createGlyphVector
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
     * @see java.awt.font.TextLayout
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
     * @since     1.2
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
    public abstract FontRenderContext getFontRenderContext();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
}