No... you use Graphics to draw to components... you can't query the Graphics object to see what was drawn... though you can create an Image (like BufferedImage), draw to that, and ask the image what is drawn on it...
What exactly are you trying to do?
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Mar 31, 2001
My question is motivated by animation in full-screen exclusive mode, typically with page flipping. If an animation involves relatively few scene changes between frames, I might render the pages incrementally. Each page would receive only the necessary updates before being displayed. Now consider the implementation of a sprite under these circumstances. Just before a sprite is rendered, it would be useful to have the sprite save the portion of the scene it is about to cover. The sprite would store a sprite-sized overwritten image for each page. The appropriate image would be restored to the volatile buffer immediately after each invocation of bufferStrategy.getDrawGraphics(). Unfortunately I know of no way to retrieve the portion of the image that is about to be overwritten by the sprite. I don't know how to access the underlying VolatileImage. Any suggestions? Or am I out of luck?