public native void setIcon(Picture p);
public native void _setMinimized(boolean b);
public native void setTitleBarText(String s);
- public native void setSize(int w, int h);
+ public native void _setSize(int w, int h);
public native void setLocation();
public native void natInit();
public native void toFront();
if (doublebuf != null) return;
// no point in using a shared pixmap since we'll only write to this image once
X11PixelBuffer b = new X11PixelBuffer(width, height, false);
- b.drawPicture(this, 0, 0);
+ b.drawPicture(this, 0, 0, 0, 0, width, height);
if (needsStipple) b.createStipple(this);
doublebuf = b;
}
-
}
/**
natInit();
}
- public void setClip(int x, int y, int x2, int y2) {
- clipx = x; if (clipx < 0) clipx = 0;
- clipy = y; if (clipy < 0) clipy = 0;
- clipw = x2 - x; if (clipw < 0) clipw = 0;
- cliph = y2 - y; if (cliph < 0) cliph = 0;
- }
-
- public void drawPicture(Picture source, int x, int y) {
- drawPicture(source, x, y, x + source.getWidth(), y + source.getHeight(), 0, 0, source.getWidth(), source.getHeight());
+ public void drawPictureAlphaOnly(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb) {
+ slowDrawPicture(source, dx, dy, cx1, cy1, cx2, cy2, rgb, true);
}
-
- public void drawPicture(Picture source, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2) {
- if (!(dx2 - dx1 != sx2 - sx1 || dy2 - dy1 != sy2 - sy1) && ((X11Picture)source).doublebuf != null)
- fastDrawPicture(source, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2);
+ public void drawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2) {
+ if (((X11Picture)source).doublebuf != null)
+ fastDrawPicture(source, dx, dy, cx1, cy1, cx2, cy2);
else
- slowDrawPicture(source, dx1, dy1, dx2, dy2, sx1, sy1, sx2, sy2);
+ slowDrawPicture(source, dx, dy, cx1, cy1, cx2, cy2, 0, false);
}
/** fast path for image drawing (no scaling, all-or-nothing alpha) */
- public native void fastDrawPicture(Picture source, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2);
+ public native void fastDrawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2);
/** slow path for image drawing */
- public native void slowDrawPicture(Picture source, int dx1, int dy1, int dx2, int dy2, int sx1, int sy1, int sx2, int sy2);
+ public native void slowDrawPicture(Picture source, int dx, int dy, int cx1, int cy1, int cx2, int cy2, int rgb, boolean alphaOnly);
public int getWidth() { return width; }
public int getHeight() { return height; }
public native void fillRect(int x, int y, int x2, int y2, int color);
public native void finalize();
+ // FIXME: try to use os acceleration
+ public void fillTrapezoid(int x1, int x2, int y1, int x3, int x4, int y2, int argb) {
+ if (x1 == x3 && x2 == x4) {
+ fillRect(x1, y1, x4, y2, argb);
+ } else for(int y=y1; y<y2; y++) {
+ int _x1 = (int)Math.floor((y - y1) * (x3 - x1) / (y2 - y1) + x1);
+ int _y1 = (int)Math.floor(y);
+ int _x2 = (int)Math.ceil((y - y1) * (x4 - x2) / (y2 - y1) + x2);
+ int _y2 = (int)Math.floor(y) + 1;
+ if (_x1 > _x2) { int _x0 = _x1; _x1 = _x2; _x2 = _x0; }
+ fillRect(_x1, _y1, _x2, _y2, argb);
+ }
+ }
}
}