Matrix使用简介
2013-05-14 10:06
190 查看
void | setRotate(float degrees) Set the matrix to rotate about (0,0) by the specified number of degrees. |
void | setRotate(float degrees, float px, float py) Set the matrix to rotate by the specified number of degrees, with a pivot point at (px, py). |
缩放,翻转
void | setScale(float sx, float sy) Set the matrix to scale by sx and sy. |
void | setScale(float sx, float sy, float px, float py) Set the matrix to scale by sx and sy, with a pivot point at (px, py). |
如果是负数,图形就会翻转
如果没设置原点坐标,默认以0,0点缩放(如果发现图片不见了,检查一下是不是翻转出了屏幕)
例子:setScale(-0.5f, 1,180, 120); //左右翻转并缩放到一半大小
倾斜
void | setSkew(float kx, float ky, float px, float py) Set the matrix to skew by sx and sy, with a pivot point at (px, py). |
void | setSkew(float kx, float ky) Set the matrix to skew by sx and sy. |
坐标
void | setTranslate(float dx, float dy) Set the matrix to translate by (dx, dy). |
注意
Matrix中带有pre, post的函数需要考虑先后顺序
例如:想要旋转45度,然后平移到100,100的位置需要
Java代码
Matrix matrix = new Matrix();
matrix.postRotate(45);
matrix.postTranslate(100, 100);
或者
Java代码
Matrix matrix = new Matrix();
matrix.setTranslate(100, 100);
matrix.preRotate(45);
相关文章推荐
- SQLServer 存储过程简介与使用方法
- libevent功能使用简介
- CMake简介&CMake使用方法
- 第一章 js简介& 第二章 在HTML中使用JavaScript
- C#线程的使用方法简介
- SDWebImage框架的简介与快速使用
- Git Submodule 使用简介
- kafka入门:简介、使用场景、设计原理、主要配置及集群搭建(转)
- 字符编码知识简介和iconv函数的简单使用
- CALayer的简介及使用
- CorePlot的使用方法简介
- .Net服务组件(ServicedComponent)简介及其使用
- MyBatis 使用笔记(1) 简介、安装、配置
- 消息队列(Message Queue)简介及其使用
- C/C++中Sqlite使用简介
- TortoiseSVN使用简介
- Android平台URI简介及使用
- Nodejs自带模块querystring的使用简介