Skip to content

Commit b10c0c7

Browse files
committed
Update
1 parent 8b1187c commit b10c0c7

1 file changed

Lines changed: 18 additions & 26 deletions

File tree

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

Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -3,26 +3,19 @@
33
### 作者微博: [@GcsSloop](http://weibo.com/GcsSloop)
44
### 相关文章: [自定义View目录](http://www.gcssloop.com/1970/01/CustomViewIndex/)
55

6-
7-
## 前言
8-
96
在上一篇文章中,我们对Matrix做了一个简单的了解,偏向理论,在本文中则会详细的讲解Matrix的具体用法,以及Matrix的一些实用技巧。
107

11-
<p id="method" />
128
## Matrix方法表
139

1410
按照惯例,先放方法表做概览。
1511

16-
方法类别 | 相关API | 摘要
17-
-----------|---------------------------------------------------------|------------------------
18-
基本方法 | equals hashCode toString toShortString | 比较、 获取哈希值、 转换为字符串
19-
数值操作 | set reset setValues getValues | 设置、 重置、 设置数值、 获取数值
20-
数值计算 | mapPoints mapRadius mapRect mapVectors | 计算变换后的数值
21-
设置(set) | setConcat setRotate setScale setSkew setTranslate | 设置变换
22-
前乘(pre) | preConcat preRotate preScale preSkew preTranslate | 前乘变换
23-
后乘(post) | postConcat postRotate postScale postSkew postTranslate | 后乘变换
24-
特殊方法 | setPolyToPoly setRectToRect rectStaysRect setSinCos | 一些特殊操作
25-
矩阵相关 | invert isAffine isIdentity | 求逆矩阵、 是否为仿射矩阵、 是否为单位矩阵 ...
12+
| 方法类别 | 相关API | 摘要 |
13+
| -------- | ---------------------------------------- | -------------------------- |
14+
| 设置(set) | setConcat setRotate setScale setSkew setTranslate | 设置变换 |
15+
| 前乘(pre) | preConcat preRotate preScale preSkew preTranslate | 前乘变换 |
16+
| 后乘(post) | postConcat postRotate postScale postSkew postTranslate | 后乘变换 |
17+
| 特殊方法 | setPolyToPoly setRectToRect rectStaysRect setSinCos | 一些特殊操作 |
18+
| 矩阵相关 | invert isAffine isIdentity | 求逆矩阵、 是否为仿射矩阵、 是否为单位矩阵 ... |
2619

2720

2821
## Matrix方法详解
@@ -44,8 +37,7 @@ Matrix matrix = new Matrix();
4437

4538
通过这种方式创建出来的并不是一个数值全部为空的矩阵,而是一个单位矩阵,如下:
4639

47-
![](http://latex.codecogs.com/png.latex?
48-
$$
40+
![](http://latex.codecogs.com/png.latex?$$
4941
\\left [
5042
\\begin{matrix}
5143
1 & 0 & 0 \\\\
@@ -211,19 +203,19 @@ after : dst=[0.0, 0.0, 40.0, 100.0, 200.0, 300.0]
211203
212204
(3) `void mapPoints (float[] dst, int dstIndex,float[] src, int srcIndex, int pointCount)` 可以指定只计算一部分数值。
213205
214-
参数 | 摘要
215-
-----------|---
216-
dst | 目标数据
217-
dstIndex | 目标数据存储位置起始下标
218-
src | 源数据
219-
srcIndex | 源数据存储位置起始下标
220-
pointCount | 计算的点个数
206+
| 参数 | 摘要 |
207+
| ---------- | ------------ |
208+
| dst | 目标数据 |
209+
| dstIndex | 目标数据存储位置起始下标 |
210+
| src | 源数据 |
211+
| srcIndex | 源数据存储位置起始下标 |
212+
| pointCount | 计算的点个数 |
221213
222214
223215
示例:
224216
225217
>
226-
将第二、三个点计算后存储进dst最开始位置。
218+
>将第二、三个点计算后存储进dst最开始位置。
227219
228220
``` java
229221
// 初始数据为三个点 (0, 0) (80, 100) (400, 300)
@@ -327,7 +319,7 @@ isRect: false
327319
```
328320
329321
>
330-
由于使用了错切,所以返回结果为false。
322+
>由于使用了错切,所以返回结果为false。
331323
332324
(2) `boolean mapRect (RectF dst, RectF src)` 测量src并将测量结果放入dst中,返回值是判断矩形经过变换后是否仍为矩形,和之前没有什么太大区别,此处就不啰嗦了。
333325
@@ -382,7 +374,7 @@ mapPoints: [600.0, 900.0]
382374
383375
384376
385-
377+
dd
386378
387379
388380

0 commit comments

Comments
 (0)