title: Drawing to the canvas
body: <p>I'm writing an android application that draws directly to the canvas on the onDraw event of a View.</p>
  
  <p>I'm drawing something that involves drawing each pixel individually, for this I use something like: </p>
  
  <pre><code>for (int x = 0; x &lt; xMax; x++) {
    for (int y = 0; y &lt; yMax; y++){
      MyColour = CalculateMyPoint(x, y);
      canvas.drawPoint(x, y, MyColour);
    }
  }
  </code></pre>
  
  <p>The problem here is that this takes a long time to paint as the CalculateMyPoint routine is quite an expensive method.</p>
  
  <p>Is there a more efficient way of painting to the canvas, for example should I draw to a bitmap and then paint the whole bitmap to the canvas on the onDraw event? Or maybe evaluate my colours and fill in an array that the onDraw method can use to paint the canvas?</p>
  
  <p>Users of my application will be able to change parameters that affect the drawing on the canvas. This is incredibly slow at the moment.</p>