rotate image on canvas around its center . i tried some example from net but i am failed
if i am using bitmap.creatbitmap
with matrix i am getting error
Please suggest me which is better
Thanks in advance
Aswan
rotate image on canvas around its center . i tried some example from net but i am failed
if i am using bitmap.creatbitmap
with matrix i am getting error
Please suggest me which is better
Thanks in advance
Aswan
You can use a matrix to rotate. First you set the position (I'm using the coordinates of the bitmap's centre). Then apply a rotation. Then draw using your matrix.
Matrix transform = new Matrix();
transform.setTranslate(xOfCentre, yOfCentre);
transform.preRotate(turnDegrees, width/2, height/2);
canvas.drawBitmap(bitmap, transform, null);
If you want your turning to be animated, then see my answer to "animating and rotating an image...".