Skip to content

Commit a3d1b1e

Browse files
committed
Update value compute
1 parent b029bfa commit a3d1b1e

1 file changed

Lines changed: 32 additions & 0 deletions

File tree

‎CustomView/Advance/[10]Matrix_Method.md‎

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,8 +143,40 @@ void mapPoints (float[] dst, int dstIndex,float[] src, int srcIndex, int pointCo
143143
144144
(1) `void mapPoints (float[] pts)` 方法仅有一个参数,pts数组作为参数传递原始数值,计算结果仍存放在pts中。
145145
146+
示例:
147+
148+
``` java
149+
150+
// 初始数据为三个点 (0, 0) (80, 100) (400, 300)
151+
float[] pts = new float[]{0, 0, 80, 100, 400, 300};
152+
153+
// 构造一个matrix,x坐标缩放0.5
154+
Matrix matrix = new Matrix();
155+
matrix.setScale(0.5f, 1f);
156+
157+
// 输出pts计算之前数据
158+
Log.i(TAG, "before: "+ Arrays.toString(pts));
159+
160+
// 调用map方法计算
161+
matrix.mapPoints(pts);
162+
163+
// 输出pts计算之后数据
164+
Log.i(TAG, "after : "+ Arrays.toString(pts));
165+
```
166+
167+
结果:
168+
169+
```
170+
before: [0.0, 0.0, 80.0, 100.0, 400.0, 300.0]
171+
after : [0.0, 0.0, 40.0, 100.0, 200.0, 300.0]
172+
```
173+
146174
(2) `void mapPoints (float[] dst, float[] src)` ,src作为参数传递原始数值,计算结果存放在dst中。
147175
176+
```
177+
```
178+
179+
148180
(3) `void mapPoints (float[] dst, int dstIndex,float[] src, int srcIndex, int pointCount)` 可以指定只计算一部分数值。
149181
150182

0 commit comments

Comments
 (0)