1 /* Copyright (C) 2000, 2001 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
11 import java.awt.Color;
12 import java.awt.Image;
13 import java.awt.Shape;
14 import java.awt.Rectangle;
15 import java.awt.Graphics;
16 import java.awt.Graphics2D;
17 import java.awt.GraphicsConfiguration;
19 import java.awt.FontMetrics;
20 import java.awt.image.ImageObserver;
23 * Base class for graphics state objects (State pattern, GOF book)
24 * that represents the current pipeline configuration. The Graphics2D
25 * object forwards most of the requests to the state object. The
26 * Graphics2D object itself only administers properties that are not
27 * specific for a certain state.
29 public abstract class AbstractGraphicsState implements Cloneable
31 Graphics2DImpl frontend;
33 public void setFrontend(Graphics2DImpl frontend)
35 this.frontend = frontend;
43 // -------- Graphics methods:
45 public abstract void setColor(Color color);
47 public abstract void setPaintMode();
49 public abstract void setXORMode(Color altColor);
51 public abstract void setFont(Font font);
53 public abstract FontMetrics getFontMetrics(Font font);
55 public abstract void setClip(Shape clip);
57 public abstract Shape getClip();
58 public abstract Rectangle getClipBounds();
60 public abstract void copyArea(int x, int y,
61 int width, int height,
64 public abstract void drawLine(int x1, int y1,
67 public abstract void fillRect(int x, int y,
68 int width, int height);
70 public abstract void clearRect(int x, int y,
71 int width, int height);
73 public abstract void drawRoundRect(int x, int y,
74 int width, int height,
75 int arcWidth, int arcHeight);
77 public abstract void fillRoundRect(int x, int y,
78 int width, int height,
79 int arcWidth, int arcHeight);
81 public abstract void drawOval(int x, int y,
82 int width, int height);
84 public abstract void fillOval(int x, int y,
85 int width, int height);
87 public abstract void drawArc(int x, int y,
88 int width, int height,
89 int startAngle, int arcAngle);
91 public abstract void fillArc(int x, int y,
92 int width, int height,
93 int startAngle, int arcAngle);
95 public abstract void drawPolyline(int[] xPoints, int[] yPoints,int nPoints);
97 public abstract void drawPolygon(int[] xPoints, int[] yPoints, int nPoints);
99 public abstract void fillPolygon(int[] xPoints, int[] yPoints, int nPoints);
101 public abstract boolean drawImage(Image image, int x, int y,
102 ImageObserver observer);
105 // -------- Graphics2D methods:
107 public abstract void draw(Shape shape);
109 public abstract void fill(Shape shape);
111 public abstract boolean hit(Rectangle rect, Shape text, boolean onStroke);
113 public abstract void drawString(String text, int x, int y);
115 public abstract void drawString(String text, float x, float y);
117 public abstract void translate(int x, int y);
119 public abstract void translate(double tx, double ty);
121 public abstract void rotate(double theta);
123 public abstract void rotate(double theta, double x, double y);
125 public abstract void scale(double scaleX, double scaleY);
127 public abstract void shear(double shearX, double shearY);
129 public Object clone ()
131 return super.clone ();