// (c) 1998 Ekkehard Kraemer (ekraemer@pluto.camelot.de) import java.awt.*; /** * Sorry, not documented yet. *

* Source */ class Update extends Rectangle { Update(Canvas canvas,Image backimg,int maxw,int maxh) { super(0,0,0,0); this.canvas=canvas; this.backimg=backimg; this.maxw=maxw; this.maxh=maxh; } public void add(int ax,int ay,int aw,int ah) { add(new Rectangle(ax,ay,aw,ah)); } synchronized public void add(Rectangle r) { if (r.x<0) r.x=0; if (r.y<0) r.y=0; if (width==0 && height==0) { this.x=r.x; this.y=r.y; this.width=r.width; this.height=r.height; } else super.add(r); } synchronized void update() { if (width==0 && height==0) return; Graphics gr=canvas.getGraphics(); gr.clipRect(x,y,width,height); gr.drawImage(backimg,0,0,null); gr.dispose(); width=0; height=0; } Canvas canvas; Image backimg; int maxw,maxh; }