1

I'm working on a live wallpaper. The wallpaper requires small movable images to be behind a large fixed image with transparent areas. The smaller images will only be visible when they are in the transparent parts of the large image.

Here's how I've been doing it so far:

Canvas c = holder.lockCanvas();
c.save()
drawSmallImages(c); //draw the movable images
drawLargeImage(c); //draw the fixed large image
c.restore();

I ran this through traceview and it looks like android is spending a good chunk of processing power to draw the large image, and ideally I'd only want it to be drawn once when the wallpaper starts. I don't know how to get the smaller images to be drawn behind the larger image without re-drawing the large image after the smaller images on each frame.

Josh Lee
  • 171,072
  • 38
  • 269
  • 275
briercan
  • 168
  • 1
  • 11
  • Not an answer but -- maybe you could do it by creating a mask that represents the blank parts of the large image, then using that mask to, well, mask out the hidden (or revealed) parts of the small images. I'm not sure if that ends up being more work .. – Tim Barrass Dec 04 '10 at 21:01

1 Answers1

4

The content of the Canvas won't be cleared so you could easily optimize your drawing by clearing small portions and using the clip rect to redraw only part of the large image.

Romain Guy
  • 97,993
  • 18
  • 219
  • 200