File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010按照惯例,先放方法表做概览。
1111
12- | 方法类别 | 相关API | 摘要 |
13- | -------- | ---------------------------------------- | - ------------------------- |
12+ | 方法类别 | 相关API | 摘要 |
13+ | : ------: | ---------------------------------------- | : ------------------------- |
1414| 设置(set) | setConcat setRotate setScale setSkew setTranslate | 设置变换 |
1515| 前乘(pre) | preConcat preRotate preScale preSkew preTranslate | 前乘变换 |
1616| 后乘(post) | postConcat postRotate postScale postSkew postTranslate | 后乘变换 |
17- | 特殊方法 | setPolyToPoly setRectToRect rectStaysRect setSinCos | 一些特殊操作 |
18- | 矩阵相关 | invert isAffine isIdentity | 求逆矩阵、 是否为仿射矩阵、 是否为单位矩阵 ... |
17+ | 特殊方法 | setPolyToPoly setRectToRect rectStaysRect setSinCos | 一些特殊操作 |
18+ | 矩阵相关 | invert isAffine isIdentity | 求逆矩阵、 是否为仿射矩阵、 是否为单位矩阵 ... |
1919
2020
2121## Matrix方法详解
@@ -37,14 +37,14 @@ Matrix matrix = new Matrix();
3737
3838通过这种方式创建出来的并不是一个数值全部为空的矩阵,而是一个单位矩阵,如下:
3939
40- ![ ] (http://latex.codecogs.com/png.latex?$$
41- \\ left [
42- \\ begin{matrix}
43- 1 & 0 & 0 \\\\
44- 0 & 1 & 0 \\\\
40+ ![ ] (http://latex.codecogs.com/png.latex?$$
41+ \left [
42+ \begin{matrix}
43+ 1 & 0 & 0 \\ \
44+ 0 & 1 & 0 \\ \
45450 & 0 & 1
46- \\ end{1}
47- \\ right ]
46+ \end{1}
47+ \right ]
4848$$ )
4949
5050
@@ -372,9 +372,17 @@ mapPoints: [600.0, 900.0]
372372
373373**关于四种基本变换的知识和三种对应操作的区别,详细可以参考 [Canvas之画布操作](http://www.gcssloop.com/2015/02/Canvas_Convert/) 和 [Matrix原理](http://www.gcssloop.com/2015/02/Matrix_Basic/) 这两篇文章的内容。**
374374
375+ 由于之前的文章已经详细的讲解过了它们的原理与用法,所以此处就简要的介绍一下:
375376
377+ | 方法 | 简介 |
378+ | ---- | ------------------------------------ |
379+ | set | 设置,会覆盖掉之前的数值,导致之前的操作失效。 |
380+ | pre | 前乘,相当于矩阵的右乘, `M' = M * S` (S指为特殊矩阵) |
381+ | post | 后乘,相当于矩阵的左乘,`M' = S * M` (S指为特殊矩阵) |
376382
377- dd
383+ **Matrix 相关的一些坑:**
384+
385+ - 1.一开始从Canvas中获取到到Matrix并不是初始矩阵,而是经过偏移后到矩阵。
378386
379387
380388
You can’t perform that action at this time.
0 commit comments