import java.util.*;
import org.xwt.js.*;
import org.xwt.util.*;
-import org.xwt.imp.*;
+import org.xwt.translators.*;
/**
* <p>
/** Adds the intersection of (x,y,w,h) and the node's current actual geometry to the Surface's dirty list */
public final void dirty() { dirty(0, 0, width, height); }
public final void dirty(int x, int y, int w, int h) {
+ /*
for(Box cur = this; cur != null; cur = cur.parent) {
w = min(x + w, cur.width) - max(x, 0);
h = min(y + h, cur.height) - max(y, 0);
x += cur.x;
y += cur.y;
}
+ */
+ Box cur;
+ for(cur = this; cur.parent != null; cur = cur.parent);
+ if (cur.surface != null) cur.surface.dirty(0, 0, cur.width, cur.height);
}
/**
// --- Phase 3 ----------------------------------------------------------------------
// hand out the slack
int slack;
- //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows
- slack = width;
+ //#repeat x/y y/x width/height col/row cols/rows colspan/rowspan colWidth/rowHeight maxwidth/maxheight minwidth/minheight contentwidth/contentheight colMaxWidth/rowMaxHeight numCols/numRows hpad/vpad
+ slack = width - 2 * hpad;
for(int i=0; i<numCols; i++) slack -= colWidth[i];
if (numChildren() > 0)
while(slack > 0) {
b.render(globalx, globaly, clipx, clipy, clipw, cliph, buf);
}
- void renderStretchedImage(int globalx, int globaly, int x, int y, int w, int h, DoubleBuffer buf) {
- buf.setClip(x, y, w + x, h + y);
+ void renderStretchedImage(int globalx, int globaly, int clipx, int clipy, int clipw, int cliph, DoubleBuffer buf) {
+ //buf.setClip(x, y, w + x, h + y);
+ System.out.println("draw " + clipx + " " + clipy + " " + (clipx + clipw) + " " + (clipy + cliph));
buf.drawPicture(image,
- globalx, globaly,
- globalx + width, globaly + height,
+ clipx, clipy, clipx + clipw, clipy + cliph,
0, 0, image.getWidth(), image.getHeight());
- buf.setClip(0, 0, buf.getWidth(), buf.getHeight());
+ //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 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<text.length(); i++) {
+ b[i * 2] = (byte)((((short)text.charAt(i)) & 0xff00) >> 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.imp.Font.render(new FileInputStream("COMIC.TTF"), 24, text, false);
+ 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,
} catch (Exception e) {
Log.log(this, e);
}
+ */
}
b.textwidth = b.textheight = 0;
} else {
try {
- ImageDecoder id = org.xwt.imp.Font.render(new FileInputStream("COMIC.TTF"), 24, b.text, true);
+ ImageDecoder id = org.xwt.translators.Font.render(new FileInputStream("COMIC.TTF"), 24, b.text, true);
if (id.getWidth() != b.textwidth || id.getHeight() != b.textheight) MARK_FOR_REFLOW_b;
b.textwidth = id.getWidth();
b.textheight = id.getHeight();
if ((b.image = ImageDecoder.getPicture(s)) == null) {
if (Log.on) Log.logJS(Box.class, "unable to load image " + s);
} else {
- b.minwidth = b.maxwidth = b.image.getWidth();
- b.minheight = b.maxheight = b.image.getHeight();
+ b.minwidth = b.image.getWidth();
+ b.minheight = b.image.getHeight();
MARK_FOR_REFLOW_b;
}
}