X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=src%2Forg%2Fxwt%2FBox.java.pp;h=245a2c159e4a04e0640d9e8cc807528335c7be91;hb=55c3195af733f3de6b7894f4c4a96f7b50f58c11;hp=4da565a2a54f997b98595df1aee3b80dff83bf61;hpb=cf3587e2fd5966b7ebfd721d9413674224d1ad2a;p=org.ibex.core.git diff --git a/src/org/xwt/Box.java.pp b/src/org/xwt/Box.java.pp index 4da565a..245a2c1 100644 --- a/src/org/xwt/Box.java.pp +++ b/src/org/xwt/Box.java.pp @@ -62,7 +62,7 @@ import org.xwt.translators.*; * position. * * A note on coordinates: the Box class represents regions - * internally as x,y,w,h tuples, even though the DoubleBuffer class + * internally as x,y,w,h tuples, even though the PixelBuffer class * uses x1,y1,x2,y2 tuples. */ public final class Box extends JS.Scope { @@ -126,7 +126,8 @@ public final class Box extends JS.Scope { private LENGTH hpad = 0; private LENGTH vpad = 0; private String text = null; - private String font = null; + private Res font = null; + private int fontsize = 10; private LENGTH textwidth = 0; private LENGTH textheight = 0; @@ -405,7 +406,7 @@ public final class Box extends JS.Scope { // Rendering Pipeline ///////////////////////////////////////////////////////////////////// /** Renders self and children within the specified region. All rendering operations are clipped to xIn,yIn,wIn,hIn */ - void render(int parentx, int parenty, int clipx, int clipy, int clipw, int cliph, DoubleBuffer buf) { + void render(int parentx, int parenty, int clipx, int clipy, int clipw, int cliph, PixelBuffer buf) { if (Surface.abort || (flags & INVISIBLE_FLAG) != 0) return; int globalx = parentx + (parent == null ? 0 : x); int globaly = parenty + (parent == null ? 0 : y); @@ -428,7 +429,7 @@ public final class Box extends JS.Scope { else renderStretchedImage(globalx, globaly, clipx, clipy, clipw, cliph, buf); if (text != null && !text.equals("")) - renderText(x, y, clipx, clipy, clipw, cliph, buf); + renderText(globalx, globaly, clipx, clipy, clipw, cliph, buf); // now subtract the pad region from the clip region before proceeding clipw = min(max(clipx, globalx + hpad) + clipw, globalx + width - hpad) - clipx; @@ -440,7 +441,7 @@ public final class Box extends JS.Scope { b.render(globalx, globaly, clipx, clipy, clipw, cliph, buf); } - void renderStretchedImage(int globalx, int globaly, int clipx, int clipy, int clipw, int cliph, DoubleBuffer buf) { + void renderStretchedImage(int globalx, int globaly, int clipx, int clipy, int clipw, int cliph, PixelBuffer buf) { //buf.setClip(x, y, w + x, h + y); System.out.println("draw " + clipx + " " + clipy + " " + (clipx + clipw) + " " + (clipy + cliph)); buf.drawPicture(image, @@ -449,7 +450,7 @@ public final class Box extends JS.Scope { //buf.setClip(0, 0, buf.getWidth(), buf.getHeight()); } - void renderTiledImage(int globalx, int globaly, int x, int y, int w, int h, DoubleBuffer buf) { + void renderTiledImage(int globalx, int globaly, int x, int y, int w, int h, PixelBuffer buf) { int iw = image.getWidth(); int ih = image.getHeight(); for(int i=(x - x)/iw; i <= (x + w - x)/iw; i++) { @@ -471,31 +472,21 @@ public final class Box extends JS.Scope { } } - void renderText(int x, int y, int clipx, int clipy, int clipw, int cliph, DoubleBuffer buf) { - /* - // hack because (believe it or not) libgcj doesn't support UTF16. - byte[] b = new byte[text.length() * 2 + 2]; - for(int i=0; i> 8); - b[i * 2 + 1] = (byte)(((short)text.charAt(i)) & 0xff); - } - b[text.length()] = 0; - b[text.length() + 1] = 0; - */ - /* - try { - ImageDecoder id = org.xwt.translators.Font.render(new FileInputStream("COMIC.TTF"), 24, text, false); - Picture p = Platform.createPicture(id); - // FIXME: clipping (don't use setClip) - buf.drawPicture(p, - x + hpad, y + vpad, - x + hpad + p.getWidth(), y + vpad + p.getHeight(), + void renderText(int x, int y, int clipx, int clipy, int clipw, int cliph, PixelBuffer buf) { + for(int i=0; i