title: How can I override onDraw so that I take what would have been drawn (as a bitmap) and transform it?
body: <p>The method below works, but it unfortunately, this method involves creating a bitmap the size of the entire screen - not just the area that is drawn to. If I use this to draw UI elements, it is redrawn <em>for each UI element</em>. Can this be done more efficiently?</p>
  
  <pre><code>@Override
  protected void onDraw(Canvas canvas) {
      //TODO: Reduce the burden from multiple drawing
      Bitmap bitmap=Bitmap.createBitmap(canvas.getWidth(), canvas.getHeight(), Config.ARGB_8888);
      Canvas offscreen=new Canvas(bitmap);
      super.onDraw(offscreen);
      //Then draw onscreen
      Paint p=new Paint();
      p.setXfermode(new PorterDuffXfermode(PorterDuff.Mode.DARKEN));
      canvas.drawBitmap(bitmap, 0, 0, p);
  }
  </code></pre>