GraphicsView的旋转,放缩
来源:互联网 发布:2017年最新java面试题 编辑:程序博客网 时间:2024/05/18 22:50
视图可以通过矩阵 QMatrix 设置放缩,旋转;
一般的方式可以直接放缩图像大小本身; 旋转可以旋转图像显示,而不是矩阵变化;
在Qt , GDI+等多种绘图方式中,矩阵方式概念变化图像,是图像变化的一种高级方式;
// extern GraphicsView * graphicsView;
void setupMatrix(){
qreal scale = qPow(qreal(2), (zoomSlider->value() - 250) / qreal(50));
QMatrix matrix;
matrix.scale(scale, scale); // 放缩;
matrix.rotate(rotateSlider->value()); //旋转;graphicsView->setMatrix(matrix);
setResetButtonEnabled();
}
以下是对QMatrix 的描述,具体可以参考帮助文档;
Detailed Description
The QMatrix class specifies 2D transformations of a coordinate system.
A matrix specifies how to translate, scale, shear or rotate the coordinate system, and is typically used when rendering graphics. QMatrix, in contrast to QTransform, does not allow perspective transformations. QTransform is the recommended transformation class in Qt.
A QMatrix object can be built using the setMatrix(), scale(), rotate(), translate() and shear() functions. Alternatively, it can be built by applying basic matrix operations. The matrix can also be defined when constructed, and it can be reset to the identity matrix (the default) using the reset() function.
The QMatrix class supports mapping of graphic primitives: A given point, line, polygon, region, or painter path can be mapped to the coordinate system defined by this matrix using the map() function. In case of a rectangle, its coordinates can be transformed using the mapRect() function. A rectangle can also be transformed into a polygon (mapped to the coordinate system defined by this matrix), using the mapToPolygon() function.
QMatrix provides the isIdentity() function which returns true if the matrix is the identity matrix, and the isInvertible() function which returns true if the matrix is non-singular (i.e. AB = BA = I). The inverted() function returns an inverted copy of this matrix if it is invertible (otherwise it returns the identity matrix). In addition, QMatrix provides the determinant() function returning the matrix's determinant.
Finally, the QMatrix class supports matrix multiplication, and objects of the class can be streamed as well as compared.
- GraphicsView的旋转,放缩
- 图片的旋转与放缩
- Qt的GraphicsView框架
- UIView关于图片的旋转与放缩
- HTML5 Canvas平移,放缩,旋转演示
- CGAffineTransform 用于视图平移,放缩,旋转
- Android | Vuforia 模型平移、旋转、放缩
- IOS CGAffineTransform视图平移,放缩,旋转
- Processing 教程(7) - 平移、旋转、放缩
- CGAffineTransform 用于视图平移,放缩,旋转
- 2D游戏引擎中的旋转,平移和放缩的几何知识
- 数字图像的几何变换(旋转、放缩、平移)详解(-)
- Libgdx专题系列:对象篇 纹理的旋转,放缩,位移
- cesium 中地图发生了平移,放缩,旋转等动作所要执行的动作
- 【转载】关于graphicsview背景透明的问题
- MC新手入门(十一)------动画旋转放缩
- IOS CGAffineTransform 用于视图平移,放缩,旋转
- IOS CGAffineTransform 用于视图平移,放缩,旋转
- java获取日期相关小方法
- struts2没有文件时处理办法
- Debian的一点快捷设置(补充 ing)
- 当被VPD屏蔽查询不到数据时
- 在Linux中通过本地复制的方式创建多一个Oracle数据库
- GraphicsView的旋转,放缩
- hadoop的datanode新建异常处理
- json 解析都层数据
- Grails 与 Maven 集成
- 【POJ 1961】
- Highcharts + jQuery + Servlet 实现从后台获取JSON实时刷新图表
- 14周 项目6-字符串操作
- 通常情况下, 多次启动Tomcat或者非正常关闭Myeclipse,但是占用端口的进程没有关闭,也会出现这样的错误。解决方法是关闭javaw.exe进程。
- 第一届大学生全国数据挖掘邀请赛#的数据集分析