title: Loading a resource to a mutable bitmap
body: <p>I am loading a bitmap from a resource like so:</p>
  
  <pre><code> Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image);
  </code></pre>
  
  <p>What I want to do is make some changes to the bitmap before It gets drawn to the main canvas in my <em>draw</em> method (As it would seem wasteful to repeat lots of drawing in my main loop when it isn't going to change). I am making the changes to the bitmap with the following:</p>
  
  <pre><code>Canvas c = new Canvas(mBackground);
  c.drawARGB(...); // etc
  </code></pre>
  
  <p>So naturally I get an exception</p>
  
  <pre><code>java.lang.IllegalStateException: Immutable bitmap passed to Canvas constructor
  </code></pre>
  
  <p>So to avoid that I made a copy of the bitmap so that it is mutable</p>
  
  <pre><code>Bitmap mBackground = BitmapFactory.decodeResource(res,R.drawable.image).copy(Bitmap.Config.ARGB_8888, true);
  </code></pre>
  
  <p>Which avoid the problem however it sometimes causes OutOfMemoryExceptions, do know any better ways of achieving what I want?</p>