⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graphics.java

📁 this gcc-g++-3.3.1.tar.gz is a source file of gcc, you can learn more about gcc through this codes f
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
/* Graphics.java -- Abstract Java drawing class   Copyright (C) 1999, 2000, 2002 Free Software Foundation, Inc.This file is part of GNU Classpath.GNU Classpath is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2, or (at your option)any later version.GNU Classpath is distributed in the hope that it will be useful, butWITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNUGeneral Public License for more details.You should have received a copy of the GNU General Public Licensealong with GNU Classpath; see the file COPYING.  If not, write to theFree Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA02111-1307 USA.Linking this library statically or dynamically with other modules ismaking a combined work based on this library.  Thus, the terms andconditions of the GNU General Public License cover the wholecombination.As a special exception, the copyright holders of this library give youpermission to link this library with independent modules to produce anexecutable, regardless of the license terms of these independentmodules, and to copy and distribute the resulting executable underterms of your choice, provided that you also meet, for each linkedindependent module, the terms and conditions of the license of thatmodule.  An independent module is a module which is not derived fromor based on this library.  If you modify this library, you may extendthis exception to your version of the library, but you are notobligated to do so.  If you do not wish to do so, delete thisexception statement from your version. */package java.awt;import java.awt.image.ImageObserver;/**  * This is the abstract superclass of classes for drawing to graphics  * devices such as the screen or printers.  *  * @author Aaron M. Renn (arenn@urbanophile.com)  * @author Warren Levy <warrenl@cygnus.com>  */public abstract class Graphics{/* * Instance Variables *//*************************************************************************//* * Constructors *//**  * Default constructor for subclasses.  */protectedGraphics(){}/*************************************************************************//* * Instance Methods *//**  * Returns a copy of this <code>Graphics</code> object.  *  * @return A copy of this object.  */public abstract Graphicscreate();/*************************************************************************//**  * Returns a copy of this <code>Graphics</code> object.  The origin point  * will be translated to the point (x, y) and the cliping rectangle set  * to the intersection of the clipping rectangle in this object and the  * rectangle specified by the parameters to this method.  *  * @param x The new X coordinate of the clipping region rect.  * @param y The new Y coordinate of the clipping region rect.  * @param width The width of the clipping region intersect rectangle.   * @param height The height of the clipping region intersect rectangle.   *  * @return A copy of this object, modified as specified.  */public Graphicscreate(int x, int y, int width, int height){  Graphics g = create();  g.translate(x, y);  // FIXME: I'm not sure if this will work.  Are the old clip rect bounds  // translated above?  g.clipRect(0, 0, width, height);  return(g);}/*************************************************************************//**  * Translates this context so that its new origin point is the point  * (x, y).  *  * @param x The new X coordinate of the origin.  * @param y The new Y coordinate of the origin.  */public abstract voidtranslate(int x, int y);/*************************************************************************//**  * Returns the current color for this object.  *  * @return The color for this object.  */public abstract ColorgetColor();/*************************************************************************//**  * Sets the current color for this object.  *  * @param color The new color.  */public abstract voidsetColor(Color color);/*************************************************************************//**  * Sets this context into "paint" mode, where the target pixels are  * completely overwritten when drawn on.  */public abstract voidsetPaintMode();/*************************************************************************//**  * Sets this context info "XOR" mode, where the targe pixles are  * XOR-ed when drawn on.   *  * @param color The color to XOR against.  */public abstract voidsetXORMode(Color color);  /*************************************************************************//**  * Returns the current font for this graphics context.  *  * @return The current font.  */public abstract FontgetFont();/*************************************************************************//**  * Sets the font for this graphics context to the specified value.  *  * @param font The new font.  */public abstract voidsetFont(Font font);/*************************************************************************//**  * Returns the font metrics for the current font.  *  * @return The font metrics for the current font.  */public FontMetricsgetFontMetrics(){  return(getFontMetrics(getFont()));}/*************************************************************************//**  * Returns the font metrics for the specified font.  *  * @param font The font to return metrics for.  *  * @return The requested font metrics.  */public abstract FontMetricsgetFontMetrics(Font font);/*************************************************************************//**  * Returns the bounding rectangle of the clipping region for this   * graphics context.  *  * @return The bounding rectangle for the clipping region.  */public abstract RectanglegetClipBounds();/*************************************************************************//**  * Returns the bounding rectangle of the clipping region for this   * graphics context.  *  * @return The bounding rectangle for the clipping region.  *  * @deprecated This method is deprecated in favor of  * <code>getClipBounds()</code>.  */public RectanglegetClipRect(){  return(getClipBounds());}/*************************************************************************//**  * Sets the clipping region to the intersection of the current clipping  * region and the rectangle determined by the specified parameters.  *  * @param x The X coordinate of the upper left corner of the intersect rect.  * @param Y The Y coordinate of the upper left corner of the intersect rect.  * @param width The width of the intersect rect.  * @param height The height of the intersect rect.  */public abstract voidclipRect(int x, int y, int width, int height);/*************************************************************************//**  * Sets the clipping region to the rectangle determined by the specified  * parameters.  *  * @param x The X coordinate of the upper left corner of the rect.  * @param y The Y coordinate of the upper left corner of the rect.  * @param width The width of the rect.  * @param height The height of the rect.  */public abstract voidsetClip(int x, int y, int width, int height);/*************************************************************************//**  * Returns the current clipping region as a <code>Shape</code> object.  *  * @return The clipping region as a <code>Shape</code>.  */public abstract ShapegetClip();/*************************************************************************//**  * Sets the clipping region to the specified <code>Shape</code>.  *  * @param shape The new clipping region.  */public abstract voidsetClip(Shape clip);/*************************************************************************//**  * Copies the specified rectangle to the specified offset location.  *  * @param x The X coordinate of the upper left corner of the copy rect.  * @param y The Y coordinate of the upper left corner of the copy rect.  * @param width The width of the copy rect.  * @param height The height of the copy rect.  * @param dx The offset from the X value to start drawing.  * @param dy The offset from the Y value to start drawing.  */public abstract voidcopyArea(int x, int y, int width, int height, int dx, int dy);/*************************************************************************//**  * Draws a line between the two specified points.  *  * @param x1 The X coordinate of the first point.  * @param y1 The Y coordinate of the first point.  * @param x2 The X coordinate of the second point.  * @param y2 The Y coordinate of the second point.  */public abstract voiddrawLine(int x1, int y1, int x2, int y2);/*************************************************************************//**  * Fills the area bounded by the specified rectangle.  *  * @param x The X coordinate of the upper left corner of the fill rect.  * @param y The Y coordinate of the upper left corner of the fill rect.  * @param width The width of the fill rect.  * @param height The height of the fill rect.  */public abstract voidfillRect(int x, int y, int width, int height); /*************************************************************************//**  * Draws the outline of the specified rectangle.  *  * @param x The X coordinate of the upper left corner of the draw rect.  * @param y The Y coordinate of the upper left corner of the draw rect.  * @param width The width of the draw rect.  * @param height The height of the draw rect.  */public voiddrawRect(int x, int y, int width, int height){  int x1 = x;  int y1 = y;  int x2 = x + width;  int y2 = y + height;  drawLine(x1, y1, x2, y1);  drawLine(x2, y1, x2, y2);  drawLine(x2, y2, x1, y2);  drawLine(x1, y2, x1, y1);}/*************************************************************************//**  * Clears the specified rectangle.  *  * @param x The X coordinate of the upper left corner of the clear rect.  * @param y The Y coordinate of the upper left corner of the clear rect.  * @param width The width of the clear rect.  * @param height The height of the clear rect.  */public abstract voidclearRect(int x, int y, int width, int height);/*************************************************************************//**  * Draws the outline of the specified rectangle with rounded cornders.  *  * @param x The X coordinate of the upper left corner of the draw rect.  * @param y The Y coordinate of the upper left corner of the draw rect.  * @param width The width of the draw rect.  * @param height The height of the draw rect.  * @param arcWidth The width of the corner arcs.  * @param arcHeigth The height of the corner arcs.  */public abstract voiddrawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);/*************************************************************************//**  * Fills the specified rectangle with rounded cornders.  *  * @param x The X coordinate of the upper left corner of the fill rect.  * @param y The Y coordinate of the upper left corner of the fill rect.  * @param width The width of the fill rect.  * @param height The height of the fill rect.  * @param arcWidth The width of the corner arcs.  * @param arcHeigth The height of the corner arcs.  */public abstract voidfillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight);/*************************************************************************/public voiddraw3DRect(int x, int y, int width, int height, boolean raised){  Color color = getColor();  Color tl = color.brighter();  Color br = color.darker();      if (!raised)    {

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -