GcsSloop / GcsSloop/AndroidNote

缩放(scale)我有一个疑问

Open
#83 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
9.3k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

```
RectF rect1 = new RectF(0,-200,200,0); // 矩形区域
Paint paint1= new Paint();
paint1.setColor(Color.BLACK);
Paint paint2= new Paint();
paint2.setColor(Color.BLUE);

canvas.drawRect(rect1,paint1);
canvas.scale(0.5f,0.5f,100,0);
//画一个缩放前 矩形蓝
canvas.drawRect(rect1,paint2);
```
![1](https://user-images.githubusercontent.com/20021884/32482175-1e7bb19c-c35c-11e7-9dd7-22ddca30e5e7.png)

```
RectF rect1 = new RectF(0,-200,200,0); // 矩形区域
Paint paint1= new Paint();
paint1.setColor(Color.BLACK);
Paint paint2= new Paint();
paint2.setColor(Color.BLUE);

canvas.drawRect(rect1,paint1);
canvas.scale(0.5f,0.5f,200,0);
//画一个缩放前 矩形蓝
canvas.drawRect(rect1,paint2);
```
![2](https://user-images.githubusercontent.com/20021884/32482474-7529f7b4-c35d-11e7-8411-db9aebd8e514.png)

我将蓝色矩形第一次移动100,缩放中心移动100,位于黑色矩形底部中心。
然而第二次移动200,缩放中心应该在黑色矩形右边线上,目测只是移动了50。
那么移动距离究竟从哪里测量才对?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.