Android : Canvas set left, top, translate and rotate bitmap

on Friday, September 12, 2014


I want to set left and top Bitmap coordinates then apply Y translation and rotation on this Bitmap but I can't... the result is not what I expected.


Here my code :



point[0] = centerX-bitmapWidth/2;
point[1] = centerY;
point[2] = centerX+bitmapWidth/2;
point[3] = centerY;

rotateMat = new Matrix();
rotateMat.setTranslate(0, translationY);
rotateMat.setRotate(angle, centerX, centerY);
rotateMat.mapPoints(point);

canvas.drawBitmap(myBitmap, rotateMat, paint);


Could you help me ?


Thanks.


0 comments:

Post a Comment