在绘制指南针的指针的时候犯了会晕,指针的旋转在绘制的时候先进行一个角度的旋转,再进行bitmap的绘制。相当于把整个画布进行了旋转。
void android.graphics.Canvas.rotate(float degrees, float px, float py)
public final void
rotate
(float degrees, float px, float py)
Since:
API Level 1
Preconcat the current matrix with the specified rotation.
Parameters
degrees | The amount to rotate, in degrees |
---|---|
px | The x-coord for the pivot point (unchanged by the rotation) |
py | The y-coord for the pivot point (unchanged by the rotation) |
这里用到的是对中心进行旋转,所以设置下sx和sy为图片的中心位置即可。
另外canvas的几个类似的方法
canvas.scale(sx, sy);
canvas.translate(dx, dy);
另外的一篇绘制圆角http://blog.csdn.net/pipisky2006/article/details/6160348