This commit is contained in:
sloop
2016-01-27 01:19:56 +08:00
parent 56ba70582d
commit a3b4289349

View File

@@ -185,6 +185,27 @@ translate 是干什么用的呢?
<img src="https://github.com/GcsSloop/AndroidNote/blob/master/%E9%97%AE%E9%A2%98/Canvas/Art2/rotate2.jpg" width = "270" height = "480" alt="title" align=center /> <img src="https://github.com/GcsSloop/AndroidNote/blob/master/%E9%97%AE%E9%A2%98/Canvas/Art2/rotate2.jpg" width = "270" height = "480" alt="title" align=center />
<b>好吧,旋转也是可叠加的</b>
```
canvas.rotate(180);
canvas.rotate(20);
```
调用两次旋转则实际的旋转角度为180+20=200度。
为了演示这一个效果,我做了一个不明觉厉的东西:
```
// 将坐标系原点移动到画布正中心
canvas.translate(mWidth / 2, mHeight / 2);
canvas.drawCircle(0,0,400,mPaint); // 绘制两个圆形
canvas.drawCircle(0,0,380,mPaint);
for (int i=0; i<=360; i+=10){ // 绘制圆形之间的连接线
canvas.drawLine(0,380,0,400,mPaint);
canvas.rotate(10);
}
```
<img src="https://github.com/GcsSloop/AndroidNote/blob/master/%E9%97%AE%E9%A2%98/Canvas/Art2/rotate3.jpg" width = "270" height = "480" alt="title" align=center />
***** *****
#### ⑷倾斜(skew) #### ⑷倾斜(skew)