I've got problems, since when i changed my technique to Canvas from ImageView, the FPSes dropped pretty much.
All of that is because i have to redraw the whole screen (so i can remove the character to place it on the background again). Maybe i should do it some else way?
You dont have to redraw the whole screen. Look at Erels arkanoid sample.
Instead of Invalidating the whole screen, just invalidate the parts you want to redraw.
And even then look for other leaks...do not keep reloading and redrawing bitmaps.
You dont have to redraw the whole screen. Look at Erels arkanoid sample.
Instead of Invalidating the whole screen, just invalidate the parts you want to redraw.
And even then look for other leaks...do not keep reloading and redrawing bitmaps.
If you have the background bitmap loaded in memory, you copy that region onto the part you want to clear.
I think Erels example doesnt have a background so maybe he is just painting a black rectangle.
Kamac,
What works for me is to put a transparent panel on top of the bitmap and draw on the transparent panel. To clear the part of the drawing, I draw a transparent rectangle on the transparent panel. Or I can also set the transparent panel's color to transparent to clear the entire transparent panel but this is slower.
This is like drawing on a transparency, and then wiping off the drawings. It works well on zoomed images and panned images too.