As we know, we can rotate a bitmap in two ways.
First way:
Matrix mt = new Matrix(); mt.postRotate(degree); Bitmap bitmap = CreateBitmap(src, 0, 0, w, h, mt, true); canvs.drawBitmap(bitmap, 0, 0, paint);
Thus, we always need to create new bitmaps for each rotation, this is not a good way for a high-performance game or application.
The second way:
canvas.save(); canvas.rotate(degree); canvas.drawBitmap(bitmap, 0, 0, paint); canvas.restore();
Thus, we often avoid creating a new bitmap, but the rotation bitmap is a distortion, the quality of the bitmap is worse than the first.
So, is there a 3rd way to rotate a bitmap with high performance and good quality?
Your comments are really appreciated!
android
user457210
source share