The repaint model is more targetted at applications which have a concept of the current state that needs to be displayed which tends to be updated mostly atomically. Repainting just a small rectangle is meant more as an optimization to indicate which parts of the screen have new data that needs to get there, not as a strict rule of which parts are "ready" with the presumption that other areas are "not ready".
In particular, if someone drags another window or an icon over your window then you will be forced to repaint arbitrary areas at any time. If you are in the process of updating the data that is used to control the rendering in those areas and you are doing it in place in the same data structures that are used to respond to repaint and damage events then you are leaving yourself open to exposing "partially constructed data" whether or not we are strict about your update rectangles.
The only solution I can offer is to change the way you manage the data for your animations such that the state is calculated in separate data structures and then grafted into the display copy atomically or to maintain a "current view" image that is used to do the copies to the screen in update() and paint() and use another scratch image to get your pieces ready. In effect you will end up triple-buffered in that case...
...jim
--On 07/13/04 12:33:12 PM -0600 Dave Aufderheide wrote:
I'm writing a 2D graphics application and have run into a problem where my dirty bounds are getting unioned together to form one larger dirty bounds. Normally this is a pretty good idea to do, but it's causing graphics artifacts because its causing half an image to be redrawn even though it is not really dirty. Again normally this would be okay, but because the scene is animating when this occurs, it renders the "dirty" part of the image using the low quality renderer. This causes an obvious eye soar in the image until the animation ends and the entire screen is redrawn.
I'm now managing my own dirty rectangles, however when the sun.awt RepaintArea class method "paint" is envoked, once again my dirty rectangles get combined into one larger dirty rect. I've done some tests and I absolutely have to paint this entire dirty rect or double buffering causes problems in the area that isn't actually dirty (random data gets copied from the back buffer since I didn't draw to it). Disabling double buffering isn't an option because then you get all the wonderful graphics problems associated with that.
I don't see any other way around my problem other than to avoid unioning the dirty bounds in the first place and to do that I need to somehow over ride the sun.awt RepaintArea.paint() method. Is this possible in some indirect way? I certainly don't see how to do it directly.
Thanks in advance, Dave
=========================================================================== 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".