is it pos开发者_运维百科sible to remove a drawn image from the canvas ? after it have been called in paint(Graphics g) with a certain condition
I cannot speak for Java ME directly, but if the paint and Graphics methods work in a similar way to standard Java -- and it sounds as though they do -- then you can't unpaint an image.
In standard Java you can create a BufferedImage (see java.awt.image). You draw on the buffered image, and then draw that onto the canvas. That way you can have more than one buffer frame if need be.
You can use a second buffer to copy out the area underneath the picture you are rendering. Then to 'unpaint' it, you could just copy that content back.
If this is for a game, it is probably best to render each frame to the next available back-buffer (keep one or two). Again, I am not certain of J2ME specific restrictions.
精彩评论