- 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) {
- int iw = image.getWidth();
- int ih = image.getHeight();
- for(int i=(x - x)/iw; i <= (x + w - x)/iw; i++) {
- for(int j=(y - y)/ih; j<= (y + h - y)/ih; j++) {
-
- int dx1 = max(i * iw + x, x);
- int dy1 = max(j * ih + y, y);
- int dx2 = min((i+1) * iw + x, x + w);
- int dy2 = min((j+1) * ih + y, y + h);
-
- int sx1 = dx1 - (i*iw) - x;
- int sy1 = dy1 - (j*ih) - y;
- int sx2 = dx2 - (i*iw) - x;
- int sy2 = dy2 - (j*ih) - y;
-
- if (dx2 - dx1 > 0 && dy2 - dy1 > 0 && sx2 - sx1 > 0 && sy2 - sy1 > 0)
- 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) {
- for(int i=0; i<text.length(); i++) {
- // FIXME: clipping
- char c = text.charAt(i);
- Glyph g = Glyph.getGlyph(font, fontsize, c);
- if (g.p != null)
- buf.drawPictureAlphaOnly(g.p,
- x,
- y + g.max_ascent - g.baseline - g.max_descent,
- x + g.p.getWidth(),
- y + g.max_ascent - g.baseline + g.p.getHeight() - g.max_descent,
- 0, 0,
- g.p.getWidth(), g.p.getHeight(),
- textcolor);
- x += g.advance;
- }
- }
-