[4505] in java-interest

home help back first fref pref prev next nref lref last post

Clipping Rectangles

daemon@ATHENA.MIT.EDU (Elliotte Rusty Harold)
Wed Jan 3 16:02:33 1996

From: "Elliotte Rusty Harold" <elliotte@blackstar.com>
To: java-interest@java.sun.com
Date:          Wed, 3 Jan 1996 15:05:02 EST
Reply-To: elliotte@blackstar.com

A couple of weeks ago I asked how one might reset the clipping 
rectangles.  I haven't received any responses though I''ve seen 
several other people with similar problems. Recently, however, I 
figured out a solution.

Ignore Graphics.clipRect completely. It's severely flawed. Instead 
create separate offscreen Images for each clipping region. Draw into 
those offScreen Images and then copy them onto the appropriate 
section of the of your applet window. Some coordinate conversion will 
almost certainly be necessary.

If the background image isn't a simple color then you'll first need to 
copy the appropriate part of that image to  your offscreen clipping 
Image. You can do this by drawing your background Image into your 
offscreen region with Graphics.drawImage and a suitable shifting of 
coordinates.

This all works for rectangular regions only since that's all we have 
with an Image. 

The Java AWT is really beginning to make me appreciate QuickDraw. 
Other Mac programmers on this list should know what I mean.

--
Elliotte Rusty Harold    Black Star Publishing Co., Inc.
elliotte@blackstar.com   116 East 27th Street
elharo@shock.njit.edu    NY NY 10016
-
This message was sent to the java-interest mailing list
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post