How to rotate android.graphics.Picture 90 degrees?
*Note: No its not in Bitmap form
How to rotate android.graphics.Picture 90 degrees?
*Note: No its not in Bitmap form
If you are overriding onDraw()
then you can do the following:
canvas.save();
canvas.rotate(90f, picture.getWidth()/2, picture.getHeight/2);
canvas.drawPicture(picture);
canvas.restore();
If you only want to rotate the image itself then you could use this method:
public Picture rotatePicture(float degrees, Picture picture) {
int width = picture.getWidth();
int height = picture.getHeight();
Picture rotatedPicture = new Picture();
Canvas canvas = rotatedPicture.beginRecording(width, height);
canvas.save();
canvas.rotate(degrees, width/2, height/2);
picture.draw(canvas);
canvas.restore();
rotatedPicture.endRecording();
return rotatedPicture;
}