public void paint() { window.clear(false); color_gc.set_foreground(0xff0000); color_pixmap.rectangle(color_gc, 0, 0, 1, 1, true); alpha_gc.set_foreground(0x00); alpha_pixmap.rectangle(alpha_gc, 0, 0, window.width, window.height, true); alpha_gc.set_foreground(0x7f); alpha_pixmap.rectangle(alpha_gc, 10, 10, 50, 50, true); render.composite(Render.OVER, color_picture, alpha_picture, window_picture, 0, 0, 0, 0, 0, 0, window.width, window.height); color_gc.set_foreground(0x0000ff); color_pixmap.rectangle(color_gc, 0, 0, 1, 1, true); alpha_gc.set_foreground(0x00); alpha_pixmap.rectangle(alpha_gc, 0, 0, window.width, window.height, true); alpha_gc.set_foreground(0x7f); alpha_pixmap.rectangle(alpha_gc, 40, 40, 50, 50, true); render.composite(Render.OVER, color_picture, alpha_picture, window_picture, 0, 0, 0, 0, 0, 0, window.width, window.height + 10); }
public Sprite (float dx, float dy, int color, int width, int height, Picture.Format pf) { x = window.width/2; y = window.height/2; this.dx = dx; this.dy = dy; this.color = color; this.width = width; this.height = height; pixmap = new Pixmap (display.default_root, width, height, pf.depth ()); picture = render.create_picture (pixmap, pf, Picture.Attributes.EMPTY); if (sprite_gc == null) sprite_gc = new GC (pixmap); sprite_gc.set_foreground (0); pixmap.rectangle (sprite_gc, 0, 0, width, height, true); sprite_gc.set_foreground (color); pixmap.arc (sprite_gc, 0, 0, width, height, 0, 360*64, true); for (int i=0; i<8; i++) { sprite_gc.set_foreground (divide_color (color, 1<<(7-i))); pixmap.arc (sprite_gc, i, i, width-2*i, height-2*i, 0, 360*64, true); } }
public Sprite(float dx, float dy, int color, int width, int height, Picture.Format pf) { x = window.width / 2; y = window.height / 2; this.dx = dx; this.dy = dy; this.color = color; this.width = width; this.height = height; pixmap = new Pixmap(display.default_root, width, height, pf.depth()); picture = render.create_picture(pixmap, pf, Picture.Attributes.EMPTY); if (sprite_gc == null) { sprite_gc = new GC(pixmap); } sprite_gc.set_foreground(0); pixmap.rectangle(sprite_gc, 0, 0, width, height, true); sprite_gc.set_foreground(color); pixmap.arc(sprite_gc, 0, 0, width, height, 0, 360 * 64, true); for (int i = 0; i < 8; i++) { sprite_gc.set_foreground(divide_color(color, 1 << (7 - i))); pixmap.arc(sprite_gc, i, i, width - 2 * i, height - 2 * i, 0, 360 * 64, true); } }