'Rightness' of immediate-mode painting
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Luke_Evans
Posted On:   Thursday, September 6, 2001 03:58 PM

I have some code which uses XOR drawing performed directly from mouse event to do various kinds of user feedback (rubberbanding, outline dragging etc.). This was all working OK until the component it drew into was changed such that it was part of a JScrollPane. Code was added to allow for the automatic scrolling of the pane (and even it's automatic expansion) when components are dragged off the visible area. Now, ever since this change, our XOR drawing has not functioned correctly, and often leaves artifacts when viewport events are also involved - despite many attempts to ensure synchronicity with these other events (e.g. 'undrawing' before such viewport sizing/scrolling events occur). I have seen various hints to the effect that this kind of 'im   More>>

I have some code which uses XOR drawing performed directly from mouse event to do various kinds of user feedback (rubberbanding, outline dragging etc.). This was all working OK until the component it drew into was changed such that it was part of a JScrollPane.
Code was added to allow for the automatic scrolling of the pane (and even it's automatic expansion) when components are dragged off the visible area.
Now, ever since this change, our XOR drawing has not functioned correctly, and often leaves artifacts when viewport events are also involved - despite many attempts to ensure synchronicity with these other events (e.g. 'undrawing' before such viewport sizing/scrolling events occur). I have seen various hints to the effect that this kind of 'immediate-mode' drawing is not really supported in Java and that ALL drawing (including 'temporary entities like rubberbands and outlines') should be done within paintComponent. Can anyone catagorically confirm or deny this? Obviously there are definite advantages (lightweightness) in XOR drawing 'on demand', but if this is simply somehow 'illegal' then we had better bite the bullet and alter the code to fit the canonical form.

Thanks for your help!

Luke

   <<Less
About | Sitemap | Contact