X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fibex%2Fplat%2FAWT.java;h=e84f497368c16e98095e273d5e9eb99ec6692d7f;hb=531e31402f74fa636b2d9a2a367305bfd0777cdc;hp=9ca0366e0567f779ebdf599e950fd45d16ee7dbe;hpb=3419f19eae26a68874ff4c9eb56e93c7d84b93a1;p=org.ibex.core.git diff --git a/src/org/ibex/plat/AWT.java b/src/org/ibex/plat/AWT.java index 9ca0366..e84f497 100644 --- a/src/org/ibex/plat/AWT.java +++ b/src/org/ibex/plat/AWT.java @@ -27,8 +27,7 @@ public class AWT extends JVM { protected void postInit() { if (Log.on) Log.diag(Platform.class, " color depth = " + - Toolkit.getDefaultToolkit().getColorModel().getPixelSize() + "bpp"); - } + Toolkit.getDefaultToolkit().getColorModel().getPixelSize() + "bpp"); } protected void _criticalAbort(String message) { if (Log.on) Log.info(this, message); @@ -189,6 +188,24 @@ public class AWT extends JVM { protected static class AWTPixelBuffer implements PixelBuffer { + private int[] xpoints = new int[3]; + private int[] ypoints = new int[3]; + public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, int argb) { + xpoints[0] = x1; + xpoints[1] = x2; + xpoints[2] = x3; + ypoints[0] = y1; + ypoints[1] = y2; + ypoints[2] = y3; + Graphics g = getGraphics(); + g.setColor(new java.awt.Color((argb & 0x00ff0000) >> 16, + (argb & 0x0000ff00) >> 8, + argb & 0x000000ff/*, + (argb & 0xff000000) >> 24*/)); + g.fillPolygon(xpoints, ypoints, 3); + } + + public void drawPicture(Picture p, Affine a, Mesh h) { throw new Error("drawPicture() not implemented"); } protected Image i = null; protected Graphics g = null; protected AWTSurface surface = null; @@ -230,8 +247,8 @@ public class AWT extends JVM { g.drawLine(x1, y1, x2, y2); } - public void stroke(org.ibex.graphics.Polygon p, int color) { p.stroke(this, color); } - public void fill(org.ibex.graphics.Polygon p, org.ibex.graphics.Paint paint) { p.fill(this, paint); } + public void stroke(org.ibex.graphics.Mesh p, int color) { /*p.stroke(this, color);*/ } + public void fill(org.ibex.graphics.Mesh p, org.ibex.graphics.Paint paint) { /*p.fill(this, paint);*/ } private static int[] xa = new int[4]; private static int[] ya = new int[4]; @@ -251,8 +268,9 @@ public class AWT extends JVM { } // this doens't seem to work on Windows - public void drawGlyph(org.ibex.graphics.Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, - int rgb, int argb) { + public void drawGlyph(org.ibex.graphics.Font.Glyph source,Affine a,Mesh h,int rgb,int bg) { + //throw new Error("drawGlyph() not implemented"); + /* Image i = ((AWTGlyph)source).getImage(); if (((AWTGlyph)source).i2 == null) ((AWTGlyph)source).i2 = new BufferedImage(i.getWidth(null), i.getHeight(null), BufferedImage.TYPE_INT_ARGB); @@ -270,11 +288,12 @@ public class AWT extends JVM { g.fillRect(dx+i2.getWidth(null), cy1, cx2 - (dx+i2.getWidth(null)), cy2 - cy1); g.fillRect(cx1, dy+i2.getHeight(null), cx2 - cx1, cy2 - (dy+i2.getHeight(null))); g.setClip(0, 0, 1000, 1000); + */ } } - protected static class AWTSurface extends Surface.DoubleBufferedSurface + protected static class AWTSurface extends Surface implements MouseListener, MouseMotionListener, KeyListener, ComponentListener, WindowListener { protected AWTPixelBuffer pb = null; @@ -282,6 +301,8 @@ public class AWT extends JVM { Frame frame = null; Window window = null; + public PixelBuffer getPixelBuffer() { return pb==null?(pb=new AWTPixelBuffer(this)):pb; } + public void blit(PixelBuffer source, int sx, int sy, int dx, int dy, int dx2, int dy2) { getGraphics().drawImage(((AWTPixelBuffer)source).i, sx, sy, sx+(dx2-dx), sy+(dy2-dy), dx, dy, dx2, dy2, null); } @@ -359,6 +380,7 @@ public class AWT extends JVM { private int oldfill = 0x0; public void render() { // useful optimizatin; + /* if (oldfill != root.fillcolor) { oldfill = root.fillcolor; window.setBackground((root.fillcolor & 0xFF000000) == 0 ? @@ -367,6 +389,7 @@ public class AWT extends JVM { (root.fillcolor >> 8) & 0xff, (root.fillcolor) & 0xff)); } + */ super.render(); }