jdk/src/share/classes/java/awt/Graphics.java
author rriggs
Tue, 03 Dec 2013 16:20:44 -0500
changeset 21957 97758de70fbd
parent 21278 ef8a3a2a72f2
child 23010 6dadb192ad81
permissions -rw-r--r--
8028019: AWT Doclint warning/error cleanup Summary: Fix numerious javadoc and html errors and warnings Reviewed-by: yan
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) 1995, 2006, 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
package java.awt;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.lang.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
import java.awt.image.ImageObserver;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
import java.text.AttributedCharacterIterator;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
/**
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
 * The <code>Graphics</code> class is the abstract base class for
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
 * all graphics contexts that allow an application to draw onto
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
 * components that are realized on various devices, as well as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
 * onto off-screen images.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
 * A <code>Graphics</code> object encapsulates state information needed
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
 * for the basic rendering operations that Java supports.  This
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
 * state information includes the following properties:
21957
97758de70fbd 8028019: AWT Doclint warning/error cleanup
rriggs
parents: 21278
diff changeset
    42
 *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
 * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
 * <li>The <code>Component</code> object on which to draw.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
 * <li>A translation origin for rendering and clipping coordinates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
 * <li>The current clip.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
 * <li>The current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
 * <li>The current font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
 * <li>The current logical pixel operation function (XOR or Paint).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
 * <li>The current XOR alternation color
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
 *     (see {@link Graphics#setXORMode}).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
 * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
 * Coordinates are infinitely thin and lie between the pixels of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
 * output device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
 * Operations that draw the outline of a figure operate by traversing
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
 * an infinitely thin path between pixels with a pixel-sized pen that hangs
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
 * down and to the right of the anchor point on the path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
 * Operations that fill a figure operate by filling the interior
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
 * of that infinitely thin path.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
 * Operations that render horizontal text render the ascending
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
 * portion of character glyphs entirely above the baseline coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
 * The graphics pen hangs down and to the right from the path it traverses.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
 * This has the following implications:
21957
97758de70fbd 8028019: AWT Doclint warning/error cleanup
rriggs
parents: 21278
diff changeset
    66
 * <ul>
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
 * <li>If you draw a figure that covers a given rectangle, that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
 * figure occupies one extra row of pixels on the right and bottom edges
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * as compared to filling a figure that is bounded by that same rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * <li>If you draw a horizontal line along the same <i>y</i> coordinate as
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * the baseline of a line of text, that line is drawn entirely below
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * the text, except for any descenders.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * </ul><p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * All coordinates that appear as arguments to the methods of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * <code>Graphics</code> object are considered relative to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 * translation origin of this <code>Graphics</code> object prior to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * the invocation of the method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * All rendering operations modify only pixels which lie within the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 * area bounded by the current clip, which is specified by a {@link Shape}
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 * in user space and is controlled by the program using the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
 * <code>Graphics</code> object.  This <i>user clip</i>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
 * is transformed into device space and combined with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
 * <i>device clip</i>, which is defined by the visibility of windows and
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
 * device extents.  The combination of the user clip and device clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
 * defines the <i>composite clip</i>, which determines the final clipping
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
 * region.  The user clip cannot be modified by the rendering
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
 * system to reflect the resulting composite clip. The user clip can only
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
 * be changed through the <code>setClip</code> or <code>clipRect</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
 * methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
 * All drawing or writing is done in the current color,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
 * using the current paint mode, and in the current font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
 * @author      Sami Shaio
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
 * @author      Arthur van Hoff
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
 * @see     java.awt.Component
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
 * @see     java.awt.Graphics#clipRect(int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
 * @see     java.awt.Graphics#setColor(java.awt.Color)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
 * @see     java.awt.Graphics#setPaintMode()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
 * @see     java.awt.Graphics#setXORMode(java.awt.Color)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
 * @see     java.awt.Graphics#setFont(java.awt.Font)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
 * @since       JDK1.0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
public abstract class Graphics {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
     * Constructs a new <code>Graphics</code> object.
21278
ef8a3a2a72f2 8022746: List of spelling errors in API doc
malenkov
parents: 5506
diff changeset
   108
     * This constructor is the default constructor for a graphics
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
     * context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
     * Since <code>Graphics</code> is an abstract class, applications
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
     * cannot call this constructor directly. Graphics contexts are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
     * obtained from other graphics contexts or are created by calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
     * <code>getGraphics</code> on a component.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
     * @see        java.awt.Graphics#create()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
     * @see        java.awt.Component#getGraphics
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    protected Graphics() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
     * Creates a new <code>Graphics</code> object that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
     * a copy of this <code>Graphics</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
     * @return     a new graphics context that is a copy of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
     *                       this graphics context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    public abstract Graphics create();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
     * Creates a new <code>Graphics</code> object based on this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
     * <code>Graphics</code> object, but with a new translation and clip area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
     * The new <code>Graphics</code> object has its origin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
     * translated to the specified point (<i>x</i>,&nbsp;<i>y</i>).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
     * Its clip area is determined by the intersection of the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
     * clip area with the specified rectangle.  The arguments are all
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * interpreted in the coordinate system of the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     * <code>Graphics</code> object. The new graphics context is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
     * identical to the original, except in two respects:
21957
97758de70fbd 8028019: AWT Doclint warning/error cleanup
rriggs
parents: 21278
diff changeset
   139
     *
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
     * <ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
     * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
     * The new graphics context is translated by (<i>x</i>,&nbsp;<i>y</i>).
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * That is to say, the point (<code>0</code>,&nbsp;<code>0</code>) in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * new graphics context is the same as (<i>x</i>,&nbsp;<i>y</i>) in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     * the original graphics context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
     * <li>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
     * The new graphics context has an additional clipping rectangle, in
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
     * addition to whatever (translated) clipping rectangle it inherited
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
     * from the original graphics context. The origin of the new clipping
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
     * rectangle is at (<code>0</code>,&nbsp;<code>0</code>), and its size
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
     * is specified by the <code>width</code> and <code>height</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     * arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
     * </ul>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
     * @param      x   the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
     * @param      y   the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
     * @param      width   the width of the clipping rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
     * @param      height   the height of the clipping rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
     * @return     a new graphics context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
     * @see        java.awt.Graphics#translate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
     * @see        java.awt.Graphics#clipRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    public Graphics create(int x, int y, int width, int height) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
        Graphics g = create();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
        if (g == null) return null;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
        g.translate(x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
        g.clipRect(0, 0, width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
        return g;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
     * Translates the origin of the graphics context to the point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
     * (<i>x</i>,&nbsp;<i>y</i>) in the current coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
     * Modifies this graphics context so that its new origin corresponds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
     * to the point (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
     * original coordinate system.  All coordinates used in subsequent
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
     * rendering operations on this graphics context will be relative
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
     * to this new origin.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
     * @param  x   the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
     * @param  y   the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    public abstract void translate(int x, int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
     * Gets this graphics context's current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
     * @return    this graphics context's current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
     * @see       java.awt.Color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
     * @see       java.awt.Graphics#setColor(Color)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    public abstract Color getColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
     * Sets this graphics context's current color to the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
     * color. All subsequent graphics operations using this graphics
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
     * context use this specified color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
     * @param     c   the new rendering color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
     * @see       java.awt.Color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
     * @see       java.awt.Graphics#getColor
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    public abstract void setColor(Color c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
     * Sets the paint mode of this graphics context to overwrite the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
     * destination with this graphics context's current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
     * This sets the logical pixel operation function to the paint or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
     * overwrite mode.  All subsequent rendering operations will
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
     * overwrite the destination with the current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    public abstract void setPaintMode();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
     * Sets the paint mode of this graphics context to alternate between
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
     * this graphics context's current color and the new specified color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
     * This specifies that logical pixel operations are performed in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
     * XOR mode, which alternates pixels between the current color and
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
     * a specified XOR color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
     * When drawing operations are performed, pixels which are the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
     * current color are changed to the specified color, and vice versa.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
     * Pixels that are of colors other than those two colors are changed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
     * in an unpredictable but reversible manner; if the same figure is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
     * drawn twice, then all pixels are restored to their original values.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
     * @param     c1 the XOR alternation color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    public abstract void setXORMode(Color c1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
     * Gets the current font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
     * @return    this graphics context's current font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
     * @see       java.awt.Font
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
     * @see       java.awt.Graphics#setFont(Font)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    public abstract Font getFont();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
     * Sets this graphics context's font to the specified font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
     * All subsequent text operations using this graphics context
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
     * use this font. A null argument is silently ignored.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
     * @param  font   the font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
     * @see     java.awt.Graphics#getFont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
     * @see     java.awt.Graphics#drawString(java.lang.String, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
     * @see     java.awt.Graphics#drawBytes(byte[], int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
     * @see     java.awt.Graphics#drawChars(char[], int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
    public abstract void setFont(Font font);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
     * Gets the font metrics of the current font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
     * @return    the font metrics of this graphics
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
     *                    context's current font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
     * @see       java.awt.Graphics#getFont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
     * @see       java.awt.FontMetrics
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
     * @see       java.awt.Graphics#getFontMetrics(Font)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    public FontMetrics getFontMetrics() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
        return getFontMetrics(getFont());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
     * Gets the font metrics for the specified font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
     * @return    the font metrics for the specified font.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
     * @param     f the specified font
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
     * @see       java.awt.Graphics#getFont
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
     * @see       java.awt.FontMetrics
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
     * @see       java.awt.Graphics#getFontMetrics()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    public abstract FontMetrics getFontMetrics(Font f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
     * Returns the bounding rectangle of the current clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
     * This method refers to the user clip, which is independent of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
     * clipping associated with device bounds and window visibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
     * If no clip has previously been set, or if the clip has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
     * cleared using <code>setClip(null)</code>, this method returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
     * <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
     * The coordinates in the rectangle are relative to the coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
     * system origin of this graphics context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
     * @return      the bounding rectangle of the current clipping area,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
     *              or <code>null</code> if no clip is set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
     * @see         java.awt.Graphics#getClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
     * @see         java.awt.Graphics#clipRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
     * @see         java.awt.Graphics#setClip(int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
     * @see         java.awt.Graphics#setClip(Shape)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
     * @since       JDK1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    public abstract Rectangle getClipBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
     * Intersects the current clip with the specified rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
     * The resulting clipping area is the intersection of the current
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
     * clipping area and the specified rectangle.  If there is no
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
     * current clipping area, either because the clip has never been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
     * set, or the clip has been cleared using <code>setClip(null)</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
     * the specified rectangle becomes the new clip.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
     * This method sets the user clip, which is independent of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
     * clipping associated with device bounds and window visibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
     * This method can only be used to make the current clip smaller.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
     * To set the current clip larger, use any of the setClip methods.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
     * Rendering operations have no effect outside of the clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
     * @param x the x coordinate of the rectangle to intersect the clip with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
     * @param y the y coordinate of the rectangle to intersect the clip with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
     * @param width the width of the rectangle to intersect the clip with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
     * @param height the height of the rectangle to intersect the clip with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
     * @see #setClip(int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
     * @see #setClip(Shape)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
    public abstract void clipRect(int x, int y, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
     * Sets the current clip to the rectangle specified by the given
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
     * coordinates.  This method sets the user clip, which is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
     * independent of the clipping associated with device bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
     * and window visibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
     * Rendering operations have no effect outside of the clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
     * @param       x the <i>x</i> coordinate of the new clip rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
     * @param       y the <i>y</i> coordinate of the new clip rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
     * @param       width the width of the new clip rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
     * @param       height the height of the new clip rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
     * @see         java.awt.Graphics#clipRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
     * @see         java.awt.Graphics#setClip(Shape)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
     * @see         java.awt.Graphics#getClip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
     * @since       JDK1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    public abstract void setClip(int x, int y, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
     * Gets the current clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
     * This method returns the user clip, which is independent of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
     * clipping associated with device bounds and window visibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
     * If no clip has previously been set, or if the clip has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
     * cleared using <code>setClip(null)</code>, this method returns
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
     * <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
     * @return      a <code>Shape</code> object representing the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
     *              current clipping area, or <code>null</code> if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
     *              no clip is set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
     * @see         java.awt.Graphics#getClipBounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
     * @see         java.awt.Graphics#clipRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
     * @see         java.awt.Graphics#setClip(int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
     * @see         java.awt.Graphics#setClip(Shape)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
     * @since       JDK1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    public abstract Shape getClip();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
     * Sets the current clipping area to an arbitrary clip shape.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
     * Not all objects that implement the <code>Shape</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
     * interface can be used to set the clip.  The only
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
     * <code>Shape</code> objects that are guaranteed to be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
     * supported are <code>Shape</code> objects that are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
     * obtained via the <code>getClip</code> method and via
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
     * <code>Rectangle</code> objects.  This method sets the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
     * user clip, which is independent of the clipping associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
     * with device bounds and window visibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
     * @param clip the <code>Shape</code> to use to set the clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
     * @see         java.awt.Graphics#getClip()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
     * @see         java.awt.Graphics#clipRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
     * @see         java.awt.Graphics#setClip(int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
     * @since       JDK1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    public abstract void setClip(Shape clip);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
     * Copies an area of the component by a distance specified by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
     * <code>dx</code> and <code>dy</code>. From the point specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
     * by <code>x</code> and <code>y</code>, this method
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
     * copies downwards and to the right.  To copy an area of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
     * component to the left or upwards, specify a negative value for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
     * <code>dx</code> or <code>dy</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
     * If a portion of the source rectangle lies outside the bounds
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
     * of the component, or is obscured by another window or component,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
     * <code>copyArea</code> will be unable to copy the associated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
     * pixels. The area that is omitted can be refreshed by calling
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
     * the component's <code>paint</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
     * @param       x the <i>x</i> coordinate of the source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
     * @param       y the <i>y</i> coordinate of the source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
     * @param       width the width of the source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
     * @param       height the height of the source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
     * @param       dx the horizontal distance to copy the pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
     * @param       dy the vertical distance to copy the pixels.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
    public abstract void copyArea(int x, int y, int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
                                  int dx, int dy);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
     * Draws a line, using the current color, between the points
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
     * <code>(x1,&nbsp;y1)</code> and <code>(x2,&nbsp;y2)</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
     * in this graphics context's coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
     * @param   x1  the first point's <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
     * @param   y1  the first point's <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
     * @param   x2  the second point's <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
     * @param   y2  the second point's <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    public abstract void drawLine(int x1, int y1, int x2, int y2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
     * Fills the specified rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
     * The left and right edges of the rectangle are at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
     * <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
     * The top and bottom edges are at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
     * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
     * The resulting rectangle covers an area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
     * <code>width</code> pixels wide by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
     * <code>height</code> pixels tall.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
     * The rectangle is filled using the graphics context's current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
     * @param         x   the <i>x</i> coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
     *                         of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
     * @param         y   the <i>y</i> coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
     *                         of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
     * @param         width   the width of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
     * @param         height   the height of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
     * @see           java.awt.Graphics#clearRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
     * @see           java.awt.Graphics#drawRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
    public abstract void fillRect(int x, int y, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
     * Draws the outline of the specified rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
     * The left and right edges of the rectangle are at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
     * <code>x</code> and <code>x&nbsp;+&nbsp;width</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
     * The top and bottom edges are at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
     * <code>y</code> and <code>y&nbsp;+&nbsp;height</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
     * The rectangle is drawn using the graphics context's current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
     * @param         x   the <i>x</i> coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
     *                         of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
     * @param         y   the <i>y</i> coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
     *                         of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
     * @param         width   the width of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
     * @param         height   the height of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
     * @see          java.awt.Graphics#fillRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
     * @see          java.awt.Graphics#clearRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
    public void drawRect(int x, int y, int width, int height) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        if ((width < 0) || (height < 0)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
            return;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
        if (height == 0 || width == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
            drawLine(x, y, x + width, y + height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
            drawLine(x, y, x + width - 1, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
            drawLine(x + width, y, x + width, y + height - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
            drawLine(x + width, y + height, x + 1, y + height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
            drawLine(x, y + height, x, y + 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
     * Clears the specified rectangle by filling it with the background
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
     * color of the current drawing surface. This operation does not
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
     * use the current paint mode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
     * Beginning with Java&nbsp;1.1, the background color
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
     * of offscreen images may be system dependent. Applications should
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
     * use <code>setColor</code> followed by <code>fillRect</code> to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
     * ensure that an offscreen image is cleared to a specific color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
     * @param       x the <i>x</i> coordinate of the rectangle to clear.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
     * @param       y the <i>y</i> coordinate of the rectangle to clear.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
     * @param       width the width of the rectangle to clear.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
     * @param       height the height of the rectangle to clear.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
     * @see         java.awt.Graphics#fillRect(int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
     * @see         java.awt.Graphics#drawRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
     * @see         java.awt.Graphics#setColor(java.awt.Color)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
     * @see         java.awt.Graphics#setPaintMode
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
     * @see         java.awt.Graphics#setXORMode(java.awt.Color)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
    public abstract void clearRect(int x, int y, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
     * Draws an outlined round-cornered rectangle using this graphics
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
     * context's current color. The left and right edges of the rectangle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
     * are at <code>x</code> and <code>x&nbsp;+&nbsp;width</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
     * respectively. The top and bottom edges of the rectangle are at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
     * <code>y</code> and <code>y&nbsp;+&nbsp;height</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
     * @param      x the <i>x</i> coordinate of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
     * @param      y the <i>y</i> coordinate of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
     * @param      width the width of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
     * @param      height the height of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
     * @param      arcWidth the horizontal diameter of the arc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
     *                    at the four corners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
     * @param      arcHeight the vertical diameter of the arc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
     *                    at the four corners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
     * @see        java.awt.Graphics#fillRoundRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    public abstract void drawRoundRect(int x, int y, int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
                                       int arcWidth, int arcHeight);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
     * Fills the specified rounded corner rectangle with the current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
     * The left and right edges of the rectangle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
     * are at <code>x</code> and <code>x&nbsp;+&nbsp;width&nbsp;-&nbsp;1</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
     * respectively. The top and bottom edges of the rectangle are at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
     * <code>y</code> and <code>y&nbsp;+&nbsp;height&nbsp;-&nbsp;1</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
     * @param       x the <i>x</i> coordinate of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
     * @param       y the <i>y</i> coordinate of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
     * @param       width the width of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
     * @param       height the height of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
     * @param       arcWidth the horizontal diameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
     *                     of the arc at the four corners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
     * @param       arcHeight the vertical diameter
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
     *                     of the arc at the four corners.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
     * @see         java.awt.Graphics#drawRoundRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
    public abstract void fillRoundRect(int x, int y, int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
                                       int arcWidth, int arcHeight);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
     * Draws a 3-D highlighted outline of the specified rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
     * The edges of the rectangle are highlighted so that they
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
     * appear to be beveled and lit from the upper left corner.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
     * The colors used for the highlighting effect are determined
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
     * based on the current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
     * The resulting rectangle covers an area that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
     * <code>width&nbsp;+&nbsp;1</code> pixels wide
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
     * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
     * @param       x the <i>x</i> coordinate of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
     * @param       y the <i>y</i> coordinate of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
     * @param       width the width of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
     * @param       height the height of the rectangle to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
     * @param       raised a boolean that determines whether the rectangle
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
     *                      appears to be raised above the surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
     *                      or sunk into the surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
     * @see         java.awt.Graphics#fill3DRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    public void draw3DRect(int x, int y, int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
                           boolean raised) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        Color c = getColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
        Color brighter = c.brighter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
        Color darker = c.darker();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
        setColor(raised ? brighter : darker);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
        drawLine(x, y, x, y + height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
        drawLine(x + 1, y, x + width - 1, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
        setColor(raised ? darker : brighter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
        drawLine(x + 1, y + height, x + width, y + height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
        drawLine(x + width, y, x + width, y + height - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
        setColor(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
     * Paints a 3-D highlighted rectangle filled with the current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
     * The edges of the rectangle will be highlighted so that it appears
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
     * as if the edges were beveled and lit from the upper left corner.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
     * The colors used for the highlighting effect will be determined from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
     * the current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
     * @param       x the <i>x</i> coordinate of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
     * @param       y the <i>y</i> coordinate of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
     * @param       width the width of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
     * @param       height the height of the rectangle to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
     * @param       raised a boolean value that determines whether the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
     *                      rectangle appears to be raised above the surface
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
     *                      or etched into the surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
     * @see         java.awt.Graphics#draw3DRect
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
    public void fill3DRect(int x, int y, int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
                           boolean raised) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
        Color c = getColor();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
        Color brighter = c.brighter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
        Color darker = c.darker();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
        if (!raised) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
            setColor(darker);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
        fillRect(x+1, y+1, width-2, height-2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
        setColor(raised ? brighter : darker);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        drawLine(x, y, x, y + height - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
        drawLine(x + 1, y, x + width - 2, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
        setColor(raised ? darker : brighter);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
        drawLine(x + 1, y + height - 1, x + width - 1, y + height - 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
        drawLine(x + width - 1, y, x + width - 1, y + height - 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
        setColor(c);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
     * Draws the outline of an oval.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
     * The result is a circle or ellipse that fits within the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
     * rectangle specified by the <code>x</code>, <code>y</code>,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
     * <code>width</code>, and <code>height</code> arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
     * The oval covers an area that is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
     * <code>width&nbsp;+&nbsp;1</code> pixels wide
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
     * and <code>height&nbsp;+&nbsp;1</code> pixels tall.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
     * @param       x the <i>x</i> coordinate of the upper left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
     *                     corner of the oval to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
     * @param       y the <i>y</i> coordinate of the upper left
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     *                     corner of the oval to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     * @param       width the width of the oval to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * @param       height the height of the oval to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     * @see         java.awt.Graphics#fillOval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
    public abstract void drawOval(int x, int y, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
     * Fills an oval bounded by the specified rectangle with the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
     * current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
     * @param       x the <i>x</i> coordinate of the upper left corner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
     *                     of the oval to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
     * @param       y the <i>y</i> coordinate of the upper left corner
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
     *                     of the oval to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
     * @param       width the width of the oval to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
     * @param       height the height of the oval to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
     * @see         java.awt.Graphics#drawOval
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
    public abstract void fillOval(int x, int y, int width, int height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
     * Draws the outline of a circular or elliptical arc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
     * covering the specified rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
     * The resulting arc begins at <code>startAngle</code> and extends
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
     * for <code>arcAngle</code> degrees, using the current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
     * Angles are interpreted such that 0&nbsp;degrees
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
     * is at the 3&nbsp;o'clock position.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
     * A positive value indicates a counter-clockwise rotation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
     * while a negative value indicates a clockwise rotation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
     * The center of the arc is the center of the rectangle whose origin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
     * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
     * <code>width</code> and <code>height</code> arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
     * The resulting arc covers an area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
     * <code>width&nbsp;+&nbsp;1</code> pixels wide
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
     * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
     * The angles are specified relative to the non-square extents of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
     * the bounding rectangle such that 45 degrees always falls on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
     * line from the center of the ellipse to the upper right corner of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
     * the bounding rectangle. As a result, if the bounding rectangle is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
     * noticeably longer in one axis than the other, the angles to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
     * start and end of the arc segment will be skewed farther along the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
     * longer axis of the bounds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
     * @param        x the <i>x</i> coordinate of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
     *                    upper-left corner of the arc to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
     * @param        y the <i>y</i>  coordinate of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
     *                    upper-left corner of the arc to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
     * @param        width the width of the arc to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
     * @param        height the height of the arc to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
     * @param        startAngle the beginning angle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
     * @param        arcAngle the angular extent of the arc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
     *                    relative to the start angle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
     * @see         java.awt.Graphics#fillArc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
    public abstract void drawArc(int x, int y, int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
                                 int startAngle, int arcAngle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
     * Fills a circular or elliptical arc covering the specified rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
     * The resulting arc begins at <code>startAngle</code> and extends
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
     * for <code>arcAngle</code> degrees.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
     * Angles are interpreted such that 0&nbsp;degrees
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
     * is at the 3&nbsp;o'clock position.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
     * A positive value indicates a counter-clockwise rotation
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
     * while a negative value indicates a clockwise rotation.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
     * The center of the arc is the center of the rectangle whose origin
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
     * is (<i>x</i>,&nbsp;<i>y</i>) and whose size is specified by the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
     * <code>width</code> and <code>height</code> arguments.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
     * The resulting arc covers an area
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
     * <code>width&nbsp;+&nbsp;1</code> pixels wide
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
     * by <code>height&nbsp;+&nbsp;1</code> pixels tall.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
     * The angles are specified relative to the non-square extents of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
     * the bounding rectangle such that 45 degrees always falls on the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
     * line from the center of the ellipse to the upper right corner of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
     * the bounding rectangle. As a result, if the bounding rectangle is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
     * noticeably longer in one axis than the other, the angles to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
     * start and end of the arc segment will be skewed farther along the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
     * longer axis of the bounds.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
     * @param        x the <i>x</i> coordinate of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
     *                    upper-left corner of the arc to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
     * @param        y the <i>y</i>  coordinate of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   676
     *                    upper-left corner of the arc to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
     * @param        width the width of the arc to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   678
     * @param        height the height of the arc to be filled.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
     * @param        startAngle the beginning angle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
     * @param        arcAngle the angular extent of the arc,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
     *                    relative to the start angle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   682
     * @see         java.awt.Graphics#drawArc
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
    public abstract void fillArc(int x, int y, int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
                                 int startAngle, int arcAngle);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
     * Draws a sequence of connected lines defined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
     * arrays of <i>x</i> and <i>y</i> coordinates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
     * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
     * The figure is not closed if the first point
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
     * differs from the last point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
     * @param       xPoints an array of <i>x</i> points
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
     * @param       yPoints an array of <i>y</i> points
90ce3da70b43 Initial load
duke
parents:
diff changeset
   695
     * @param       nPoints the total number of points
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
     * @see         java.awt.Graphics#drawPolygon(int[], int[], int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
     * @since       JDK1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
    public abstract void drawPolyline(int xPoints[], int yPoints[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
                                      int nPoints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
     * Draws a closed polygon defined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
     * arrays of <i>x</i> and <i>y</i> coordinates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
     * Each pair of (<i>x</i>,&nbsp;<i>y</i>) coordinates defines a point.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
     * This method draws the polygon defined by <code>nPoint</code> line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
     * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
     * line segments are line segments from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
     * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
     * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
     * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
     * The figure is automatically closed by drawing a line connecting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
     * the final point to the first point, if those points are different.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
     * @param        xPoints   a an array of <code>x</code> coordinates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
     * @param        yPoints   a an array of <code>y</code> coordinates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
     * @param        nPoints   a the total number of points.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
     * @see          java.awt.Graphics#fillPolygon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
     * @see          java.awt.Graphics#drawPolyline
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
    public abstract void drawPolygon(int xPoints[], int yPoints[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
                                     int nPoints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
     * Draws the outline of a polygon defined by the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
     * <code>Polygon</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   727
     * @param        p the polygon to draw.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   728
     * @see          java.awt.Graphics#fillPolygon
90ce3da70b43 Initial load
duke
parents:
diff changeset
   729
     * @see          java.awt.Graphics#drawPolyline
90ce3da70b43 Initial load
duke
parents:
diff changeset
   730
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   731
    public void drawPolygon(Polygon p) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   732
        drawPolygon(p.xpoints, p.ypoints, p.npoints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   733
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   734
90ce3da70b43 Initial load
duke
parents:
diff changeset
   735
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   736
     * Fills a closed polygon defined by
90ce3da70b43 Initial load
duke
parents:
diff changeset
   737
     * arrays of <i>x</i> and <i>y</i> coordinates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   738
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   739
     * This method draws the polygon defined by <code>nPoint</code> line
90ce3da70b43 Initial load
duke
parents:
diff changeset
   740
     * segments, where the first <code>nPoint&nbsp;-&nbsp;1</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
     * line segments are line segments from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
     * <code>(xPoints[i&nbsp;-&nbsp;1],&nbsp;yPoints[i&nbsp;-&nbsp;1])</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
     * to <code>(xPoints[i],&nbsp;yPoints[i])</code>, for
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
     * 1&nbsp;&le;&nbsp;<i>i</i>&nbsp;&le;&nbsp;<code>nPoints</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
     * The figure is automatically closed by drawing a line connecting
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
     * the final point to the first point, if those points are different.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
     * The area inside the polygon is defined using an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
     * even-odd fill rule, also known as the alternating rule.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
     * @param        xPoints   a an array of <code>x</code> coordinates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
     * @param        yPoints   a an array of <code>y</code> coordinates.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
     * @param        nPoints   a the total number of points.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
     * @see          java.awt.Graphics#drawPolygon(int[], int[], int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
    public abstract void fillPolygon(int xPoints[], int yPoints[],
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
                                     int nPoints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
     * Fills the polygon defined by the specified Polygon object with
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
     * the graphics context's current color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
     * The area inside the polygon is defined using an
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
     * even-odd fill rule, also known as the alternating rule.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
     * @param        p the polygon to fill.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
     * @see          java.awt.Graphics#drawPolygon(int[], int[], int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
    public void fillPolygon(Polygon p) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
        fillPolygon(p.xpoints, p.ypoints, p.npoints);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
     * Draws the text given by the specified string, using this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
     * graphics context's current font and color. The baseline of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
     * leftmost character is at position (<i>x</i>,&nbsp;<i>y</i>) in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
     * graphics context's coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
     * @param       str      the string to be drawn.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
     * @param       x        the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
     * @param       y        the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
     * @throws NullPointerException if <code>str</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * @see         java.awt.Graphics#drawBytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * @see         java.awt.Graphics#drawChars
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
    public abstract void drawString(String str, int x, int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
     * Renders the text of the specified iterator applying its attributes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
     * in accordance with the specification of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
     * {@link java.awt.font.TextAttribute TextAttribute} class.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
     * The baseline of the leftmost character is at position
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
     * (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
     * @param       iterator the iterator whose text is to be drawn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
     * @param       x        the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
     * @param       y        the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
     * @throws NullPointerException if <code>iterator</code> is
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
     * <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
     * @see         java.awt.Graphics#drawBytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     * @see         java.awt.Graphics#drawChars
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
   public abstract void drawString(AttributedCharacterIterator iterator,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
                                    int x, int y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     * Draws the text given by the specified character array, using this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     * graphics context's current font and color. The baseline of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
     * graphics context's coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
     * @param data the array of characters to be drawn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
     * @param offset the start offset in the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     * @param length the number of characters to be drawn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     * @param x the <i>x</i> coordinate of the baseline of the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
     * @param y the <i>y</i> coordinate of the baseline of the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
     * @throws NullPointerException if <code>data</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
     * @throws IndexOutOfBoundsException if <code>offset</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
     * <code>length</code>is less than zero, or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
     * <code>offset+length</code> is greater than the length of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
     * <code>data</code> array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
     * @see         java.awt.Graphics#drawBytes
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
     * @see         java.awt.Graphics#drawString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
    public void drawChars(char data[], int offset, int length, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
        drawString(new String(data, offset, length), x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     * Draws the text given by the specified byte array, using this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     * graphics context's current font and color. The baseline of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
     * first character is at position (<i>x</i>,&nbsp;<i>y</i>) in this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     * graphics context's coordinate system.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
     * Use of this method is not recommended as each byte is interpreted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
     * as a Unicode code point in the range 0 to 255, and so can only be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
     * used to draw Latin characters in that range.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
     * @param data the data to be drawn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
     * @param offset the start offset in the data
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
     * @param length the number of bytes that are drawn
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
     * @param x the <i>x</i> coordinate of the baseline of the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
     * @param y the <i>y</i> coordinate of the baseline of the text
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
     * @throws NullPointerException if <code>data</code> is <code>null</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
     * @throws IndexOutOfBoundsException if <code>offset</code> or
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
     * <code>length</code>is less than zero, or <code>offset+length</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
     * is greater than the length of the <code>data</code> array.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
     * @see         java.awt.Graphics#drawChars
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
     * @see         java.awt.Graphics#drawString
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
    public void drawBytes(byte data[], int offset, int length, int x, int y) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
        drawString(new String(data, 0, offset, length), x, y);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
     * Draws as much of the specified image as is currently available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
     * The image is drawn with its top-left corner at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
     * (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
     * space. Transparent pixels in the image do not affect whatever
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
     * pixels are already there.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
     * This method returns immediately in all cases, even if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
     * complete image has not yet been loaded, and it has not been dithered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
     * and converted for the current output device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
     * If the image has completely loaded and its pixels are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
     * no longer being changed, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
     * <code>drawImage</code> returns <code>true</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
     * Otherwise, <code>drawImage</code> returns <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
     * and as more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
     * the image becomes available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
     * or it is time to draw another frame of animation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
     * the process that loads the image notifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
     * the specified image observer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
     * @param    img the specified image to be drawn. This method does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
     *               nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
     * @param    x   the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
     * @param    y   the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
     * @param    observer    object to be notified as more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
     *                          the image is converted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
     * @return   <code>false</code> if the image pixels are still changing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
     *           <code>true</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
     * @see      java.awt.Image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
     * @see      java.awt.image.ImageObserver
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
     * @see      java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
    public abstract boolean drawImage(Image img, int x, int y,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
                                      ImageObserver observer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
     * Draws as much of the specified image as has already been scaled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
     * to fit inside the specified rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
     * The image is drawn inside the specified rectangle of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
     * graphics context's coordinate space, and is scaled if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
     * necessary. Transparent pixels do not affect whatever pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
     * are already there.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
     * This method returns immediately in all cases, even if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
     * entire image has not yet been scaled, dithered, and converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
     * for the current output device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
     * If the current output representation is not yet complete, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
     * <code>drawImage</code> returns <code>false</code>. As more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
     * the image becomes available, the process that loads the image notifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
     * the image observer by calling its <code>imageUpdate</code> method.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
     * A scaled version of an image will not necessarily be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
     * available immediately just because an unscaled version of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
     * image has been constructed for this output device.  Each size of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
     * the image may be cached separately and generated from the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
     * data in a separate image production sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
     * @param    img    the specified image to be drawn. This method does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
     *                  nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
     * @param    x      the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
     * @param    y      the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
     * @param    width  the width of the rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
     * @param    height the height of the rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
     * @param    observer    object to be notified as more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
     *                          the image is converted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
     * @return   <code>false</code> if the image pixels are still changing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
     *           <code>true</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
     * @see      java.awt.Image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
     * @see      java.awt.image.ImageObserver
90ce3da70b43 Initial load
duke
parents:
diff changeset
   919
     * @see      java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   920
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   921
    public abstract boolean drawImage(Image img, int x, int y,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   922
                                      int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   923
                                      ImageObserver observer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   924
90ce3da70b43 Initial load
duke
parents:
diff changeset
   925
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   926
     * Draws as much of the specified image as is currently available.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   927
     * The image is drawn with its top-left corner at
90ce3da70b43 Initial load
duke
parents:
diff changeset
   928
     * (<i>x</i>,&nbsp;<i>y</i>) in this graphics context's coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
   929
     * space.  Transparent pixels are drawn in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   930
     * background color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   931
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   932
     * This operation is equivalent to filling a rectangle of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   933
     * width and height of the specified image with the given color and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   934
     * drawing the image on top of it, but possibly more efficient.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   935
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   936
     * This method returns immediately in all cases, even if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   937
     * complete image has not yet been loaded, and it has not been dithered
90ce3da70b43 Initial load
duke
parents:
diff changeset
   938
     * and converted for the current output device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   939
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   940
     * If the image has completely loaded and its pixels are
90ce3da70b43 Initial load
duke
parents:
diff changeset
   941
     * no longer being changed, then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   942
     * <code>drawImage</code> returns <code>true</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   943
     * Otherwise, <code>drawImage</code> returns <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   944
     * and as more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   945
     * the image becomes available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   946
     * or it is time to draw another frame of animation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   947
     * the process that loads the image notifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   948
     * the specified image observer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   949
     * @param    img the specified image to be drawn. This method does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   950
     *               nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   951
     * @param    x      the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   952
     * @param    y      the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   953
     * @param    bgcolor the background color to paint under the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   954
     *                         non-opaque portions of the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   955
     * @param    observer    object to be notified as more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   956
     *                          the image is converted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   957
     * @return   <code>false</code> if the image pixels are still changing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   958
     *           <code>true</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   959
     * @see      java.awt.Image
90ce3da70b43 Initial load
duke
parents:
diff changeset
   960
     * @see      java.awt.image.ImageObserver
90ce3da70b43 Initial load
duke
parents:
diff changeset
   961
     * @see      java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   962
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   963
    public abstract boolean drawImage(Image img, int x, int y,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   964
                                      Color bgcolor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   965
                                      ImageObserver observer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   966
90ce3da70b43 Initial load
duke
parents:
diff changeset
   967
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   968
     * Draws as much of the specified image as has already been scaled
90ce3da70b43 Initial load
duke
parents:
diff changeset
   969
     * to fit inside the specified rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   970
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   971
     * The image is drawn inside the specified rectangle of this
90ce3da70b43 Initial load
duke
parents:
diff changeset
   972
     * graphics context's coordinate space, and is scaled if
90ce3da70b43 Initial load
duke
parents:
diff changeset
   973
     * necessary. Transparent pixels are drawn in the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
   974
     * background color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   975
     * This operation is equivalent to filling a rectangle of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   976
     * width and height of the specified image with the given color and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   977
     * drawing the image on top of it, but possibly more efficient.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   978
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   979
     * This method returns immediately in all cases, even if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   980
     * entire image has not yet been scaled, dithered, and converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
   981
     * for the current output device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   982
     * If the current output representation is not yet complete then
90ce3da70b43 Initial load
duke
parents:
diff changeset
   983
     * <code>drawImage</code> returns <code>false</code>. As more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   984
     * the image becomes available, the process that loads the image notifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
   985
     * the specified image observer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   986
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
   987
     * A scaled version of an image will not necessarily be
90ce3da70b43 Initial load
duke
parents:
diff changeset
   988
     * available immediately just because an unscaled version of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   989
     * image has been constructed for this output device.  Each size of
90ce3da70b43 Initial load
duke
parents:
diff changeset
   990
     * the image may be cached separately and generated from the original
90ce3da70b43 Initial load
duke
parents:
diff changeset
   991
     * data in a separate image production sequence.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   992
     * @param    img       the specified image to be drawn. This method does
90ce3da70b43 Initial load
duke
parents:
diff changeset
   993
     *                     nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   994
     * @param    x         the <i>x</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   995
     * @param    y         the <i>y</i> coordinate.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   996
     * @param    width     the width of the rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   997
     * @param    height    the height of the rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   998
     * @param    bgcolor   the background color to paint under the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   999
     *                         non-opaque portions of the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1000
     * @param    observer    object to be notified as more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1001
     *                          the image is converted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1002
     * @return   <code>false</code> if the image pixels are still changing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1003
     *           <code>true</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1004
     * @see      java.awt.Image
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1005
     * @see      java.awt.image.ImageObserver
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1006
     * @see      java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1007
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1008
    public abstract boolean drawImage(Image img, int x, int y,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1009
                                      int width, int height,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1010
                                      Color bgcolor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1011
                                      ImageObserver observer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1012
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1013
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1014
     * Draws as much of the specified area of the specified image as is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1015
     * currently available, scaling it on the fly to fit inside the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1016
     * specified area of the destination drawable surface. Transparent pixels
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1017
     * do not affect whatever pixels are already there.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1018
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1019
     * This method returns immediately in all cases, even if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1020
     * image area to be drawn has not yet been scaled, dithered, and converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1021
     * for the current output device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1022
     * If the current output representation is not yet complete then
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1023
     * <code>drawImage</code> returns <code>false</code>. As more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1024
     * the image becomes available, the process that loads the image notifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1025
     * the specified image observer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1026
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1027
     * This method always uses the unscaled version of the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1028
     * to render the scaled rectangle and performs the required
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1029
     * scaling on the fly. It does not use a cached, scaled version
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1030
     * of the image for this operation. Scaling of the image from source
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1031
     * to destination is performed such that the first coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1032
     * of the source rectangle is mapped to the first coordinate of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1033
     * the destination rectangle, and the second source coordinate is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1034
     * mapped to the second destination coordinate. The subimage is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1035
     * scaled and flipped as needed to preserve those mappings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1036
     * @param       img the specified image to be drawn. This method does
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1037
     *                  nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1038
     * @param       dx1 the <i>x</i> coordinate of the first corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1039
     *                    destination rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1040
     * @param       dy1 the <i>y</i> coordinate of the first corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1041
     *                    destination rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1042
     * @param       dx2 the <i>x</i> coordinate of the second corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1043
     *                    destination rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1044
     * @param       dy2 the <i>y</i> coordinate of the second corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1045
     *                    destination rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1046
     * @param       sx1 the <i>x</i> coordinate of the first corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1047
     *                    source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1048
     * @param       sy1 the <i>y</i> coordinate of the first corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1049
     *                    source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1050
     * @param       sx2 the <i>x</i> coordinate of the second corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1051
     *                    source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1052
     * @param       sy2 the <i>y</i> coordinate of the second corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1053
     *                    source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1054
     * @param       observer object to be notified as more of the image is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1055
     *                    scaled and converted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1056
     * @return   <code>false</code> if the image pixels are still changing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1057
     *           <code>true</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1058
     * @see         java.awt.Image
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1059
     * @see         java.awt.image.ImageObserver
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1060
     * @see         java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1061
     * @since       JDK1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1062
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1063
    public abstract boolean drawImage(Image img,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1064
                                      int dx1, int dy1, int dx2, int dy2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1065
                                      int sx1, int sy1, int sx2, int sy2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1066
                                      ImageObserver observer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1067
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1068
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1069
     * Draws as much of the specified area of the specified image as is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1070
     * currently available, scaling it on the fly to fit inside the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1071
     * specified area of the destination drawable surface.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1072
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1073
     * Transparent pixels are drawn in the specified background color.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1074
     * This operation is equivalent to filling a rectangle of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1075
     * width and height of the specified image with the given color and then
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1076
     * drawing the image on top of it, but possibly more efficient.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1077
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1078
     * This method returns immediately in all cases, even if the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1079
     * image area to be drawn has not yet been scaled, dithered, and converted
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1080
     * for the current output device.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1081
     * If the current output representation is not yet complete then
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1082
     * <code>drawImage</code> returns <code>false</code>. As more of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1083
     * the image becomes available, the process that loads the image notifies
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1084
     * the specified image observer.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1085
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1086
     * This method always uses the unscaled version of the image
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1087
     * to render the scaled rectangle and performs the required
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1088
     * scaling on the fly. It does not use a cached, scaled version
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1089
     * of the image for this operation. Scaling of the image from source
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1090
     * to destination is performed such that the first coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1091
     * of the source rectangle is mapped to the first coordinate of
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1092
     * the destination rectangle, and the second source coordinate is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1093
     * mapped to the second destination coordinate. The subimage is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1094
     * scaled and flipped as needed to preserve those mappings.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1095
     * @param       img the specified image to be drawn. This method does
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1096
     *                  nothing if <code>img</code> is null.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1097
     * @param       dx1 the <i>x</i> coordinate of the first corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1098
     *                    destination rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1099
     * @param       dy1 the <i>y</i> coordinate of the first corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1100
     *                    destination rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1101
     * @param       dx2 the <i>x</i> coordinate of the second corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1102
     *                    destination rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1103
     * @param       dy2 the <i>y</i> coordinate of the second corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1104
     *                    destination rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1105
     * @param       sx1 the <i>x</i> coordinate of the first corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1106
     *                    source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1107
     * @param       sy1 the <i>y</i> coordinate of the first corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1108
     *                    source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1109
     * @param       sx2 the <i>x</i> coordinate of the second corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1110
     *                    source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1111
     * @param       sy2 the <i>y</i> coordinate of the second corner of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1112
     *                    source rectangle.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1113
     * @param       bgcolor the background color to paint under the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1114
     *                    non-opaque portions of the image.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1115
     * @param       observer object to be notified as more of the image is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1116
     *                    scaled and converted.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1117
     * @return   <code>false</code> if the image pixels are still changing;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1118
     *           <code>true</code> otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1119
     * @see         java.awt.Image
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1120
     * @see         java.awt.image.ImageObserver
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1121
     * @see         java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1122
     * @since       JDK1.1
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1123
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1124
    public abstract boolean drawImage(Image img,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1125
                                      int dx1, int dy1, int dx2, int dy2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1126
                                      int sx1, int sy1, int sx2, int sy2,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1127
                                      Color bgcolor,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1128
                                      ImageObserver observer);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1129
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1130
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1131
     * Disposes of this graphics context and releases
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1132
     * any system resources that it is using.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1133
     * A <code>Graphics</code> object cannot be used after
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1134
     * <code>dispose</code>has been called.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1135
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1136
     * When a Java program runs, a large number of <code>Graphics</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1137
     * objects can be created within a short time frame.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1138
     * Although the finalization process of the garbage collector
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1139
     * also disposes of the same system resources, it is preferable
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1140
     * to manually free the associated resources by calling this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1141
     * method rather than to rely on a finalization process which
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1142
     * may not run to completion for a long period of time.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1143
     * <p>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1144
     * Graphics objects which are provided as arguments to the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1145
     * <code>paint</code> and <code>update</code> methods
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1146
     * of components are automatically released by the system when
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1147
     * those methods return. For efficiency, programmers should
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1148
     * call <code>dispose</code> when finished using
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1149
     * a <code>Graphics</code> object only if it was created
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1150
     * directly from a component or another <code>Graphics</code> object.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1151
     * @see         java.awt.Graphics#finalize
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1152
     * @see         java.awt.Component#paint
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1153
     * @see         java.awt.Component#update
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1154
     * @see         java.awt.Component#getGraphics
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1155
     * @see         java.awt.Graphics#create
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1156
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1157
    public abstract void dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1158
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1159
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1160
     * Disposes of this graphics context once it is no longer referenced.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1161
     * @see #dispose
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1162
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1163
    public void finalize() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1164
        dispose();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1165
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1166
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1167
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1168
     * Returns a <code>String</code> object representing this
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1169
     *                        <code>Graphics</code> object's value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1170
     * @return       a string representation of this graphics context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1171
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1172
    public String toString() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1173
        return getClass().getName() + "[font=" + getFont() + ",color=" + getColor() + "]";
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1174
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1175
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1176
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1177
     * Returns the bounding rectangle of the current clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1178
     * @return      the bounding rectangle of the current clipping area
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1179
     *              or <code>null</code> if no clip is set.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1180
     * @deprecated As of JDK version 1.1,
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1181
     * replaced by <code>getClipBounds()</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1182
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1183
    @Deprecated
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1184
    public Rectangle getClipRect() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1185
        return getClipBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1186
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1187
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1188
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1189
     * Returns true if the specified rectangular area might intersect
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1190
     * the current clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1191
     * The coordinates of the specified rectangular area are in the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1192
     * user coordinate space and are relative to the coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1193
     * system origin of this graphics context.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1194
     * This method may use an algorithm that calculates a result quickly
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1195
     * but which sometimes might return true even if the specified
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1196
     * rectangular area does not intersect the clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1197
     * The specific algorithm employed may thus trade off accuracy for
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1198
     * speed, but it will never return false unless it can guarantee
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1199
     * that the specified rectangular area does not intersect the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1200
     * current clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1201
     * The clipping area used by this method can represent the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1202
     * intersection of the user clip as specified through the clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1203
     * methods of this graphics context as well as the clipping
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1204
     * associated with the device or image bounds and window visibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1205
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1206
     * @param x the x coordinate of the rectangle to test against the clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1207
     * @param y the y coordinate of the rectangle to test against the clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1208
     * @param width the width of the rectangle to test against the clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1209
     * @param height the height of the rectangle to test against the clip
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1210
     * @return <code>true</code> if the specified rectangle intersects
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1211
     *         the bounds of the current clip; <code>false</code>
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1212
     *         otherwise.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1213
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1214
    public boolean hitClip(int x, int y, int width, int height) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1215
        // Note, this implementation is not very efficient.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1216
        // Subclasses should override this method and calculate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1217
        // the results more directly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1218
        Rectangle clipRect = getClipBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1219
        if (clipRect == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1220
            return true;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1221
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1222
        return clipRect.intersects(x, y, width, height);
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1223
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1224
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1225
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1226
     * Returns the bounding rectangle of the current clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1227
     * The coordinates in the rectangle are relative to the coordinate
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1228
     * system origin of this graphics context.  This method differs
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1229
     * from {@link #getClipBounds() getClipBounds} in that an existing
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1230
     * rectangle is used instead of allocating a new one.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1231
     * This method refers to the user clip, which is independent of the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1232
     * clipping associated with device bounds and window visibility.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1233
     *  If no clip has previously been set, or if the clip has been
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1234
     * cleared using <code>setClip(null)</code>, this method returns the
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1235
     * specified <code>Rectangle</code>.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1236
     * @param  r    the rectangle where the current clipping area is
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1237
     *              copied to.  Any current values in this rectangle are
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1238
     *              overwritten.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1239
     * @return      the bounding rectangle of the current clipping area.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1240
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1241
    public Rectangle getClipBounds(Rectangle r) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1242
        // Note, this implementation is not very efficient.
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1243
        // Subclasses should override this method and avoid
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1244
        // the allocation overhead of getClipBounds().
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1245
        Rectangle clipRect = getClipBounds();
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1246
        if (clipRect != null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1247
            r.x = clipRect.x;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1248
            r.y = clipRect.y;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1249
            r.width = clipRect.width;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1250
            r.height = clipRect.height;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1251
        } else if (r == null) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1252
            throw new NullPointerException("null rectangle parameter");
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1253
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1254
        return r;
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1255
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
  1256
}