title: Android: What is the correct way to rotate a bitmap?
body: <p>The problem is when the bitmap gets rotated "R0" degrees, it looks like if it changed the pivot point. What I want is for it to rotate around the middle of the bitmap, but I don't know how.    </p>
  
  <pre><code>Bitmap bitmap = (Bitmap) BitmapFactory.decodeResource(getResources(), R.drawable.base);
         Matrix matrix = new Matrix();
         matrix.reset();
         matrix.setScale(bitmap.getWidth(), bitmap.getHeight());
         matrix.setTranslate(-bitmap.getHeight()/2, -bitmap.getHeight()/2);
         matrix.postRotate(R0);
         Bitmap b = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true);
         canvas.drawBitmap(b, x-24, y-40, null);
  </code></pre>
  
  <p>Thanks very much.</p>