Skip to content

Commit acce0bc

Browse files
committed
Update value compute
1 parent 60ddd57 commit acce0bc

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

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

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -296,31 +296,37 @@ boolean mapRect (RectF dst, RectF src)
296296
297297
测量矩形变换后位置。
298298
299-
(1) `boolean mapRect (RectF rect)` 测量rect并将测量结果放入rect中,返回值是判断矩形(Rect)变换后是否仍为矩形。
299+
(1) `boolean mapRect (RectF rect)` 测量rect并将测量结果放入rect中,返回值是判断矩形经过变换后是否仍为矩形。
300300
301301
示例:
302302
303303
``` java
304-
RectF rect = new RectF(400, 400, 1000, 800);
305-
306-
// 构造一个matrix,x坐标缩放0.5
307-
Matrix matrix = new Matrix();
308-
matrix.setScale(0.5f, 1f);
309-
310-
Log.i(TAG, "mapRadius: "+rect.toString());
311-
312-
matrix.mapRect(rect);
313-
314-
Log.i(TAG, "mapRadius: "+rect.toString());
304+
RectF rect = new RectF(400, 400, 1000, 800);
305+
306+
// 构造一个matrix
307+
Matrix matrix = new Matrix();
308+
matrix.setScale(0.5f, 1f);
309+
matrix.postSkew(1,0);
310+
311+
Log.i(TAG, "mapRadius: "+rect.toString());
312+
313+
boolean result = matrix.mapRect(rect);
314+
315+
Log.i(TAG, "mapRadius: "+rect.toString());
316+
Log.e(TAG, "isRect: "+ result);
315317
```
316318
317319
结果:
318320
319321
```
320-
RectF(400.0, 400.0, 1000.0, 800.0)
321-
RectF(200.0, 400.0, 500.0, 800.0)
322+
mapRadius: RectF(400.0, 400.0, 1000.0, 800.0)
323+
mapRadius: RectF(600.0, 400.0, 1300.0, 800.0)
324+
isRect: false
322325
```
323326
327+
>
328+
由于使用了错切,所以返回结果为false。
329+
324330
325331
**4.mapVectors**
326332

0 commit comments

Comments
 (0)