From: adam Date: Mon, 14 Feb 2005 08:40:51 +0000 (+0000) Subject: added missing patches to move to fillTriangle() and Mesh X-Git-Tag: 01-July-2005~8 X-Git-Url: http://git.megacz.com/?p=org.ibex.core.git;a=commitdiff_plain;h=098f2fd17df6500e8dad466c162c2e0589cc7df5 added missing patches to move to fillTriangle() and Mesh darcs-hash:20050214084051-5007d-3e597228379af524f580f4c60c1f830038d2f2ef.gz --- diff --git a/src/org/ibex/graphics/Font.java b/src/org/ibex/graphics/Font.java index 9d012e4..b2c30ca 100644 --- a/src/org/ibex/graphics/Font.java +++ b/src/org/ibex/graphics/Font.java @@ -63,10 +63,18 @@ public class Font { * Rasterize the glyphs of text. * @returns (width<<32)|height */ - public long rasterizeGlyphs(String text, PixelBuffer pb, int textcolor, int x, int y, int cx1, int cy1, int cx2, int cy2) { - return rasterizeGlyphs(text, pb, textcolor, x, y, cx1, cy1, cx2, cy2, 0); } - public long rasterizeGlyphs(String text, PixelBuffer pb, int textcolor, int x, int y, - int cx1, int cy1, int cx2, int cy2, int bg) { + public String rasterizeGlyphs(String text) { + StringBuffer path = new StringBuffer(text.length() * 50); + for(int i=0; i root.height) h = root.height - y; if (w <= 0 || h <= 0) continue; - root.render(x, y, x + w, y + h, this.getPixelBuffer(), identity); - getPixelBuffer().drawPicture(scarImage, 0, root.height - scarImage.height, x, y, x+w, y+h); + // FIXME: set clip to -- x, y, x + w, y + h, + root.render(this.getPixelBuffer(), identity); + //getPixelBuffer().drawPicture(scarImage, 0, root.height - scarImage.height, x, y, x+w, y+h); if (abort) { // x,y,w,h is only partially reconstructed, so we must be careful not to re-blit it @@ -360,16 +361,25 @@ public abstract class Surface implements Callable { DirtyList screenDirtyRegions = new DirtyList(); public PixelBuffer getPixelBuffer() { return this; } + public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, int argb) { + backbuffer.fillTriangle(x1, y1, x2, y2, x3, y3, argb); + } + public void drawPicture(Picture p, Affine a, Mesh h) { + throw new Error("drawPicture() not implemented"); + } + public void drawGlyph(Font.Glyph source,Affine a,Mesh h,int rgb,int bg) { + //screenDirtyRegions.dirty(cx1, cy1, cx2 - cx1, cy2 - cy1); + backbuffer.drawGlyph(source, a, h, rgb, bg); + } + /* public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) { screenDirtyRegions.dirty(cx1, cy1, cx2 - cx1, cy2 - cy1); backbuffer.drawPicture(source, dx, dy, cx1, cy1, cx2, cy2); } public void drawGlyph(Font.Glyph source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int argb, int bc) { - screenDirtyRegions.dirty(cx1, cy1, cx2 - cx1, cy2 - cy1); - backbuffer.drawGlyph(source, dx, dy, cx1, cy1, cx2, cy2, argb, bc); } - + */ public void stroke(Polygon p, int color) { // FIXME } diff --git a/src/org/ibex/plat/AWT.java b/src/org/ibex/plat/AWT.java index 9ca0366..113ca78 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; @@ -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,6 +288,7 @@ 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); + */ } } diff --git a/src/org/ibex/plat/Java2.java b/src/org/ibex/plat/Java2.java index 0efff67..d1b646c 100644 --- a/src/org/ibex/plat/Java2.java +++ b/src/org/ibex/plat/Java2.java @@ -117,7 +117,7 @@ public class Java2 extends AWT { private static GeneralPath gp = new GeneralPath(); // this doens't seem to work on Windows - public void drawGlyph(org.ibex.graphics.Font.Glyph source, Affine a, Hull h, int rgb, int bg) { + public void drawGlyph(org.ibex.graphics.Font.Glyph source, Affine a, Mesh h, int rgb, int bg) { Image i = ((AWTGlyph)source).getImage(); Image i2 = ((AWTGlyph)source).i2; if (((AWTGlyph)source).i2 == null) { diff --git a/src/org/ibex/plat/OpenGL.java b/src/org/ibex/plat/OpenGL.java index b852437..a7aa726 100644 --- a/src/org/ibex/plat/OpenGL.java +++ b/src/org/ibex/plat/OpenGL.java @@ -58,6 +58,9 @@ abstract class OpenGL { public static abstract class GLPixelBuffer implements PixelBuffer { protected int width; protected int height; + public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, int argb) { throw new Error("not implemented"); } + public void drawPicture(Picture p, Affine a, Mesh h) { throw new Error("drawPicture() not implemented"); } + public void drawGlyph(Font.Glyph source,Affine a,Mesh h,int rgb,int bg) { throw new Error("drawGlyph() not implemented"); } public int getWidth() { return width; } public int getHeight() { return height; } diff --git a/src/org/ibex/plat/Win32.java b/src/org/ibex/plat/Win32.java index 86f79a3..9700d1e 100644 --- a/src/org/ibex/plat/Win32.java +++ b/src/org/ibex/plat/Win32.java @@ -236,6 +236,10 @@ public class Win32 extends GCJ { // Win32PixelBuffer ////////////////////////////////////////////////////////////////////////// public static class Win32PixelBuffer implements PixelBuffer { + public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, int argb) { throw new Error("not implemented"); } + + public void drawPicture(Picture p, Affine a, Mesh h) { throw new Error("drawPicture() not implemented"); } + public void drawGlyph(Font.Glyph source,Affine a,Mesh h,int rgb,int bg) { throw new Error("drawGlyph() not implemented"); } public void drawLine(int x1, int y1, int x2, int y2, int color) { } public void drawGlyph(Font.Glyph source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2, int rgb, int pc){} diff --git a/src/org/ibex/plat/X11.java b/src/org/ibex/plat/X11.java index cc1bea6..ffb11fb 100644 --- a/src/org/ibex/plat/X11.java +++ b/src/org/ibex/plat/X11.java @@ -142,6 +142,10 @@ public class X11 extends POSIX { * (since they are only written to once. */ public static class X11PixelBuffer implements PixelBuffer { + public void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3, int argb) { throw new Error("not implemented"); } + + public void drawPicture(Picture p, Affine a, Mesh h) { throw new Error("drawPicture() not implemented"); } + public void drawGlyph(Font.Glyph source,Affine a,Mesh h,int rgb,int bg) { throw new Error("drawGlyph() not implemented"); } public void drawLine(int x1, int y1, int x2, int y2, int color) { } public void drawGlyph(Font.Glyph source, int dx1, int dy1, int cx1, int cy1, int cx2, int cy2, int rgb, int pc){}