android - Question about rotate bitmap with Canvas.rotate -
as know, can rotate bitmap through 2 ways.
the 1st way is:
matrix mt = new matrix(); mt.postrotate(degree); bitmap bitmap = createbitmap(src, 0, 0, w, h, mt, true); canvs.drawbitmap(bitmap, 0, 0, paint);
in way, need create new bitmap every rotation, not way high performance game or app.
the 2nd way is:
canvas.save(); canvas.rotate(degree); canvas.drawbitmap(bitmap, 0, 0, paint); canvas.restore();
in way, avoid creating new bitmap frequently, rotation bitmap distortion, bitmap quality worse first way.
so, there 3rd way rotate bitmap high performance , quality?
your comments appreciated!
make sure providing paint
canvas.drawbitmap(bitmap, 0, 0, paint)
.
and don't forget use anti-alias , bitmap filtering:
paint = new paint(paint.anti_alias_flag | paint.filter_bitmap_flag);
Comments
Post a Comment