-// Copyright 2004 Adam Megacz, see the COPYING file for licensing [GPL]
+// Copyright 2000-2005 the Contributors, as shown in the revision logs.
+// Licensed under the GNU General Public License version 2 ("the License").
+// You may not use this file except in compliance with the License.
+
package org.ibex.plat;
-import org.ibex.*;
import org.ibex.util.*;
import java.io.*;
import org.ibex.js.*;
import java.awt.datatransfer.*;
import java.awt.image.*;
import java.awt.event.*;
+import org.ibex.graphics.*;
+import org.ibex.core.*;
+import org.ibex.net.*;
/** Platform subclass for all VM's providing AWT 1.1 functionality */
public class AWT extends JVM {
// Inner Classes /////////////////////////////////////////////////////////////////////////////////////
- protected org.ibex.Font.Glyph _createGlyph(org.ibex.Font f, char c) { return new AWTGlyph(f, c); }
- protected static class AWTGlyph extends org.ibex.Font.Glyph {
+ protected org.ibex.graphics.Font.Glyph _createGlyph(org.ibex.graphics.Font f, char c) { return new AWTGlyph(f, c); }
+ protected static class AWTGlyph extends org.ibex.graphics.Font.Glyph {
private Image i = null;
private static ColorModel cmodel = new DirectColorModel(32, 0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000);
};
*/
- public AWTGlyph(org.ibex.Font f, char c) { super(f, c); }
+ public AWTGlyph(org.ibex.graphics.Font f, char c) { super(f, c); }
Image getImage() {
if (i == null && isLoaded) {
}
/** implemented with java.awt 1.1's setXORMode() */
- public void drawGlyph(org.ibex.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
+ public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
// XOR the target region
- g.setXORMode(new Color((rgb & 0x00ff0000) >> 16, (rgb & 0x0000ff00) >> 8, rgb & 0x000000ff));
- g.setColor(new Color(0x0, 0x0, 0x0));
+ g.setXORMode(new java.awt.Color((rgb & 0x00ff0000) >> 16, (rgb & 0x0000ff00) >> 8, rgb & 0x000000ff));
+ g.setColor(new java.awt.Color(0x0, 0x0, 0x0));
g.fillRect(cx1, cy1, cx2 - cx1, cy2 - cy1);
// blacken the area we want the glyph to cover
g.setClip(0, 0, i.getWidth(null), i.getHeight(null));
// XOR back, turning black into the chosen rgb color
- g.setXORMode(new Color((rgb & 0x00ff0000) >> 16, (rgb & 0x0000ff00) >> 8, rgb & 0x000000ff));
- g.setColor(new Color(0x0, 0x0, 0x0));
+ g.setXORMode(new java.awt.Color((rgb & 0x00ff0000) >> 16, (rgb & 0x0000ff00) >> 8, rgb & 0x000000ff));
+ g.setColor(new java.awt.Color(0x0, 0x0, 0x0));
g.fillRect(cx1, cy1, cx2 - cx1, cy2 - cy1);
// restore the graphics context
// FIXME: try to use os acceleration
public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int argb) {
- g.setColor(new Color((argb & 0x00FF0000) >> 16, (argb & 0x0000FF00) >> 8, (argb & 0x000000FF)));
+ g.setColor(new java.awt.Color((argb & 0x00FF0000) >> 16, (argb & 0x0000FF00) >> 8, (argb & 0x000000FF)));
if (x1 == x3 && x2 == x4) {
g.fillRect(x1, y1, x4 - x1, y2 - y1);
} else for(int y=y1; y<y2; y++) {
public void setMinimumSize(int minx, int miny, boolean resizable) { if (frame != null) frame.setResizable(resizable); }
+ private int oldfill = 0x0;
public void render() {
// useful optimizatin;
- window.setBackground((root.fillcolor & 0xFF000000) == 0 ?
- Color.white :
- new Color((root.fillcolor >> 16) & 0xff,
- (root.fillcolor >> 8) & 0xff,
- (root.fillcolor) & 0xff));
+ if (oldfill != root.fillcolor) {
+ oldfill = root.fillcolor;
+ window.setBackground((root.fillcolor & 0xFF000000) == 0 ?
+ java.awt.Color.white :
+ new java.awt.Color((root.fillcolor >> 16) & 0xff,
+ (root.fillcolor >> 8) & 0xff,
+ (root.fillcolor) & 0xff));
+ }
super.render();
}