if (image != null)
if ((flags & TILE_FLAG) != 0) renderTiledImage(globalx, globaly, clipx, clipy, clipw, cliph, buf);
- else renderStretchedImage(globalx, globaly, clipx, clipy, clipw, cliph, buf);
+ else buf.drawPicture(image, globalx, globaly, clipx, clipy, clipx + clipw, clipy + cliph);
if (text != null && !text.equals(""))
renderText(globalx, globaly, clipx, clipy, clipw, cliph, buf);
}
}
- void renderStretchedImage(int globalx, int globaly, int clipx, int clipy, int clipw, int cliph, PixelBuffer buf) {
- // FIXME: wrong
- buf.drawPicture(image, clipx, clipy, clipx + clipw, clipy + cliph, 0, 0, image.getWidth(), image.getHeight());
- }
-
void renderTiledImage(int globalx, int globaly, int x, int y, int w, int h, PixelBuffer buf) {
+ /*
+ FIXME
int iw = image.getWidth();
int ih = image.getHeight();
for(int i=(x - x)/iw; i <= (x + w - x)/iw; i++) {
buf.drawPicture(image, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2);
}
}
+ */
}
void renderText(int x, int y, int clipx, int clipy, int clipw, int cliph, PixelBuffer buf) {
buf.drawPictureAlphaOnly(g.p,
x,
y + g.max_ascent - g.baseline + g.max_descent,
+ x,
+ y + g.max_ascent - g.baseline + g.max_descent,
x + g.p.getWidth(),
y + g.max_ascent - g.baseline + g.max_descent + g.p.getHeight(),
- 0, 0,
- g.p.getWidth(), g.p.getHeight(),
textcolor);
x += g.advance;
}
public Object get(Box b) { return b; }
public void put(Box b, Object value) {
if (value == null) b.remove();
- else if (value.equals("window") || value.equals("frame")) Platform.createSurface(b, value.equals("frame"), true);
else if (Log.on) Log.log(this, "put invalid value to 'thisbox' property: " + value);
}
});
});
//#end
- //#repeat width/height minwidth/minheight maxwidth/maxheight
+ //#repeat width/height height/width minwidth/minheight maxwidth/maxheight true/false
specialBoxProperties.put("width", new SpecialBoxProperty() {
public Object get(Box b) { return new Integer(b.width); }
public void put(Box b, Object value) {
- int width = stoi(value);
+ int newval = stoi(value);
if (b.parent == null && b.surface != null) {
- b.width = width;
- b.surface.setSize();
+ // hack to circumvent #repeat
+ int other = b.height;
+ if (true) b.surface.setSize(newval, other);
+ else b.surface.setSize(other, newval);
MARK_FOR_REFLOW_b;
} else {
- if (b.minwidth == width && b.maxwidth == width) return;
- b.minwidth = b.maxwidth = width;
+ if (b.minwidth == newval && b.maxwidth == newval) return;
+ b.minwidth = b.maxwidth = newval;
MARK_FOR_REFLOW_b;
}
} });
} });
specialBoxProperties.put("image", new SpecialBoxProperty() {
- /* FIXME
- public Object get(Box b) { return b.image == null ? null : ImageDecoder.imageToNameMap.get(b.image); }
- */
+ public Object get(Box b) { return b.image == null ? null : b.image.res; }
public void put(Box b, Object value) {
- //if (image != null) System.out.println("hit");
if (value == null) {
b.image = null;
} else if (value instanceof Res) {