Hi flar, > If the clip would be constructed once and then reused > a lot, then the Area operations that Dmitri posted > are the most general and safest way (but not the > fastest) to construct it.
It seems to be fast enough at this stage. > On the other hand, if all of the foreground > rectangles are *known* to be non-overlapping, and if > the background rectangle is *known* to encompass them > all, and you need to reconstruct it pretty quickly > fairly often, then a faster, though not as general, > way to construct it would be to append all of the > rectangles into a GeneralPath with an EvenOdd winding > rule which will contain only those areas that are > inside the big outer rectangle, but not inside the > smaller inner rectangles (which must not overlap). I will look at this if I find I need the extra speed and also as a learning exercise. > How many smaller inner rectangles are we talking > about? Potentially hundreds. > Are some of them off the screen? Potentially yes. > Have you tried skipping the rendering calls for the > ones that are known to be off the visible part of the > window? Yes. > Which calls are you using to render the rectangles? > drawRect() will be *much, much* faster than > draw(rectangleObject) for example. They are not simple Rectangles per se but rather rectangular shapes whose outline is being rendered with drawLine() calls. -- And loving it, -Q _________________________________________________ [EMAIL PROTECTED] (Replace the "SixFour" with numbers to email me) [Message sent by forum member 'qu0ll' (qu0ll)] http://forums.java.net/jive/thread.jspa?messageID=246698 =========================================================================== To unsubscribe, send email to [EMAIL PROTECTED] and include in the body of the message "signoff JAVA2D-INTEREST". For general help, send email to [EMAIL PROTECTED] and include in the body of the message "help".