gnu.awt.j2d

Class AbstractGraphicsState

Implemented Interfaces:
Cloneable
Known Direct Subclasses:
IntegerGraphicsState

public abstract class AbstractGraphicsState
extends Object
implements Cloneable

Base class for graphics state objects (State pattern, GOF book) that represents the current pipeline configuration. The Graphics2D object forwards most of the requests to the state object. The Graphics2D object itself only administers properties that are not specific for a certain state.

Method Summary

abstract void
clearRect(int x, int y, int width, int height)
Object
clone()
This method may be called to create a new copy of the Object.
abstract void
copyArea(int x, int y, int width, int height, int dx, int dy)
void
dispose()
abstract void
draw(Shape shape)
abstract void
drawArc(int x, int y, int width, int height, int startAngle, int arcAngle)
abstract boolean
drawImage(Image image, int x, int y, ImageObserver observer)
abstract void
drawLine(int x1, int y1, int x2, int y2)
abstract void
drawOval(int x, int y, int width, int height)
abstract void
drawPolygon(int[] xPoints, int[] yPoints, int nPoints)
abstract void
drawPolyline(int[] xPoints, int[] yPoints, int nPoints)
abstract void
drawRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
abstract void
drawString(String text, float x, float y)
abstract void
drawString(String text, int x, int y)
abstract void
fill(Shape shape)
abstract void
fillArc(int x, int y, int width, int height, int startAngle, int arcAngle)
abstract void
fillOval(int x, int y, int width, int height)
abstract void
fillPolygon(int[] xPoints, int[] yPoints, int nPoints)
abstract void
fillRect(int x, int y, int width, int height)
abstract void
fillRoundRect(int x, int y, int width, int height, int arcWidth, int arcHeight)
abstract Shape
getClip()
abstract Rectangle
getClipBounds()
abstract FontMetrics
getFontMetrics(Font font)
abstract boolean
hit(Rectangle rect, Shape text, boolean onStroke)
abstract void
rotate(double theta)
abstract void
rotate(double theta, double x, double y)
abstract void
scale(double scaleX, double scaleY)
abstract void
setClip(Shape clip)
abstract void
setColor(Color color)
abstract void
setFont(Font font)
void
setFrontend(Graphics2DImpl frontend)
abstract void
setPaintMode()
abstract void
setXORMode(Color altColor)
abstract void
shear(double shearX, double shearY)
abstract void
translate(double tx, double ty)
abstract void
translate(int x, int y)

Methods inherited from class java.lang.Object

clone, equals, extends Object> getClass, finalize, hashCode, notify, notifyAll, toString, wait, wait, wait

Method Details

clearRect

public abstract void clearRect(int x,
                               int y,
                               int width,
                               int height)

clone

public Object clone()
This method may be called to create a new copy of the Object. The typical behavior is as follows:
  • o == o.clone() is false
  • o.getClass() == o.clone().getClass() is true
  • o.equals(o) is true

However, these are not strict requirements, and may be violated if necessary. Of the three requirements, the last is the most commonly violated, particularly if the subclass does not override Object.equals(Object).

If the Object you call clone() on does not implement Cloneable (which is a placeholder interface), then a CloneNotSupportedException is thrown. Notice that Object does not implement Cloneable; this method exists as a convenience for subclasses that do.

Object's implementation of clone allocates space for the new Object using the correct class, without calling any constructors, and then fills in all of the new field values with the old field values. Thus, it is a shallow copy. However, subclasses are permitted to make a deep copy.

All array types implement Cloneable, and override this method as follows (it should never fail):

 public Object clone()
 {
   try
     {
       super.clone();
     }
   catch (CloneNotSupportedException e)
     {
       throw new InternalError(e.getMessage());
     }
 }
 
Overrides:
clone in interface Object
Returns:
a copy of the Object
See Also:
Cloneable

copyArea

public abstract void copyArea(int x,
                              int y,
                              int width,
                              int height,
                              int dx,
                              int dy)

dispose

public void dispose()

draw

public abstract void draw(Shape shape)

drawArc

public abstract void drawArc(int x,
                             int y,
                             int width,
                             int height,
                             int startAngle,
                             int arcAngle)

drawImage

public abstract boolean drawImage(Image image,
                                  int x,
                                  int y,
                                  ImageObserver observer)

drawLine

public abstract void drawLine(int x1,
                              int y1,
                              int x2,
                              int y2)

drawOval

public abstract void drawOval(int x,
                              int y,
                              int width,
                              int height)

drawPolygon

public abstract void drawPolygon(int[] xPoints,
                                 int[] yPoints,
                                 int nPoints)

drawPolyline

public abstract void drawPolyline(int[] xPoints,
                                  int[] yPoints,
                                  int nPoints)

drawRoundRect

public abstract void drawRoundRect(int x,
                                   int y,
                                   int width,
                                   int height,
                                   int arcWidth,
                                   int arcHeight)

drawString

public abstract void drawString(String text,
                                float x,
                                float y)

drawString

public abstract void drawString(String text,
                                int x,
                                int y)

fill

public abstract void fill(Shape shape)

fillArc

public abstract void fillArc(int x,
                             int y,
                             int width,
                             int height,
                             int startAngle,
                             int arcAngle)

fillOval

public abstract void fillOval(int x,
                              int y,
                              int width,
                              int height)

fillPolygon

public abstract void fillPolygon(int[] xPoints,
                                 int[] yPoints,
                                 int nPoints)

fillRect

public abstract void fillRect(int x,
                              int y,
                              int width,
                              int height)

fillRoundRect

public abstract void fillRoundRect(int x,
                                   int y,
                                   int width,
                                   int height,
                                   int arcWidth,
                                   int arcHeight)

getClip

public abstract Shape getClip()

getClipBounds

public abstract Rectangle getClipBounds()

getFontMetrics

public abstract FontMetrics getFontMetrics(Font font)

hit

public abstract boolean hit(Rectangle rect,
                            Shape text,
                            boolean onStroke)

rotate

public abstract void rotate(double theta)

rotate

public abstract void rotate(double theta,
                            double x,
                            double y)

scale

public abstract void scale(double scaleX,
                           double scaleY)

setClip

public abstract void setClip(Shape clip)

setColor

public abstract void setColor(Color color)

setFont

public abstract void setFont(Font font)

setFrontend

public void setFrontend(Graphics2DImpl frontend)

setPaintMode

public abstract void setPaintMode()

setXORMode

public abstract void setXORMode(Color altColor)

shear

public abstract void shear(double shearX,
                           double shearY)

translate

public abstract void translate(double tx,
                               double ty)

translate

public abstract void translate(int x,
                               int y)

Copyright (C) 2000, 2001 Free Software Foundation This file is part of libgcj. This software is copyrighted work licensed under the terms of the Libgcj License. Please consult the file "LIBGCJ_LICENSE" for details.