0001: /*
0002: * @(#)NullGraphics.java 1.13 06/10/10
0003: *
0004: * Copyright 1990-2006 Sun Microsystems, Inc. All Rights Reserved.
0005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
0006: *
0007: * This program is free software; you can redistribute it and/or
0008: * modify it under the terms of the GNU General Public License version
0009: * 2 only, as published by the Free Software Foundation.
0010: *
0011: * This program is distributed in the hope that it will be useful, but
0012: * WITHOUT ANY WARRANTY; without even the implied warranty of
0013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
0014: * General Public License version 2 for more details (a copy is
0015: * included at /legal/license.txt).
0016: *
0017: * You should have received a copy of the GNU General Public License
0018: * version 2 along with this work; if not, write to the Free Software
0019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
0020: * 02110-1301 USA
0021: *
0022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
0023: * Clara, CA 95054 or visit www.sun.com if you need additional
0024: * information or have any questions.
0025: *
0026: */
0027:
0028: package sun.awt;
0029:
0030: import java.awt.*;
0031: import java.awt.image.ImageObserver;
0032: import java.text.AttributedCharacterIterator;
0033:
0034: /**
0035: A Graphics object which ignores all draw requests. This is useful
0036: to ensure that a displayable, but not visible, component can get a graphics
0037: object to draw onto without drawing onto the screen.
0038: @author Nicholas Allen
0039: @version 1.7, 08/19/02
0040: */
0041:
0042: public class NullGraphics extends Graphics {
0043: private Color color;
0044: private Rectangle clipBounds;
0045: private Font font;
0046:
0047: public NullGraphics(Component component) {
0048: color = component.getForeground();
0049: if (color == null)
0050: color = Color.black;
0051: font = component.getFont();
0052: if (font == null)
0053: font = new Font("dialog", Font.PLAIN, 12);
0054: }
0055:
0056: private NullGraphics(NullGraphics g) {
0057: color = g.color;
0058: font = g.font;
0059: clipBounds = g.clipBounds;
0060: }
0061:
0062: /**
0063: * Creates a new <code>Graphics</code> object that is
0064: * a copy of this <code>Graphics</code> object.
0065: * @return a new graphics context that is a copy of
0066: * this graphics context.
0067: * @since JDK1.0
0068: */
0069: public Graphics create() {
0070: return new NullGraphics(this );
0071: }
0072:
0073: /**
0074: * Translates the origin of the graphics context to the point
0075: * (<i>x</i>, <i>y</i>) in the current coordinate system.
0076: * Modifies this graphics context so that its new origin corresponds
0077: * to the point (<i>x</i>, <i>y</i>) in this graphics context's
0078: * original coordinate system. All coordinates used in subsequent
0079: * rendering operations on this graphics context will be relative
0080: * to this new origin.
0081: * @param x the <i>x</i> coordinate.
0082: * @param y the <i>y</i> coordinate.
0083: * @since JDK1.0
0084: */
0085: public void translate(int x, int y) {
0086: if (clipBounds != null) {
0087: clipBounds.x -= x;
0088: clipBounds.y -= y;
0089: }
0090: }
0091:
0092: /**
0093: * Gets this graphics context's current color.
0094: * @return this graphics context's current color.
0095: * @see java.awt.Color
0096: * @see java.awt.Graphics#setColor
0097: * @since JDK1.0
0098: */
0099: public Color getColor() {
0100: return color;
0101: }
0102:
0103: /**
0104: * Sets this graphics context's current color to the specified
0105: * color. All subsequent graphics operations using this graphics
0106: * context use this specified color.
0107: * @param c the new rendering color.
0108: * @see java.awt.Color
0109: * @see java.awt.Graphics#getColor
0110: * @since JDK1.0
0111: */
0112: public void setColor(Color c) {
0113: if (c == null)
0114: color = Color.black;
0115: else
0116: color = c;
0117: }
0118:
0119: /**
0120: * Sets the paint mode of this graphics context to overwrite the
0121: * destination with this graphics context's current color.
0122: * This sets the logical pixel operation function to the paint or
0123: * overwrite mode. All subsequent rendering operations will
0124: * overwrite the destination with the current color.
0125: * @since JDK1.0
0126: */
0127: public void setPaintMode() {
0128: }
0129:
0130: /**
0131: * This method sets the graphics context to xor paint mode using
0132: * the "exclusive or" color xorcolor.
0133: * This specifies that logical pixel operations are performed in the
0134: * XOR mode, which alternates pixels between the current color and
0135: * a specified XOR color.
0136: * <p>
0137: * When drawing operations are performed, pixels which are the
0138: * current color are changed to the specified color, and vice versa.
0139: * <p>
0140: * Pixels that are of colors other than those two colors are changed
0141: * in an unpredictable but reversible manner; if the same figure is
0142: * drawn twice, then all pixels are restored to their original values.
0143: * <h3>Compatibility</h3>
0144: * Both PersonalJava and Personal Profile implementations are not required
0145: * to support this method.
0146: * <h3>System Properties</h3>
0147: * The System Property <code>java.awt.graphics.SupportsXorMode</code> is set to
0148: * <code>"true"</code> or <code>"false"</code> indicating if the platform supports
0149: * XOR rendering.
0150: * @param c1 the XOR alternation color
0151: * @exception <code>UnsupportedOperationException</code> if the implementation does
0152: * not support an XOR paint mode.
0153: * @since JDK1.0
0154: */
0155: public void setXORMode(Color c1) {
0156: }
0157:
0158: /**
0159: * Gets the current font.
0160: * @return this graphics context's current font.
0161: * @see java.awt.Font
0162: * @see java.awt.Graphics#setFont
0163: * @since JDK1.0
0164: */
0165: public Font getFont() {
0166: return font;
0167: }
0168:
0169: /**
0170: * Sets this graphics context's font to the specified font.
0171: * All subsequent text operations using this graphics context
0172: * use this font.
0173: * @param font the font.
0174: * @see java.awt.Graphics#getFont
0175: * @see java.awt.Graphics#drawChars
0176: * @see java.awt.Graphics#drawString
0177: * @see java.awt.Graphics#drawBytes
0178: * @since JDK1.0
0179: */
0180: public void setFont(Font font) {
0181: this .font = font;
0182: }
0183:
0184: /**
0185: * Gets the font metrics for the specified font.
0186: * @return the font metrics for the specified font.
0187: * @param f the specified font
0188: * @see java.awt.Graphics#getFont
0189: * @see java.awt.FontMetrics
0190: * @see java.awt.Graphics#getFontMetrics()
0191: * @since JDK1.0
0192: */
0193: public FontMetrics getFontMetrics(Font f) {
0194: return Toolkit.getDefaultToolkit().getFontMetrics(f);
0195: }
0196:
0197: /**
0198: * Returns the bounding rectangle of the current clipping area.
0199: * The coordinates in the rectangle are relative to the coordinate
0200: * system origin of this graphics context.
0201: * @return the bounding rectangle of the current clipping area.
0202: * @see java.awt.Graphics#getClip
0203: * @see java.awt.Graphics#clipRect
0204: * @see java.awt.Graphics#setClip(int, int, int, int)
0205: * @see java.awt.Graphics#setClip(Shape)
0206: * @since JDK1.1
0207: */
0208: public Rectangle getClipBounds() {
0209: return clipBounds;
0210: }
0211:
0212: /**
0213: * Intersects the current clip with the specified rectangle.
0214: * The resulting clipping area is the intersection of the current
0215: * clipping area and the specified rectangle.
0216: * This method can only be used to make the current clip smaller.
0217: * To set the current clip larger, use any of the setClip methods.
0218: * Rendering operations have no effect outside of the clipping area.
0219: * @param x the x coordinate of the rectangle to intersect the clip with
0220: * @param y the y coordinate of the rectangle to intersect the clip with
0221: * @param width the width of the rectangle to intersect the clip with
0222: * @param height the height of the rectangle to intersect the clip with
0223: * @see #setClip(int, int, int, int)
0224: * @see #setClip(Shape)
0225: */
0226: public void clipRect(int x, int y, int width, int height) {
0227: Rectangle rect = new Rectangle(x, y, width, height);
0228: if (clipBounds == null)
0229: clipBounds = rect;
0230: else
0231: clipBounds = clipBounds.union(rect);
0232: }
0233:
0234: /**
0235: * Sets the current clip to the rectangle specified by the given
0236: * coordinates.
0237: * Rendering operations have no effect outside of the clipping area.
0238: * @param x the <i>x</i> coordinate of the new clip rectangle.
0239: * @param y the <i>y</i> coordinate of the new clip rectangle.
0240: * @param width the width of the new clip rectangle.
0241: * @param height the height of the new clip rectangle.
0242: * @see java.awt.Graphics#clipRect
0243: * @see java.awt.Graphics#setClip(Shape)
0244: * @since JDK1.1
0245: */
0246: public void setClip(int x, int y, int width, int height) {
0247: clipBounds = new Rectangle(x, y, width, height);
0248: }
0249:
0250: /**
0251: * Gets the current clipping area.
0252: * @return a <code>Shape</code> object representing the
0253: * current clipping area.
0254: * @see java.awt.Graphics#getClipBounds
0255: * @see java.awt.Graphics#clipRect
0256: * @see java.awt.Graphics#setClip(int, int, int, int)
0257: * @see java.awt.Graphics#setClip(Shape)
0258: * @since JDK1.1
0259: */
0260: public Shape getClip() {
0261: return clipBounds;
0262: }
0263:
0264: /**
0265: * Sets the current clipping area to an arbitrary clip shape.
0266: * Not all objects which implement the <code>Shape</code>
0267: * interface can be used to set the clip. The only
0268: * <code>Shape</code> objects which are guaranteed to be
0269: * supported are <code>Shape</code> objects which are
0270: * obtained via the <code>getClip</code> method and via
0271: * <code>Rectangle</code> objects.
0272: * @see java.awt.Graphics#getClip()
0273: * @see java.awt.Graphics#clipRect
0274: * @see java.awt.Graphics#setClip(int, int, int, int)
0275: * @since JDK1.1
0276: */
0277: public void setClip(Shape clip) {
0278: if (!(clip instanceof Rectangle))
0279: throw new AWTError(
0280: "Only rectangular clip regions supported");
0281: clipBounds = (Rectangle) clip;
0282: }
0283:
0284: /**
0285: * Copies an area of the component by a distance specified by
0286: * <code>dx</code> and <code>dy</code>. From the point specified
0287: * by <code>x</code> and <code>y</code>, this method
0288: * copies downwards and to the right. To copy an area of the
0289: * component to the left or upwards, specify a negative value for
0290: * <code>dx</code> or <code>dy</code>.
0291: * If a portion of the source rectangle lies outside the bounds
0292: * of the component, or is obscured by another window or component,
0293: * <code>copyArea</code> will be unable to copy the associated
0294: * pixels. The area that is omitted can be refreshed by calling
0295: * the component's <code>paint</code> method.
0296: * @param x the <i>x</i> coordinate of the source rectangle.
0297: * @param y the <i>y</i> coordinate of the source rectangle.
0298: * @param width the width of the source rectangle.
0299: * @param height the height of the source rectangle.
0300: * @param dx the horizontal distance to copy the pixels.
0301: * @param dy the vertical distance to copy the pixels.
0302: * @since JDK1.0
0303: */
0304: public void copyArea(int x, int y, int width, int height, int dx,
0305: int dy) {
0306: }
0307:
0308: /**
0309: * Draws a line, using the current color, between the points
0310: * <code>(x1, y1)</code> and <code>(x2, y2)</code>
0311: * in this graphics context's coordinate system.
0312: * @param x1 the first point's <i>x</i> coordinate.
0313: * @param y1 the first point's <i>y</i> coordinate.
0314: * @param x2 the second point's <i>x</i> coordinate.
0315: * @param y2 the second point's <i>y</i> coordinate.
0316: * @since JDK1.0
0317: */
0318: public void drawLine(int x1, int y1, int x2, int y2) {
0319: }
0320:
0321: /**
0322: * Fills the specified rectangle.
0323: * The left and right edges of the rectangle are at
0324: * <code>x</code> and <code>x + width - 1</code>.
0325: * The top and bottom edges are at
0326: * <code>y</code> and <code>y + height - 1</code>.
0327: * The resulting rectangle covers an area
0328: * <code>width</code> pixels wide by
0329: * <code>height</code> pixels tall.
0330: * The rectangle is filled using the graphics context's current color.
0331: * @param x the <i>x</i> coordinate
0332: * of the rectangle to be filled.
0333: * @param y the <i>y</i> coordinate
0334: * of the rectangle to be filled.
0335: * @param width the width of the rectangle to be filled.
0336: * @param height the height of the rectangle to be filled.
0337: * @see java.awt.Graphics#fillRect
0338: * @see java.awt.Graphics#clearRect
0339: * @since JDK1.0
0340: */
0341: public void fillRect(int x, int y, int width, int height) {
0342: }
0343:
0344: /**
0345: * Clears the specified rectangle by filling it with the background
0346: * color of the current drawing surface. This operation does not
0347: * use the current paint mode.
0348: * <p>
0349: * Beginning with Java 1.1, the background color
0350: * of offscreen images may be system dependent. Applications should
0351: * use <code>setColor</code> followed by <code>fillRect</code> to
0352: * ensure that an offscreen image is cleared to a specific color.
0353: * @param x the <i>x</i> coordinate of the rectangle to clear.
0354: * @param y the <i>y</i> coordinate of the rectangle to clear.
0355: * @param width the width of the rectangle to clear.
0356: * @param height the height of the rectangle to clear.
0357: * @see java.awt.Graphics#fillRect(int, int, int, int)
0358: * @see java.awt.Graphics#drawRect
0359: * @see java.awt.Graphics#setColor(java.awt.Color)
0360: * @see java.awt.Graphics#setPaintMode
0361: * @see java.awt.Graphics#setXORMode(java.awt.Color)
0362: * @since JDK1.0
0363: */
0364: public void clearRect(int x, int y, int width, int height) {
0365: }
0366:
0367: /**
0368: * Draws an outlined round-cornered rectangle using this graphics
0369: * context's current color. The left and right edges of the rectangle
0370: * are at <code>x</code> and <code>x + width</code>,
0371: * respectively. The top and bottom edges of the rectangle are at
0372: * <code>y</code> and <code>y + height</code>.
0373: * @param x the <i>x</i> coordinate of the rectangle to be drawn.
0374: * @param y the <i>y</i> coordinate of the rectangle to be drawn.
0375: * @param width the width of the rectangle to be drawn.
0376: * @param height the height of the rectangle to be drawn.
0377: * @param arcWidth the horizontal diameter of the arc
0378: * at the four corners.
0379: * @param arcHeight the vertical diameter of the arc
0380: * at the four corners.
0381: * @see java.awt.Graphics#fillRoundRect
0382: * @since JDK1.0
0383: */
0384: public void drawRoundRect(int x, int y, int width, int height,
0385: int arcWidth, int arcHeight) {
0386: }
0387:
0388: /**
0389: * Fills the specified rounded corner rectangle with the current color.
0390: * The left and right edges of the rectangle
0391: * are at <code>x</code> and <code>x + width - 1</code>,
0392: * respectively. The top and bottom edges of the rectangle are at
0393: * <code>y</code> and <code>y + height - 1</code>.
0394: * @param x the <i>x</i> coordinate of the rectangle to be filled.
0395: * @param y the <i>y</i> coordinate of the rectangle to be filled.
0396: * @param width the width of the rectangle to be filled.
0397: * @param height the height of the rectangle to be filled.
0398: * @param arcWidth the horizontal diameter
0399: * of the arc at the four corners.
0400: * @param arcHeight the vertical diameter
0401: * of the arc at the four corners.
0402: * @see java.awt.Graphics#drawRoundRect
0403: * @since JDK1.0
0404: */
0405: public void fillRoundRect(int x, int y, int width, int height,
0406: int arcWidth, int arcHeight) {
0407: }
0408:
0409: /**
0410: * Draws a 3-D highlighted outline of the specified rectangle.
0411: * The edges of the rectangle are highlighted so that they
0412: * appear to be beveled and lit from the upper left corner.
0413: * <p>
0414: * The colors used for the highlighting effect are determined
0415: * based on the current color.
0416: * The resulting rectangle covers an area that is
0417: * <code>width + 1</code> pixels wide
0418: * by <code>height + 1</code> pixels tall.
0419: * @param x the <i>x</i> coordinate of the rectangle to be drawn.
0420: * @param y the <i>y</i> coordinate of the rectangle to be drawn.
0421: * @param width the width of the rectangle to be drawn.
0422: * @param height the height of the rectangle to be drawn.
0423: * @param raised a boolean that determines whether the rectangle
0424: * appears to be raised above the surface
0425: * or sunk into the surface.
0426: * @see java.awt.Graphics#fill3DRect
0427: * @since JDK1.0
0428: */
0429: public void draw3DRect(int x, int y, int width, int height,
0430: boolean raised) {
0431: }
0432:
0433: /**
0434: * Paints a 3-D highlighted rectangle filled with the current color.
0435: * The edges of the rectangle will be highlighted so that it appears
0436: * as if the edges were beveled and lit from the upper left corner.
0437: * The colors used for the highlighting effect will be determined from
0438: * the current color.
0439: * @param x the <i>x</i> coordinate of the rectangle to be filled.
0440: * @param y the <i>y</i> coordinate of the rectangle to be filled.
0441: * @param width the width of the rectangle to be filled.
0442: * @param height the height of the rectangle to be filled.
0443: * @param raised a boolean value that determines whether the
0444: * rectangle appears to be raised above the surface
0445: * or etched into the surface.
0446: * @see java.awt.Graphics#draw3DRect
0447: * @since JDK1.0
0448: */
0449: public void fill3DRect(int x, int y, int width, int height,
0450: boolean raised) {
0451: }
0452:
0453: /**
0454: * Draws the outline of an oval.
0455: * The result is a circle or ellipse that fits within the
0456: * rectangle specified by the <code>x</code>, <code>y</code>,
0457: * <code>width</code>, and <code>height</code> arguments.
0458: * <p>
0459: * The oval covers an area that is
0460: * <code>width + 1</code> pixels wide
0461: * and <code>height + 1<code> pixels tall.
0462: * @param x the <i>x</i> coordinate of the upper left
0463: * corner of the oval to be drawn.
0464: * @param y the <i>y</i> coordinate of the upper left
0465: * corner of the oval to be drawn.
0466: * @param width the width of the oval to be drawn.
0467: * @param height the height of the oval to be drawn.
0468: * @see java.awt.Graphics#fillOval
0469: * @since JDK1.0
0470: */
0471: public void drawOval(int x, int y, int width, int height) {
0472: }
0473:
0474: /**
0475: * Fills an oval bounded by the specified rectangle with the
0476: * current color.
0477: * @param x the <i>x</i> coordinate of the upper left corner
0478: * of the oval to be filled.
0479: * @param y the <i>y</i> coordinate of the upper left corner
0480: * of the oval to be filled.
0481: * @param width the width of the oval to be filled.
0482: * @param height the height of the oval to be filled.
0483: * @see java.awt.Graphics#drawOval
0484: * @since JDK1.0
0485: */
0486: public void fillOval(int x, int y, int width, int height) {
0487: }
0488:
0489: /**
0490: * Draws the outline of a circular or elliptical arc
0491: * covering the specified rectangle.
0492: * <p>
0493: * The resulting arc begins at <code>startAngle</code> and extends
0494: * for <code>arcAngle</code> degrees, using the current color.
0495: * Angles are interpreted such that 0 degrees
0496: * is at the 3 o'clock position.
0497: * A positive value indicates a counter-clockwise rotation
0498: * while a negative value indicates a clockwise rotation.
0499: * <p>
0500: * The center of the arc is the center of the rectangle whose origin
0501: * is (<i>x</i>, <i>y</i>) and whose size is specified by the
0502: * <code>width</code> and <code>height</code> arguments.
0503: * <p>
0504: * The resulting arc covers an area
0505: * <code>width + 1</code> pixels wide
0506: * by <code>height + 1</code> pixels tall.
0507: * @param x the <i>x</i> coordinate of the
0508: * upper-left corner of the arc to be drawn.
0509: * @param y the <i>y</i> coordinate of the
0510: * upper-left corner of the arc to be drawn.
0511: * @param width the width of the arc to be drawn.
0512: * @param height the height of the arc to be drawn.
0513: * @param startAngle the beginning angle.
0514: * @param arcAngle the angular extent of the arc,
0515: * relative to the start angle.
0516: * @see java.awt.Graphics#fillArc
0517: * @since JDK1.0
0518: */
0519: public void drawArc(int x, int y, int width, int height,
0520: int startAngle, int arcAngle) {
0521: }
0522:
0523: /**
0524: * Fills a circular or elliptical arc covering the specified rectangle.
0525: * <p>
0526: * The resulting arc begins at <code>startAngle</code> and extends
0527: * for <code>arcAngle</code> degrees.
0528: * Angles are interpreted such that 0 degrees
0529: * is at the 3 o'clock position.
0530: * A positive value indicates a counter-clockwise rotation
0531: * while a negative value indicates a clockwise rotation.
0532: * <p>
0533: * The center of the arc is the center of the rectangle whose origin
0534: * is (<i>x</i>, <i>y</i>) and whose size is specified by the
0535: * <code>width</code> and <code>height</code> arguments.
0536: * <p>
0537: * The resulting arc covers an area
0538: * <code>width + 1</code> pixels wide
0539: * by <code>height + 1</code> pixels tall.
0540: * @param x the <i>x</i> coordinate of the
0541: * upper-left corner of the arc to be filled.
0542: * @param y the <i>y</i> coordinate of the
0543: * upper-left corner of the arc to be filled.
0544: * @param width the width of the arc to be filled.
0545: * @param height the height of the arc to be filled.
0546: * @param startAngle the beginning angle.
0547: * @param arcAngle the angular extent of the arc,
0548: * relative to the start angle.
0549: * @see java.awt.Graphics#drawArc
0550: * @since JDK1.0
0551: */
0552: public void fillArc(int x, int y, int width, int height,
0553: int startAngle, int arcAngle) {
0554: }
0555:
0556: /**
0557: * Draws a sequence of connected lines defined by
0558: * arrays of <i>x</i> and <i>y</i> coordinates.
0559: * Each pair of (<i>x</i>, <i>y</i>) coordinates defines a point.
0560: * The figure is not closed if the first point
0561: * differs from the last point.
0562: * @param xPoints an array of <i>x</i> points
0563: * @param yPoints an array of <i>y</i> points
0564: * @param nPoints the total number of points
0565: * @see java.awt.Graphics#drawPolygon(int[], int[], int)
0566: * @since JDK1.1
0567: */
0568: public void drawPolyline(int xPoints[], int yPoints[], int nPoints) {
0569: }
0570:
0571: /**
0572: * Draws a closed polygon defined by
0573: * arrays of <i>x</i> and <i>y</i> coordinates.
0574: * Each pair of (<i>x</i>, <i>y</i>) coordinates defines a point.
0575: * <p>
0576: * This method draws the polygon defined by <code>nPoint</code> line
0577: * segments, where the first <code>nPoint - 1</code>
0578: * line segments are line segments from
0579: * <code>(xPoints[i - 1], yPoints[i - 1])</code>
0580: * to <code>(xPoints[i], yPoints[i])</code>, for
0581: * 1 ≤ <i>i</i> ≤ <code>nPoints</code>.
0582: * The figure is automatically closed by drawing a line connecting
0583: * the final point to the first point, if those points are different.
0584: * @param xPoints a an array of <code>x</code> coordinates.
0585: * @param yPoints a an array of <code>y</code> coordinates.
0586: * @param nPoints a the total number of points.
0587: * @see java.awt.Graphics#fillPolygon
0588: * @see java.awt.Graphics#drawPolyline
0589: * @since JDK1.0
0590: */
0591: public void drawPolygon(int xPoints[], int yPoints[], int nPoints) {
0592: }
0593:
0594: /**
0595: * Draws the outline of a polygon defined by the specified
0596: * <code>Polygon</code> object.
0597: * @param p the polygon to draw.
0598: * @see java.awt.Graphics#fillPolygon
0599: * @see java.awt.Graphics#drawPolyline
0600: * @since JDK1.0
0601: */
0602: public void drawPolygon(Polygon p) {
0603: }
0604:
0605: /**
0606: * Fills a closed polygon defined by
0607: * arrays of <i>x</i> and <i>y</i> coordinates.
0608: * <p>
0609: * This method draws the polygon defined by <code>nPoint</code> line
0610: * segments, where the first <code>nPoint - 1</code>
0611: * line segments are line segments from
0612: * <code>(xPoints[i - 1], yPoints[i - 1])</code>
0613: * to <code>(xPoints[i], yPoints[i])</code>, for
0614: * 1 ≤ <i>i</i> ≤ <code>nPoints</code>.
0615: * The figure is automatically closed by drawing a line connecting
0616: * the final point to the first point, if those points are different.
0617: * <p>
0618: * The area inside the polygon is defined using an
0619: * even-odd fill rule, also known as the alternating rule.
0620: * @param xPoints a an array of <code>x</code> coordinates.
0621: * @param yPoints a an array of <code>y</code> coordinates.
0622: * @param nPoints a the total number of points.
0623: * @see java.awt.Graphics#drawPolygon(int[], int[], int)
0624: * @since JDK1.0
0625: */
0626: public void fillPolygon(int xPoints[], int yPoints[], int nPoints) {
0627: }
0628:
0629: /**
0630: * Fills the polygon defined by the specified Polygon object with
0631: * the graphics context's current color.
0632: * <p>
0633: * The area inside the polygon is defined using an
0634: * even-odd fill rule, also known as the alternating rule.
0635: * @param p the polygon to fill.
0636: * @see java.awt.Graphics#drawPolygon(int[], int[], int)
0637: * @since JDK1.0
0638: */
0639: public void fillPolygon(Polygon p) {
0640: }
0641:
0642: /**
0643: * Draws the text given by the specified string, using this
0644: * graphics context's current font and color. The baseline of the
0645: * first character is at position (<i>x</i>, <i>y</i>) in this
0646: * graphics context's coordinate system.
0647: * @param str the string to be drawn.
0648: * @param x the <i>x</i> coordinate.
0649: * @param y the <i>y</i> coordinate.
0650: * @see java.awt.Graphics#drawBytes
0651: * @see java.awt.Graphics#drawChars
0652: * @since JDK1.0
0653: */
0654: public void drawString(String str, int x, int y) {
0655: }
0656:
0657: /**
0658: * Draws the text given by the specified iterator, using this
0659: * graphics context's current color. The iterator has to specify a font
0660: * for each character. The baseline of the
0661: * leftmost character is at position (<i>x</i>, <i>y</i>) in this
0662: * graphics context's coordinate system.
0663: * @param iterator the iterator whose text is to be drawn
0664: * @param x the <i>x</i> coordinate.
0665: * @param y the <i>y</i> coordinate.
0666: * @see java.awt.Graphics#drawBytes
0667: * @see java.awt.Graphics#drawChars
0668: */
0669: public void drawString(AttributedCharacterIterator iterator, int x,
0670: int y) {
0671: }
0672:
0673: /**
0674: * Draws the text given by the specified character array, using this
0675: * graphics context's current font and color. The baseline of the
0676: * first character is at position (<i>x</i>, <i>y</i>) in this
0677: * graphics context's coordinate system.
0678: * @param data the array of characters to be drawn
0679: * @param offset the start offset in the data
0680: * @param length the number of characters to be drawn
0681: * @param x the <i>x</i> coordinate of the baseline of the text
0682: * @param y the <i>y</i> coordinate of the baseline of the text
0683: * @see java.awt.Graphics#drawBytes
0684: * @see java.awt.Graphics#drawString
0685: * @since JDK1.0
0686: */
0687: public void drawChars(char data[], int offset, int length, int x,
0688: int y) {
0689: }
0690:
0691: /**
0692: * Draws the text given by the specified byte array, using this
0693: * graphics context's current font and color. The baseline of the
0694: * first character is at position (<i>x</i>, <i>y</i>) in this
0695: * graphics context's coordinate system.
0696: * @param data the data to be drawn
0697: * @param offset the start offset in the data
0698: * @param length the number of bytes that are drawn
0699: * @param x the <i>x</i> coordinate of the baseline of the text
0700: * @param y the <i>y</i> coordinate of the baseline of the text
0701: * @see java.awt.Graphics#drawChars
0702: * @see java.awt.Graphics#drawString
0703: * @since JDK1.0
0704: */
0705: public void drawBytes(byte data[], int offset, int length, int x,
0706: int y) {
0707: }
0708:
0709: /**
0710: * Draws as much of the specified image as is currently available.
0711: * The image is drawn with its top-left corner at
0712: * (<i>x</i>, <i>y</i>) in this graphics context's coordinate
0713: * space. Transparent pixels in the image do not affect whatever
0714: * pixels are already there.
0715: * <p>
0716: * This method returns immediately in all cases, even if the
0717: * complete image has not yet been loaded, and it has not been dithered
0718: * and converted for the current output device.
0719: * <p>
0720: * If the image has not yet been completely loaded, then
0721: * <code>drawImage</code> returns <code>false</code>. As more of
0722: * the image becomes available, the process that draws the image notifies
0723: * the specified image observer.
0724: * @param img the specified image to be drawn.
0725: * @param x the <i>x</i> coordinate.
0726: * @param y the <i>y</i> coordinate.
0727: * @param observer object to be notified as more of
0728: * the image is converted.
0729: * @see java.awt.Image
0730: * @see java.awt.image.ImageObserver
0731: * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
0732: * @since JDK1.0
0733: */
0734: public boolean drawImage(Image img, int x, int y,
0735: ImageObserver observer) {
0736: return false;
0737: }
0738:
0739: /**
0740: * Draws as much of the specified image as has already been scaled
0741: * to fit inside the specified rectangle.
0742: * <p>
0743: * The image is drawn inside the specified rectangle of this
0744: * graphics context's coordinate space, and is scaled if
0745: * necessary. Transparent pixels do not affect whatever pixels
0746: * are already there.
0747: * <p>
0748: * This method returns immediately in all cases, even if the
0749: * entire image has not yet been scaled, dithered, and converted
0750: * for the current output device.
0751: * If the current output representation is not yet complete, then
0752: * <code>drawImage</code> returns <code>false</code>. As more of
0753: * the image becomes available, the process that draws the image notifies
0754: * the image observer by calling its <code>imageUpdate</code> method.
0755: * <p>
0756: * A scaled version of an image will not necessarily be
0757: * available immediately just because an unscaled version of the
0758: * image has been constructed for this output device. Each size of
0759: * the image may be cached separately and generated from the original
0760: * data in a separate image production sequence.
0761: * @param img the specified image to be drawn.
0762: * @param x the <i>x</i> coordinate.
0763: * @param y the <i>y</i> coordinate.
0764: * @param width the width of the rectangle.
0765: * @param height the height of the rectangle.
0766: * @param observer object to be notified as more of
0767: * the image is converted.
0768: * @see java.awt.Image
0769: * @see java.awt.image.ImageObserver
0770: * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
0771: * @since JDK1.0
0772: */
0773: public boolean drawImage(Image img, int x, int y, int width,
0774: int height, ImageObserver observer) {
0775: return false;
0776: }
0777:
0778: /**
0779: * Draws as much of the specified image as is currently available.
0780: * The image is drawn with its top-left corner at
0781: * (<i>x</i>, <i>y</i>) in this graphics context's coordinate
0782: * space. Transparent pixels are drawn in the specified
0783: * background color.
0784: * <p>
0785: * This operation is equivalent to filling a rectangle of the
0786: * width and height of the specified image with the given color and then
0787: * drawing the image on top of it, but possibly more efficient.
0788: * <p>
0789: * This method returns immediately in all cases, even if the
0790: * complete image has not yet been loaded, and it has not been dithered
0791: * and converted for the current output device.
0792: * <p>
0793: * If the image has not yet been completely loaded, then
0794: * <code>drawImage</code> returns <code>false</code>. As more of
0795: * the image becomes available, the process that draws the image notifies
0796: * the specified image observer.
0797: * @param img the specified image to be drawn.
0798: * @param x the <i>x</i> coordinate.
0799: * @param y the <i>y</i> coordinate.
0800: * @param bgcolor the background color to paint under the
0801: * non-opaque portions of the image.
0802: * @param observer object to be notified as more of
0803: * the image is converted.
0804: * @see java.awt.Image
0805: * @see java.awt.image.ImageObserver
0806: * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
0807: * @since JDK1.0
0808: */
0809: public boolean drawImage(Image img, int x, int y, Color bgcolor,
0810: ImageObserver observer) {
0811: return false;
0812: }
0813:
0814: /**
0815: * Draws as much of the specified image as has already been scaled
0816: * to fit inside the specified rectangle.
0817: * <p>
0818: * The image is drawn inside the specified rectangle of this
0819: * graphics context's coordinate space, and is scaled if
0820: * necessary. Transparent pixels are drawn in the specified
0821: * background color.
0822: * This operation is equivalent to filling a rectangle of the
0823: * width and height of the specified image with the given color and then
0824: * drawing the image on top of it, but possibly more efficient.
0825: * <p>
0826: * This method returns immediately in all cases, even if the
0827: * entire image has not yet been scaled, dithered, and converted
0828: * for the current output device.
0829: * If the current output representation is not yet complete then
0830: * <code>drawImage</code> returns <code>false</code>. As more of
0831: * the image becomes available, the process that draws the image notifies
0832: * the specified image observer.
0833: * <p>
0834: * A scaled version of an image will not necessarily be
0835: * available immediately just because an unscaled version of the
0836: * image has been constructed for this output device. Each size of
0837: * the image may be cached separately and generated from the original
0838: * data in a separate image production sequence.
0839: * @param img the specified image to be drawn.
0840: * @param x the <i>x</i> coordinate.
0841: * @param y the <i>y</i> coordinate.
0842: * @param width the width of the rectangle.
0843: * @param height the height of the rectangle.
0844: * @param bgcolor the background color to paint under the
0845: * non-opaque portions of the image.
0846: * @param observer object to be notified as more of
0847: * the image is converted.
0848: * @see java.awt.Image
0849: * @see java.awt.image.ImageObserver
0850: * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
0851: * @since JDK1.0
0852: */
0853: public boolean drawImage(Image img, int x, int y, int width,
0854: int height, Color bgcolor, ImageObserver observer) {
0855: return false;
0856: }
0857:
0858: /**
0859: * Draws as much of the specified area of the specified image as is
0860: * currently available, scaling it on the fly to fit inside the
0861: * specified area of the destination drawable surface. Transparent pixels
0862: * do not affect whatever pixels are already there.
0863: * <p>
0864: * This method returns immediately in all cases, even if the
0865: * image area to be drawn has not yet been scaled, dithered, and converted
0866: * for the current output device.
0867: * If the current output representation is not yet complete then
0868: * <code>drawImage</code> returns <code>false</code>. As more of
0869: * the image becomes available, the process that draws the image notifies
0870: * the specified image observer.
0871: * <p>
0872: * This method always uses the unscaled version of the image
0873: * to render the scaled rectangle and performs the required
0874: * scaling on the fly. It does not use a cached, scaled version
0875: * of the image for this operation. Scaling of the image from source
0876: * to destination is performed such that the first coordinate
0877: * of the source rectangle is mapped to the first coordinate of
0878: * the destination rectangle, and the second source coordinate is
0879: * mapped to the second destination coordinate. The subimage is
0880: * scaled and flipped as needed to preserve those mappings.
0881: * @param img the specified image to be drawn
0882: * @param dx1 the <i>x</i> coordinate of the first corner of the
0883: * destination rectangle.
0884: * @param dy1 the <i>y</i> coordinate of the first corner of the
0885: * destination rectangle.
0886: * @param dx2 the <i>x</i> coordinate of the second corner of the
0887: * destination rectangle.
0888: * @param dy2 the <i>y</i> coordinate of the second corner of the
0889: * destination rectangle.
0890: * @param sx1 the <i>x</i> coordinate of the first corner of the
0891: * source rectangle.
0892: * @param sy1 the <i>y</i> coordinate of the first corner of the
0893: * source rectangle.
0894: * @param sx2 the <i>x</i> coordinate of the second corner of the
0895: * source rectangle.
0896: * @param sy2 the <i>y</i> coordinate of the second corner of the
0897: * source rectangle.
0898: * @param observer object to be notified as more of the image is
0899: * scaled and converted.
0900: * @see java.awt.Image
0901: * @see java.awt.image.ImageObserver
0902: * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
0903: * @since JDK1.1
0904: */
0905: public boolean drawImage(Image img, int dx1, int dy1, int dx2,
0906: int dy2, int sx1, int sy1, int sx2, int sy2,
0907: ImageObserver observer) {
0908: return false;
0909: }
0910:
0911: /**
0912: * Draws as much of the specified area of the specified image as is
0913: * currently available, scaling it on the fly to fit inside the
0914: * specified area of the destination drawable surface.
0915: * <p>
0916: * Transparent pixels are drawn in the specified background color.
0917: * This operation is equivalent to filling a rectangle of the
0918: * width and height of the specified image with the given color and then
0919: * drawing the image on top of it, but possibly more efficient.
0920: * <p>
0921: * This method returns immediately in all cases, even if the
0922: * image area to be drawn has not yet been scaled, dithered, and converted
0923: * for the current output device.
0924: * If the current output representation is not yet complete then
0925: * <code>drawImage</code> returns <code>false</code>. As more of
0926: * the image becomes available, the process that draws the image notifies
0927: * the specified image observer.
0928: * <p>
0929: * This method always uses the unscaled version of the image
0930: * to render the scaled rectangle and performs the required
0931: * scaling on the fly. It does not use a cached, scaled version
0932: * of the image for this operation. Scaling of the image from source
0933: * to destination is performed such that the first coordinate
0934: * of the source rectangle is mapped to the first coordinate of
0935: * the destination rectangle, and the second source coordinate is
0936: * mapped to the second destination coordinate. The subimage is
0937: * scaled and flipped as needed to preserve those mappings.
0938: * @param img the specified image to be drawn
0939: * @param dx1 the <i>x</i> coordinate of the first corner of the
0940: * destination rectangle.
0941: * @param dy1 the <i>y</i> coordinate of the first corner of the
0942: * destination rectangle.
0943: * @param dx2 the <i>x</i> coordinate of the second corner of the
0944: * destination rectangle.
0945: * @param dy2 the <i>y</i> coordinate of the second corner of the
0946: * destination rectangle.
0947: * @param sx1 the <i>x</i> coordinate of the first corner of the
0948: * source rectangle.
0949: * @param sy1 the <i>y</i> coordinate of the first corner of the
0950: * source rectangle.
0951: * @param sx2 the <i>x</i> coordinate of the second corner of the
0952: * source rectangle.
0953: * @param sy2 the <i>y</i> coordinate of the second corner of the
0954: * source rectangle.
0955: * @param bgcolor the background color to paint under the
0956: * non-opaque portions of the image.
0957: * @param observer object to be notified as more of the image is
0958: * scaled and converted.
0959: * @see java.awt.Image
0960: * @see java.awt.image.ImageObserver
0961: * @see java.awt.image.ImageObserver#imageUpdate(java.awt.Image, int, int, int, int, int)
0962: * @since JDK1.1
0963: */
0964: public boolean drawImage(Image img, int dx1, int dy1, int dx2,
0965: int dy2, int sx1, int sy1, int sx2, int sy2, Color bgcolor,
0966: ImageObserver observer) {
0967: return false;
0968: }
0969:
0970: /**
0971: * Disposes of this graphics context and releases
0972: * any system resources that it is using.
0973: * A <code>Graphics</code> object cannot be used after
0974: * <code>dispose</code>has been called.
0975: * <p>
0976: * When a Java program runs, a large number of <code>Graphics</code>
0977: * objects can be created within a short time frame.
0978: * Although the finalization process of the garbage collector
0979: * also disposes of the same system resources, it is preferable
0980: * to manually free the associated resources by calling this
0981: * method rather than to rely on a finalization process which
0982: * may not run to completion for a long period of time.
0983: * <p>
0984: * Graphics objects which are provided as arguments to the
0985: * <code>paint</code> and <code>update</code> methods
0986: * of components are automatically released by the system when
0987: * those methods return. For efficiency, programmers should
0988: * call <code>dispose</code> when finished using
0989: * a <code>Graphics</code> object only if it was created
0990: * directly from a component or another <code>Graphics</code> object.
0991: * @see java.awt.Graphics#finalize
0992: * @see java.awt.Component#paint
0993: * @see java.awt.Component#update
0994: * @see java.awt.Component#getGraphics
0995: * @see java.awt.Graphics#create
0996: * @since JDK1.0
0997: */
0998: public void dispose() {
0999: }
1000: }
|