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

📄 graphics.java

📁 gcc的组建
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
        tl = br;        br = tmp;      }        int x1 = x;    int y1 = y;    int x2 = x + width;    int y2 = y + height;        setColor(tl);    drawLine(x1, y1, x2, y1);    drawLine(x1, y2, x1, y1);    setColor(br);    drawLine(x2, y1, x2, y2);    drawLine(x2, y2, x1, y2);    setColor(color);  }  /**   * Fills the specified rectangle with a 3D effect   *   * @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 raised <code>true</code> if the rectangle appears raised,   * <code>false</code> if it should appear etched.   */  public void fill3DRect(int x, int y, int width, int height, boolean raised)  {    fillRect(x, y, width, height);    draw3DRect(x, y, width-1, height-1, raised);  }  /**   * Draws an oval that just fits within the specified rectangle.   *   * @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 void drawOval(int x, int y, int width, int height);  /**   * Fills an oval that just fits within the specified rectangle.   *   * @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 void fillOval(int x, int y, int width, int height);  /**   * Draws an arc using the specified bounding rectangle and the specified   * angle parameter.  The arc is centered at the center of the rectangle.   * The arc starts at the arcAngle position and extend for arcAngle   * degrees.  The degree origin is at the 3 o'clock position.   *   * @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.   * @param arcStart The beginning angle of the arc.   * @param arcAngle The extent of the arc.   */  public abstract void drawArc(int x, int y, int width, int height,                               int arcStart, int arcAngle);  /**   * Fills the arc define by the specified bounding rectangle and the specified   * angle parameter.  The arc is centered at the center of the rectangle.   * The arc starts at the arcAngle position and extend for arcAngle   * degrees.  The degree origin is at the 3 o'clock position.   *   * @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.   * @param arcStart The beginning angle of the arc.   * @param arcAngle The extent of the arc.   */  public abstract void fillArc(int x, int y, int width, int height,                               int arcStart, int arcAngle);  /**   * Draws a series of interconnected lines determined by the arrays   * of corresponding x and y coordinates.   *   * @param xPoints The X coordinate array.   * @param yPoints The Y coordinate array.   * @param npoints The number of points to draw.   */  public abstract void drawPolyline(int xPoints[], int yPoints[], int npoints);  /**   * Draws a series of interconnected lines determined by the arrays   * of corresponding x and y coordinates.  The figure is closed if necessary   * by connecting the first and last points.   *   * @param xPoints The X coordinate array.   * @param yPoints The Y coordinate array.   * @param npoints The number of points to draw.   */  public abstract void drawPolygon(int xPoints[], int yPoints[], int npoints);  /**   * Draws the specified polygon.   *   * @param polygon The polygon to draw.   */  public void drawPolygon(Polygon polygon)  {    drawPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);  }  /**   * Fills the polygon determined by the arrays   * of corresponding x and y coordinates.   *   * @param xPoints The X coordinate array.   * @param yPoints The Y coordinate array.   * @param npoints The number of points to draw.   */  public abstract void fillPolygon(int xPoints[], int yPoints[], int npoints);  /**   * Fills the specified polygon   *   * @param polygon The polygon to fill.   */  public void fillPolygon(Polygon polygon)  {    fillPolygon(polygon.xpoints, polygon.ypoints, polygon.npoints);  }  /**   * Draws the specified string starting at the specified point.   *   * @param string The string to draw.   * @param x The X coordinate of the point to draw at.   * @param y The Y coordinate of the point to draw at.   */  public abstract void drawString(String string, int x, int y);  public abstract void drawString (AttributedCharacterIterator ci, int x,                                   int y);  /**   * Draws the specified characters starting at the specified point.   *   * @param data The array of characters to draw.   * @param offset The offset into the array to start drawing characters from.   * @param length The number of characters to draw.   * @param x The X coordinate of the point to draw at.   * @param y The Y coordinate of the point to draw at.   */  public void drawChars(char data[], int offset, int length, int x, int y)  {    drawString(new String(data, offset, length), x, y);  }  public void drawBytes(byte[] data, int offset, int length, int x, int y)  {    String str = new String(data, offset, length);    drawString(str, x, y);  }  /**   * Draws all of the image that is available and returns.  If the image   * is not completely loaded, <code>false</code> is returned and    * the specified iamge observer is notified as more data becomes    * available.   *   * @param image The image to draw.   * @param x The X coordinate of the point to draw at.   * @param y The Y coordinate of the point to draw at.   * @param observer The image observer to notify as data becomes available.   *   * @return <code>true</code> if all the image data is available,   * <code>false</code> otherwise.   */  public abstract boolean drawImage(Image image, int x, int y,                                    ImageObserver observer);   /**   * Draws all of the image that is available and returns.  The image   * is scaled to fit in the specified rectangle.  If the image   * is not completely loaded, <code>false</code> is returned and    * the specified iamge observer is notified as more data becomes    * available.   *   * @param image The image to draw.   * @param x The X coordinate of the point to draw at.   * @param y The Y coordinate of the point to draw at.   * @param width The width of the rectangle to draw in.   * @param height The height of the rectangle to draw in.   * @param observer The image observer to notify as data becomes available.   *   * @return <code>true</code> if all the image data is available,   * <code>false</code> otherwise.   */  public abstract boolean drawImage(Image image, int x, int y, int width,                                    int height, ImageObserver observer);   /**   * Draws all of the image that is available and returns.  If the image   * is not completely loaded, <code>false</code> is returned and    * the specified iamge observer is notified as more data becomes    * available.   *   * @param image The image to draw.   * @param x The X coordinate of the point to draw at.   * @param y The Y coordinate of the point to draw at.   * @param bgcolor The background color to use for the image.   * @param observer The image observer to notify as data becomes available.   *   * @return <code>true</code> if all the image data is available,   * <code>false</code> otherwise.   */  public abstract boolean drawImage(Image image, int x, int y, Color bgcolor,                                    ImageObserver observer);   /**   * Draws all of the image that is available and returns.  The image   * is scaled to fit in the specified rectangle.  If the image   * is not completely loaded, <code>false</code> is returned and    * the specified iamge observer is notified as more data becomes    * available.   *   * @param image The image to draw.   * @param x The X coordinate of the point to draw at.   * @param y The Y coordinate of the point to draw at.   * @param width The width of the rectangle to draw in.   * @param height The height of the rectangle to draw in.   * @param bgcolor The background color to use for the image.   * @param observer The image observer to notify as data becomes available.   *   * @return <code>true</code> if all the image data is available,   * <code>false</code> otherwise.   */  public abstract boolean drawImage(Image image, int x, int y, int width,                                    int height, Color bgcolor,                                    ImageObserver observer);  /**   * FIXME: Write Javadocs for this when you understand it.   */  public abstract boolean drawImage(Image image, int dx1, int dy1, int dx2,                                    int dy2, int sx1, int sy1, int sx2,                                    int sy2, ImageObserver observer);  /**   * FIXME: Write Javadocs for this when you understand it.   */  public abstract boolean drawImage(Image image, int dx1, int dy1, int dx2,                                    int dy2, int sx1, int sy1, int sx2,                                    int sy2, Color bgcolor,                                    ImageObserver observer);  /**   * Free any resources held by this graphics context immediately instead   * of waiting for the object to be garbage collected and finalized.   */  public abstract void dispose();  /**   * Frees the resources held by this graphics context when it is   * garbage collected.   */  public void finalize()  {    dispose();  }  /**   * Returns a string representation of this object.   *   * @return A string representation of this object.    */  public String toString()  {    return getClass ().getName () + "[font=" + getFont () + ",color="           + getColor () + "]";  }  /**   * Returns <code>true</code> if the specified rectangle intersects with the   * current clip, <code>false</code> otherwise.   *   * @param x the X coordinate of the upper left corner of the test rectangle   * @param y the Y coordinate of the upper left corner of the test rectangle   * @param width the width of the upper left corner of the test rectangle   * @param height the height of the upper left corner of the test rectangle   * @return <code>true</code> if the specified rectangle intersects with the   *         current clip, <code>false</code> otherwise   */  public boolean hitClip(int x, int y, int width, int height)  {    return getClip().intersects(x, y, width, height);  }  public Rectangle getClipBounds(Rectangle r)  {    Rectangle clipBounds = getClipBounds();      if (r == null)      return clipBounds;    r.x      = clipBounds.x;    r.y      = clipBounds.y;    r.width  = clipBounds.width;    r.height = clipBounds.height;    return r;  }}

⌨️ 快捷键说明

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