1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
16/* ObjectInput.java -- Read object data from a stream
Copyright (C) 1998 Free Software Foundation, Inc.
This file is part of GNU Classpath.
GNU Classpath is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the 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, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with GNU Classpath; see the file COPYING. If not, write to the
Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA.
Linking this library statically or dynamically with other modules is
making a combined work based on this library. Thus, the terms and
conditions of the GNU General Public License cover the whole
combination.
As a special exception, the copyright holders of this library give you
permission to link this library with independent modules to produce an
executable, regardless of the license terms of these independent
modules, and to copy and distribute the resulting executable under
terms of your choice, provided that you also meet, for each linked
independent module, the terms and conditions of the license of that
module. An independent module is a module which is not derived from
or based on this library. If you modify this library, you may extend
this exception to your version of the library, but you are n/* Copyright (C) 2000 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. */
package java.awt;
import java.awt.image.ImageObserver;
/**
* @author Warren Levy <warrenl@cygnus.com>
* @date March 15, 2000.
*/
/**
* Written using on-line Java Platform 1.2 API Specification, as well
* as "The Java Class Libraries", 2nd edition (Addison-Wesley, 1998).
* Status: Almost complete
*/
public abstract class Graphics
{
protected Graphics() {}
public abstract Graphics create();
public Graphics create(int x, int y, int width, int height)
{
Graphics gfx = create();
gfx.translate(x, y);
gfx.setClip(0, y, width, height);
return gfx;
}
public abstract void translate(int x, int y);
public abstract Color getColor();
public abstract void setColor(Color color);
public abstract void setPaintMode();
public abstract void setXORMode(Color altColor);
public abstract Font getFont();
public abstract void setFont(Font font);
public FontMetrics getFontMetrics()
{
return getFontMetrics(getFont());
}
public abstract FontMetrics getFontMetrics(Font font);
public abstract Rectangle getClipBounds();
public abstract void clipRect(int x, int y, int width, int height);
public abstract void setClip(int x, int y, int width, int height);
public abstract Shape getClip();
public abstract void setClip(Shape clip);
public abstract void copyArea(int x, int y, int width, int height,
int dx, int dy);
public abstract void drawLine(int x1, int y1, int x2, int y2);
public abstract void fillRect(int x, int y, int width, int height);
public void drawRect(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);
}
public abstract void clearRect(int x, int y, int width, int height);
public abstract void drawRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight);
public abstract void fillRoundRect(int x, int y, int width, int height,
int arcWidth, int arcHeight);
public void draw3DRect(int x, int y, int width, int height,
boolean raised)
{
Color color = getColor();
Color tl = color.brighter();
Color br = color.darker();
if (!raised)
{
Color tmp = tl;
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, y1, x1, y2);
setColor(color);
}
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);
}
public abstract void drawOval(int x, int y, int width, int height);
public abstract void fillOval(int x, int y, int width, int height);
public abstract void drawArc(int x, int y, int width, int height,
int startAngle, int arcAngle);
public abstract void fillArc(int x, int y, int width, int height,
int startAngle, int arcAngle);
public abstract void drawPolyline(int[] xPoints, int[] yPoints,
int nPoints);
public abstract void drawPolygon(int[] xPoints, int[] yPoints,
int nPoints);
//public void drawPolygon(Polygon p);
public abstract void fillPolygon(int[] xPoints, int[] yPoints,
int nPoints);
//public void fillPolygon(Polygon p);
public abstract void drawString(String str, int x, int y);
/*
public abstract void drawString(AttributedCharacterIterator iterator,
int x, int y)
*/
public void drawChars(char[] data, int offset, int length,
int x, int y)
{
String str = new String(data, offset, length);
drawString(str, 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);
}
public abstract boolean drawImage(Image img, int x, int y,
ImageObserver observer);
public abstract boolean drawImage(Image img, int x, int y,
int width, int height,
ImageObserver observer);
public abstract boolean drawImage(Image img, int x, int y, Color bgcolor,
ImageObserver observer);
public abstract boolean drawImage(Image img, int x, int y,
int width, int height, Color bgcolor,
ImageObserver observer);
public abstract boolean drawImage(Image img,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
ImageObserver observer);
public abstract boolean drawImage(Image img,
int dx1, int dy1, int dx2, int dy2,
int sx1, int sy1, int sx2, int sy2,
Color bgcolor, ImageObserver observer);
public abstract void dispose();
public void finalize()
{
dispose();
}
public String toString()
{
return super.toString(); // FIXME
}
/** @deprecated */
public Rectangle getClipRect()
{
return getClipBounds(null);
}
public boolean hitClip(int x, int y, int width, int height)
{
throw new UnsupportedOperationException("not implemented yet");
}
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;
}
}
|