/* * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package sun.print; import java.awt.Color;import java.awt.Font;import java.awt.FontMetrics;import java.awt.Graphics;import java.awt.Image;import java.awt.Polygon;import java.awt.Rectangle;import java.awt.Shape; import java.awt.image.ImageObserver; import java.text.AttributedCharacterIterator; /** * Implements the Graphics API but does all * rendering through a second Graphics instance. * The primary use of this class is to provide * a Graphics instance without the 2D API to * an application, but to implement the rendering * with a Graphics2D instance. */public class ProxyGraphics extends Graphics { /** * The Graphics instance that performs the * drawing for this Graphics. */ private Graphics g; public ProxyGraphics(Graphics graphics) { g = graphics; } Graphics getGraphics() { return g; } /** * Creates a new <code>Graphics</code> object that is * a copy of this <code>Graphics</code> object. * @return a new graphics context that is a copy of * this graphics context. */ public Graphics create() { return new ProxyGraphics(g.create()); } /** * Creates a new <code>Graphics</code> object based on this * <code>Graphics</code> object, but with a new translation and clip area. * The new <code>Graphics</code> object has its origin * translated to the specified point (<i>x</i>, <i>y</i>). * Its clip area is determined by the intersection of the original * clip area with the specified rectangle. The arguments are all * interpreted in the coordinate system of the original * <code>Graphics</code> object. The new graphics context is * identical to the original, except in two respects: * <p> * <ul> * <li> * The new graphics context is translated by (<i>x</i>, <i>y</i>). * That is to say, the point (<code>0</code>, <code>0</code>) in the * new graphics context is the same as (<i>x</i>, <i>y</i>) in * the original graphics context. * <li> * The new graphics context has an additional clipping rectangle, in * addition to whatever (translated) clipping rectangle it inherited * from the original graphics context. The origin of the new clipping * rectangle is at (<code>0</code>, <code>0</code>), and its size * is specified by the <code>width</code> and <code>height</code> * arguments. * </ul> * <p> * @param x the <i>x</i> coordinate. * @param y the <i>y</i> coordinate. * @param width the width of the clipping rectangle. * @param height the height of the clipping rectangle. * @return a new graphics context. * @see java.awt.Graphics#translate * @see java.awt.Graphics#clipRect */ public Graphics create(int x, int y, int width, int height) { return new ProxyGraphics(g.create(x, y, width, height)); } /** * Translates the origin of the graphics context to the point * (<i>x</i>, <i>y</i>) in the current coordinate system. * Modifies this graphics context so that its new origin corresponds * to the point (<i>x</i>, <i>y</i>) in this graphics context's * original coordinate system. All coordinates used in subsequent * rendering operations on this graphics context will be relative * to this new origin. * @param x the <i>x</i> coordinate. * @param y the <i>y</i> coordinate. */ public void translate(int x, int y) { g.translate(x, y); } /** * Gets this graphics context's current color. * @return this graphics context's current color. * @see java.awt.Color * @see java.awt.Graphics#setColor */ public Color getColor() { return g.getColor(); } /** * Sets this graphics context's current color to the specified * color. All subsequent graphics operations using this graphics * context use this specified color. * @param c the new rendering color. * @see java.awt.Color * @see java.awt.Graphics#getColor */ public void setColor(Color c) { g.setColor(c); } /** * Sets the paint mode of this graphics context to overwrite the * destination with this graphics context's current color. * This sets the logical pixel operation function to the paint or * overwrite mode. All subsequent rendering operations will * overwrite the destination with the current color. */ public void setPaintMode() { g.setPaintMode(); } /** * Sets the paint mode of this graphics context to alternate between * this graphics context's current color and the new specified color. * This specifies that logical pixel operations are performed in the * XOR mode, which alternates pixels between the current color and * a specified XOR color. * <p> * When drawing operations are performed, pixels which are the * current color are changed to the specified color, and vice versa. * <p> * Pixels that are of colors other than those two colors are changed * in an unpredictable but reversible manner; if the same figure is * drawn twice, then all pixels are restored to their original values. * @param c1 the XOR alternation color */ public void setXORMode(Color c1) { g.setXORMode(c1); } /** * Gets the current font. * @return this graphics context's current font. * @see java.awt.Font * @see java.awt.Graphics#setFont */ public Font getFont() { return g.getFont(); } /** * Sets this graphics context's font to the specified font. * All subsequent text operations using this graphics context * use this font. * @param font the font. * @see java.awt.Graphics#getFont * @see java.awt.Graphics#drawString(java.lang.String, int, int) * @see java.awt.Graphics#drawBytes(byte[], int, int, int, int) * @see java.awt.Graphics#drawChars(char[], int, int, int, int) */ public void setFont(Font font) { g.setFont(font); } /** * Gets the font metrics of the current font. * @return the font metrics of this graphics * context's current font. * @see java.awt.Graphics#getFont * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics(Font) */ public FontMetrics getFontMetrics() { return g.getFontMetrics(); } /** * Gets the font metrics for the specified font. * @return the font metrics for the specified font. * @param f the specified font * @see java.awt.Graphics#getFont * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics() */ public FontMetrics getFontMetrics(Font f) { return g.getFontMetrics(f); } /** * Returns the bounding rectangle of the current clipping area. * This method refers to the user clip, which is independent of the * clipping associated with device bounds and window visibility. * If no clip has previously been set, or if the clip has been * cleared using <code>setClip(null)</code>, this method returns * <code>null</code>. * The coordinates in the rectangle are relative to the coordinate * system origin of this graphics context. * @return the bounding rectangle of the current clipping area, * or <code>null</code> if no clip is set. * @see java.awt.Graphics#getClip * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @see java.awt.Graphics#setClip(Shape) * @since JDK1.1 */ public Rectangle getClipBounds() { return g.getClipBounds(); } /** * Intersects the current clip with the specified rectangle. * The resulting clipping area is the intersection of the current * clipping area and the specified rectangle. If there is no * current clipping area, either because the clip has never been * set, or the clip has been cleared using <code>setClip(null)</code>, * the specified rectangle becomes the new clip. * This method sets the user clip, which is independent of the * clipping associated with device bounds and window visibility. * This method can only be used to make the current clip smaller. * To set the current clip larger, use any of the setClip methods. * Rendering operations have no effect outside of the clipping area. * @param x the x coordinate of the rectangle to intersect the clip with * @param y the y coordinate of the rectangle to intersect the clip with * @param width the width of the rectangle to intersect the clip with * @param height the height of the rectangle to intersect the clip with * @see #setClip(int, int, int, int) * @see #setClip(Shape) */ public void clipRect(int x, int y, int width, int height) { g.clipRect(x, y, width, height); } /** * Sets the current clip to the rectangle specified by the given * coordinates. This method sets the user clip, which is * independent of the clipping associated with device bounds * and window visibility. * Rendering operations have no effect outside of the clipping area. * @param x the <i>x</i> coordinate of the new clip rectangle. * @param y the <i>y</i> coordinate of the new clip rectangle. * @param width the width of the new clip rectangle. * @param height the height of the new clip rectangle. * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(Shape) * @since JDK1.1 */ public void setClip(int x, int y, int width, int height) { g.setClip(x, y, width, height); } /** * Gets the current clipping area. * This method returns the user clip, which is independent of the * clipping associated with device bounds and window visibility. * If no clip has previously been set, or if the clip has been * cleared using <code>setClip(null)</code>, this method returns * <code>null</code>. * @return a <code>Shape</code> object representing the * current clipping area, or <code>null</code> if * no clip is set. * @see java.awt.Graphics#getClipBounds * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @see java.awt.Graphics#setClip(Shape) * @since JDK1.1 */ public Shape getClip() { return g.getClip(); } /** * Sets the current clipping area to an arbitrary clip shape. * Not all objects that implement the <code>Shape</code> * interface can be used to set the clip. The only * <code>Shape</code> objects that are guaranteed to be * supported are <code>Shape</code> objects that are * obtained via the <code>getClip</code> method and via * <code>Rectangle</code> objects. This method sets the * user clip, which is independent of the clipping associated * with device bounds and window visibility. * @param clip the <code>Shape</code> to use to set the clip * @see java.awt.Graphics#getClip() * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @since JDK1.1 */ public void setClip(Shape clip) { g.setClip(clip); } /** * Copies an area of the component by a distance specified by * <code>dx</code> and <code>dy</code>. From the point specified * by <code>x</code> and <code>y</code>, this method * copies downwards and to the right. To copy an area of the * component to the left or upwards, specify a negative value for * <code>dx</code> or <code>dy</code>. * If a portion of the source rectangle lies outside the bounds * of the component, or is obscured by another window or component, * <code>copyArea</code> will be unable to copy the associated * pixels. The area that is omitted can be refreshed by calling * the component's <code>paint</code> method. * @param x the <i>x</i> coordinate of the source rectangle. * @param y the <i>y</i> coordinate of the source rectangle. * @param width the width of the source rectangle. * @param height the height of the source rectangle. * @param dx the horizontal distance to copy the pixels. * @param dy the vertical distance to copy the pixels. */ public void copyArea(int x, int y, int width, int height, int dx, int dy) { g.copyArea(x, y, width, height, dx, dy); } /** * Draws a line, using the current color, between the points * <code>(x1, y1)</code> and <code>(x2, y2)</code> * in this graphics context's coordinate system. * @param x1 the first point's <i>x</i> coordinate. * @param y1 the first point's <i>y</i> coordinate. * @param x2 the second point's <i>x</i> coordinate. * @param y2 the second point's <i>y</i> coordinate. */ public void drawLine(int x1, int y1, int x2, int y2) { g.drawLine(x1, y1, x2, y2); } /** * Fills the specified rectangle. * The left and right edges of the rectangle are at * <code>x</code> and <code>x + width - 1</code>. * The top and bottom edges are at * <code>y</code> and <code>y + height - 1</code>. * The resulting rectangle covers an area * <code>width</code> pixels wide by * <code>height</code> pixels tall. * The rectangle is filled using the graphics context's current color. * @param x the <i>x</i> coordinate * of the rectangle to be filled. * @param y the <i>y</i> coordinate * of the rectangle to be filled. * @param width the width of the rectangle to be filled. * @param height the height of the rectangle to be filled. * @see java.awt.Graphics#clearRect * @see java.awt.Graphics#drawRect */ public void fillRect(int x, int y, int width, int height) { g.fillRect(x, y, width, height); } /** * Draws the outline of the specified rectangle. * The left and right edges of the rectangle are at * <code>x</code> and <code>x + width</code>. * The top and bottom edges are at * <code>y</code> and <code>y + height</code>. * The rectangle is drawn using the graphics context's current color. * @param x the <i>x</i> coordinate * of the rectangle to be drawn. * @param y the <i>y</i> coordinate * of the rectangle to be drawn. * @param width the width of the rectangle to be drawn. * @param height the height of the rectangle to be drawn. * @see java.awt.Graphics#fillRect * @see java.awt.Graphics#clearRect */ public void drawRect(int x, int y, int width, int height) { g.drawRect(x, y, width, height); } /** * Clears the specified rectangle by filling it with the background * color of the current drawing surface. This operation does not * use the current paint mode. * <p> * Beginning with Java 1.1, the background color * of offscreen images may be system dependent. Applications should * use <code>setColor</code> followed by <code>fillRect</code> to * ensure that an offscreen image is cleared to a specific color. * @param x the <i>x</i> coordinate of the rectangle to clear. * @param y the <i>y</i> coordinate of the rectangle to clear. * @param width the width of the rectangle to clear. * @param height the height of the rectangle to clear. * @see java.awt.Graphics#fillRect(int, int, int, int) * @see java.awt.Graphics#drawRect * @see java.awt.Graphics#setColor(java.awt.Color) * @see java.awt.Graphics#setPaintMode * @see java.awt.Graphics#setXORMode(java.awt.Color) */ public void clearRect(int x, int y, int width, int height) { g.clearRect(x, y, width, height); } /** * Draws an outlined round-cornered rectangle using this graphics * context's current color. The left and right edges of the rectangle * are at <code>x</code> and <code>x + width</code>, * respectively. The top and bottom edges of the rectangle are at * <code>y</code> and <code>y + height</code>. * @param x the <i>x</i> coordinate of the rectangle to be drawn. * @param y the <i>y</i> coordinate of the rectangle to be drawn. * @param width the width of the rectangle to be drawn. * @param height the height of the rectangle to be drawn. * @param arcWidth the horizontal diameter of the arc * at the four corners. * @param arcHeight the vertical diameter of the arc * at the four corners. * @see java.awt.Graphics#fillRoundRect */ public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { g.drawRoundRect(x, y, width, height, arcWidth, arcHeight); } /** * Fills the specified rounded corner rectangle with the current color. * The left and right edges of the rectangle * are at <code>x</code> and <code>x + width - 1</code>, * respectively. The top and bottom edges of the rectangle are at * <code>y</code> and <code>y + height - 1</code>. * @param x the <i>x</i> coordinate of the rectangle to be filled. * @param y the <i>y</i> coordinate of the rectangle to be filled. * @param width the width of the rectangle to be filled. * @param height the height of the rectangle to be filled. * @param arcWidth the horizontal diameter * of the arc at the four corners. * @param arcHeight the vertical diameter * of the arc at the four corners. * @see java.awt.Graphics#drawRoundRect */ public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { g.fillRoundRect(x, y, width, height, arcWidth, arcHeight); } /** * Draws a 3-D highlighted outline of the specified rectangle. * The edges of the rectangle are highlighted so that they * appear to be beveled and lit from the upper left corner. * <p> * The colors used for the highlighting effect are determined * based on the current color. * The resulting rectangle covers an area that is * <code>width + 1</code> pixels wide * by <code>height + 1</code> pixels tall. * @param x the <i>x</i> coordinate of the rectangle to be drawn. * @param y the <i>y</i> coordinate of the rectangle to be drawn. * @param width the width of the rectangle to be drawn. * @param height the height of the rectangle to be drawn. * @param raised a boolean that determines whether the rectangle * appears to be raised above the surface * or sunk into the surface. * @see java.awt.Graphics#fill3DRect */ public void draw3DRect(int x, int y, int width, int height, boolean raised) { g.draw3DRect(x, y, width, height, raised); } /**Lines 1–500 of 1157. Load more
/* * Copyright (c) 2000, 2007, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. Oracle designates this * particular file as subject to the "Classpath" exception as provided * by Oracle in the LICENSE file that accompanied this code. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. */ package sun.print; import java.awt.Color; import java.awt.Font; import java.awt.FontMetrics; import java.awt.Graphics; import java.awt.Image; import java.awt.Polygon; import java.awt.Rectangle; import java.awt.Shape; import java.awt.image.ImageObserver; import java.text.AttributedCharacterIterator; /** * Implements the Graphics API but does all * rendering through a second Graphics instance. * The primary use of this class is to provide * a Graphics instance without the 2D API to * an application, but to implement the rendering * with a Graphics2D instance. */ public class ProxyGraphics extends Graphics { /** * The Graphics instance that performs the * drawing for this Graphics. */ private Graphics g; public ProxyGraphics(Graphics graphics) { g = graphics; } Graphics getGraphics() { return g; } /** * Creates a new <code>Graphics</code> object that is * a copy of this <code>Graphics</code> object. * @return a new graphics context that is a copy of * this graphics context. */ public Graphics create() { return new ProxyGraphics(g.create()); } /** * Creates a new <code>Graphics</code> object based on this * <code>Graphics</code> object, but with a new translation and clip area. * The new <code>Graphics</code> object has its origin * translated to the specified point (<i>x</i>, <i>y</i>). * Its clip area is determined by the intersection of the original * clip area with the specified rectangle. The arguments are all * interpreted in the coordinate system of the original * <code>Graphics</code> object. The new graphics context is * identical to the original, except in two respects: * <p> * <ul> * <li> * The new graphics context is translated by (<i>x</i>, <i>y</i>). * That is to say, the point (<code>0</code>, <code>0</code>) in the * new graphics context is the same as (<i>x</i>, <i>y</i>) in * the original graphics context. * <li> * The new graphics context has an additional clipping rectangle, in * addition to whatever (translated) clipping rectangle it inherited * from the original graphics context. The origin of the new clipping * rectangle is at (<code>0</code>, <code>0</code>), and its size * is specified by the <code>width</code> and <code>height</code> * arguments. * </ul> * <p> * @param x the <i>x</i> coordinate. * @param y the <i>y</i> coordinate. * @param width the width of the clipping rectangle. * @param height the height of the clipping rectangle. * @return a new graphics context. * @see java.awt.Graphics#translate * @see java.awt.Graphics#clipRect */ public Graphics create(int x, int y, int width, int height) { return new ProxyGraphics(g.create(x, y, width, height)); } /** * Translates the origin of the graphics context to the point * (<i>x</i>, <i>y</i>) in the current coordinate system. * Modifies this graphics context so that its new origin corresponds * to the point (<i>x</i>, <i>y</i>) in this graphics context's * original coordinate system. All coordinates used in subsequent * rendering operations on this graphics context will be relative * to this new origin. * @param x the <i>x</i> coordinate. * @param y the <i>y</i> coordinate. */ public void translate(int x, int y) { g.translate(x, y); } /** * Gets this graphics context's current color. * @return this graphics context's current color. * @see java.awt.Color * @see java.awt.Graphics#setColor */ public Color getColor() { return g.getColor(); } /** * Sets this graphics context's current color to the specified * color. All subsequent graphics operations using this graphics * context use this specified color. * @param c the new rendering color. * @see java.awt.Color * @see java.awt.Graphics#getColor */ public void setColor(Color c) { g.setColor(c); } /** * Sets the paint mode of this graphics context to overwrite the * destination with this graphics context's current color. * This sets the logical pixel operation function to the paint or * overwrite mode. All subsequent rendering operations will * overwrite the destination with the current color. */ public void setPaintMode() { g.setPaintMode(); } /** * Sets the paint mode of this graphics context to alternate between * this graphics context's current color and the new specified color. * This specifies that logical pixel operations are performed in the * XOR mode, which alternates pixels between the current color and * a specified XOR color. * <p> * When drawing operations are performed, pixels which are the * current color are changed to the specified color, and vice versa. * <p> * Pixels that are of colors other than those two colors are changed * in an unpredictable but reversible manner; if the same figure is * drawn twice, then all pixels are restored to their original values. * @param c1 the XOR alternation color */ public void setXORMode(Color c1) { g.setXORMode(c1); } /** * Gets the current font. * @return this graphics context's current font. * @see java.awt.Font * @see java.awt.Graphics#setFont */ public Font getFont() { return g.getFont(); } /** * Sets this graphics context's font to the specified font. * All subsequent text operations using this graphics context * use this font. * @param font the font. * @see java.awt.Graphics#getFont * @see java.awt.Graphics#drawString(java.lang.String, int, int) * @see java.awt.Graphics#drawBytes(byte[], int, int, int, int) * @see java.awt.Graphics#drawChars(char[], int, int, int, int) */ public void setFont(Font font) { g.setFont(font); } /** * Gets the font metrics of the current font. * @return the font metrics of this graphics * context's current font. * @see java.awt.Graphics#getFont * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics(Font) */ public FontMetrics getFontMetrics() { return g.getFontMetrics(); } /** * Gets the font metrics for the specified font. * @return the font metrics for the specified font. * @param f the specified font * @see java.awt.Graphics#getFont * @see java.awt.FontMetrics * @see java.awt.Graphics#getFontMetrics() */ public FontMetrics getFontMetrics(Font f) { return g.getFontMetrics(f); } /** * Returns the bounding rectangle of the current clipping area. * This method refers to the user clip, which is independent of the * clipping associated with device bounds and window visibility. * If no clip has previously been set, or if the clip has been * cleared using <code>setClip(null)</code>, this method returns * <code>null</code>. * The coordinates in the rectangle are relative to the coordinate * system origin of this graphics context. * @return the bounding rectangle of the current clipping area, * or <code>null</code> if no clip is set. * @see java.awt.Graphics#getClip * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @see java.awt.Graphics#setClip(Shape) * @since JDK1.1 */ public Rectangle getClipBounds() { return g.getClipBounds(); } /** * Intersects the current clip with the specified rectangle. * The resulting clipping area is the intersection of the current * clipping area and the specified rectangle. If there is no * current clipping area, either because the clip has never been * set, or the clip has been cleared using <code>setClip(null)</code>, * the specified rectangle becomes the new clip. * This method sets the user clip, which is independent of the * clipping associated with device bounds and window visibility. * This method can only be used to make the current clip smaller. * To set the current clip larger, use any of the setClip methods. * Rendering operations have no effect outside of the clipping area. * @param x the x coordinate of the rectangle to intersect the clip with * @param y the y coordinate of the rectangle to intersect the clip with * @param width the width of the rectangle to intersect the clip with * @param height the height of the rectangle to intersect the clip with * @see #setClip(int, int, int, int) * @see #setClip(Shape) */ public void clipRect(int x, int y, int width, int height) { g.clipRect(x, y, width, height); } /** * Sets the current clip to the rectangle specified by the given * coordinates. This method sets the user clip, which is * independent of the clipping associated with device bounds * and window visibility. * Rendering operations have no effect outside of the clipping area. * @param x the <i>x</i> coordinate of the new clip rectangle. * @param y the <i>y</i> coordinate of the new clip rectangle. * @param width the width of the new clip rectangle. * @param height the height of the new clip rectangle. * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(Shape) * @since JDK1.1 */ public void setClip(int x, int y, int width, int height) { g.setClip(x, y, width, height); } /** * Gets the current clipping area. * This method returns the user clip, which is independent of the * clipping associated with device bounds and window visibility. * If no clip has previously been set, or if the clip has been * cleared using <code>setClip(null)</code>, this method returns * <code>null</code>. * @return a <code>Shape</code> object representing the * current clipping area, or <code>null</code> if * no clip is set. * @see java.awt.Graphics#getClipBounds * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @see java.awt.Graphics#setClip(Shape) * @since JDK1.1 */ public Shape getClip() { return g.getClip(); } /** * Sets the current clipping area to an arbitrary clip shape. * Not all objects that implement the <code>Shape</code> * interface can be used to set the clip. The only * <code>Shape</code> objects that are guaranteed to be * supported are <code>Shape</code> objects that are * obtained via the <code>getClip</code> method and via * <code>Rectangle</code> objects. This method sets the * user clip, which is independent of the clipping associated * with device bounds and window visibility. * @param clip the <code>Shape</code> to use to set the clip * @see java.awt.Graphics#getClip() * @see java.awt.Graphics#clipRect * @see java.awt.Graphics#setClip(int, int, int, int) * @since JDK1.1 */ public void setClip(Shape clip) { g.setClip(clip); } /** * Copies an area of the component by a distance specified by * <code>dx</code> and <code>dy</code>. From the point specified * by <code>x</code> and <code>y</code>, this method * copies downwards and to the right. To copy an area of the * component to the left or upwards, specify a negative value for * <code>dx</code> or <code>dy</code>. * If a portion of the source rectangle lies outside the bounds * of the component, or is obscured by another window or component, * <code>copyArea</code> will be unable to copy the associated * pixels. The area that is omitted can be refreshed by calling * the component's <code>paint</code> method. * @param x the <i>x</i> coordinate of the source rectangle. * @param y the <i>y</i> coordinate of the source rectangle. * @param width the width of the source rectangle. * @param height the height of the source rectangle. * @param dx the horizontal distance to copy the pixels. * @param dy the vertical distance to copy the pixels. */ public void copyArea(int x, int y, int width, int height, int dx, int dy) { g.copyArea(x, y, width, height, dx, dy); } /** * Draws a line, using the current color, between the points * <code>(x1, y1)</code> and <code>(x2, y2)</code> * in this graphics context's coordinate system. * @param x1 the first point's <i>x</i> coordinate. * @param y1 the first point's <i>y</i> coordinate. * @param x2 the second point's <i>x</i> coordinate. * @param y2 the second point's <i>y</i> coordinate. */ public void drawLine(int x1, int y1, int x2, int y2) { g.drawLine(x1, y1, x2, y2); } /** * Fills the specified rectangle. * The left and right edges of the rectangle are at * <code>x</code> and <code>x + width - 1</code>. * The top and bottom edges are at * <code>y</code> and <code>y + height - 1</code>. * The resulting rectangle covers an area * <code>width</code> pixels wide by * <code>height</code> pixels tall. * The rectangle is filled using the graphics context's current color. * @param x the <i>x</i> coordinate * of the rectangle to be filled. * @param y the <i>y</i> coordinate * of the rectangle to be filled. * @param width the width of the rectangle to be filled. * @param height the height of the rectangle to be filled. * @see java.awt.Graphics#clearRect * @see java.awt.Graphics#drawRect */ public void fillRect(int x, int y, int width, int height) { g.fillRect(x, y, width, height); } /** * Draws the outline of the specified rectangle. * The left and right edges of the rectangle are at * <code>x</code> and <code>x + width</code>. * The top and bottom edges are at * <code>y</code> and <code>y + height</code>. * The rectangle is drawn using the graphics context's current color. * @param x the <i>x</i> coordinate * of the rectangle to be drawn. * @param y the <i>y</i> coordinate * of the rectangle to be drawn. * @param width the width of the rectangle to be drawn. * @param height the height of the rectangle to be drawn. * @see java.awt.Graphics#fillRect * @see java.awt.Graphics#clearRect */ public void drawRect(int x, int y, int width, int height) { g.drawRect(x, y, width, height); } /** * Clears the specified rectangle by filling it with the background * color of the current drawing surface. This operation does not * use the current paint mode. * <p> * Beginning with Java 1.1, the background color * of offscreen images may be system dependent. Applications should * use <code>setColor</code> followed by <code>fillRect</code> to * ensure that an offscreen image is cleared to a specific color. * @param x the <i>x</i> coordinate of the rectangle to clear. * @param y the <i>y</i> coordinate of the rectangle to clear. * @param width the width of the rectangle to clear. * @param height the height of the rectangle to clear. * @see java.awt.Graphics#fillRect(int, int, int, int) * @see java.awt.Graphics#drawRect * @see java.awt.Graphics#setColor(java.awt.Color) * @see java.awt.Graphics#setPaintMode * @see java.awt.Graphics#setXORMode(java.awt.Color) */ public void clearRect(int x, int y, int width, int height) { g.clearRect(x, y, width, height); } /** * Draws an outlined round-cornered rectangle using this graphics * context's current color. The left and right edges of the rectangle * are at <code>x</code> and <code>x + width</code>, * respectively. The top and bottom edges of the rectangle are at * <code>y</code> and <code>y + height</code>. * @param x the <i>x</i> coordinate of the rectangle to be drawn. * @param y the <i>y</i> coordinate of the rectangle to be drawn. * @param width the width of the rectangle to be drawn. * @param height the height of the rectangle to be drawn. * @param arcWidth the horizontal diameter of the arc * at the four corners. * @param arcHeight the vertical diameter of the arc * at the four corners. * @see java.awt.Graphics#fillRoundRect */ public void drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { g.drawRoundRect(x, y, width, height, arcWidth, arcHeight); } /** * Fills the specified rounded corner rectangle with the current color. * The left and right edges of the rectangle * are at <code>x</code> and <code>x + width - 1</code>, * respectively. The top and bottom edges of the rectangle are at * <code>y</code> and <code>y + height - 1</code>. * @param x the <i>x</i> coordinate of the rectangle to be filled. * @param y the <i>y</i> coordinate of the rectangle to be filled. * @param width the width of the rectangle to be filled. * @param height the height of the rectangle to be filled. * @param arcWidth the horizontal diameter * of the arc at the four corners. * @param arcHeight the vertical diameter * of the arc at the four corners. * @see java.awt.Graphics#drawRoundRect */ public void fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight) { g.fillRoundRect(x, y, width, height, arcWidth, arcHeight); } /** * Draws a 3-D highlighted outline of the specified rectangle. * The edges of the rectangle are highlighted so that they * appear to be beveled and lit from the upper left corner. * <p> * The colors used for the highlighting effect are determined * based on the current color. * The resulting rectangle covers an area that is * <code>width + 1</code> pixels wide * by <code>height + 1</code> pixels tall. * @param x the <i>x</i> coordinate of the rectangle to be drawn. * @param y the <i>y</i> coordinate of the rectangle to be drawn. * @param width the width of the rectangle to be drawn. * @param height the height of the rectangle to be drawn. * @param raised a boolean that determines whether the rectangle * appears to be raised above the surface * or sunk into the surface. * @see java.awt.Graphics#fill3DRect */ public void draw3DRect(int x, int y, int width, int height, boolean raised) { g.draw3DRect(x, y, width, height, raised); } /**