title: Android SurfaceView Canvas Layers
body: <p>I am trying to make an application in which you can take an image and apply 'stickers' (multiple bitmap images) to the image. Then allow the user to transform (translate, scale and rotate) each individual 'sticker'. I am currently using a <code>SurfaceView</code> and <code>Canvas</code> to draw each bitmap to that <code>Canvas</code>. It allows the user to directly transform the bitmap, and that bitmap is drawn to the <code>Canvas</code> on in the <code>onDraw()</code> function. Though currently, I can only effectively manipulate the last 'sticker' that was drawn.</p>
  
  <p>I would like to make it so the user can directly manipulate each individual 'sticker'. So my current thought is that I would have to create multiple layers (i.e. Photoshop Layers) of stickers, and determine during <code>onTouchEvent()</code> which sticker is being touched, bring that layer to the front of the stack and manipulate that layer. To do this I think I would have to create multiple <code>Canvas</code> objects to use as layers, then draw each 'sticker' to a single <code>Canvas</code>. Then <code>onTouchEvent</code> would call <code>getDrawingCache()</code> on each <code>Canvas</code> to detect which sticker is being touched by calling <code>getPixel()</code> on that drawing cache, and determining if the pixel is transparent or not.</p>
  
  <p>My question is essentially how would I go about drawing all of these <code>Canvas</code> objects to the <code>SurfaceView</code>? And is this the best way of getting my desired effect?</p>
  
  <p>I know that <code>SurfaceView</code> takes only one <code>Canvas</code>, therefore I would have to draw each <code>Canvas</code> to a single <code>Canvas</code> beforehand? And if that is the case, would each of these <code>Canvas</code> objects keep their transformations in tact when I merge them? Or would I have to manipulate the bitmap within each <code>Canvas</code> object instead of the <code>Canvas</code> itself?  </p>