Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android : canvas.drawoval() + rotation

I'd like to draw an oval, but I'd like to be able to rotate it. I know that I can use canvas.drawOval(...) and canvas.rotate(...). However, I want to just rotate my oval and not the whole canvas; that is, I want to rotate my oval before draw it to the canvas. I have successfully rotated a rect by manipulating the coordinates before drawing it, but that approach isn't working for me with the oval.

like image 271
Chklang Avatar asked Jan 01 '12 22:01

Chklang


1 Answers

There's canvas.save() and canvas.restore() to serve that purpose - i.e.

canvas.save();
canvas.rotate(90);
canvas.drawOval(....);
canvas.restore();
....//do other drawing
like image 139
asenovm Avatar answered Sep 27 '22 18:09

asenovm