PlanarTransform QML Type

为用于二维变换的 matrix4x4 提供实用功能。更多

Import Statement: import QtQuick
Since: Qt 6.8

方法

  • matrix4x4 fromAffineMatrix(real scaleX, real shearY, real shearX, real scaleY, real translateX, real translateY)
  • matrix4x4 fromRotate(real angle, real originX, real originY)
  • matrix4x4 fromScale(real scaleX, real scaleY, real originX, real originY)
  • matrix4x4 fromShear(float shearX, float shearY, float originX, float originY)
  • matrix4x4 fromTranslate(real translateX, real translateY)
  • matrix4x4 identity()

详细说明

PlanarTransform 是一个具有实用功能的全局对象。

它不可实例化;要使用它,请直接调用PlanarTransform 全局对象的成员。例如

Item {
    transform: Matrix4x4 { matrix: PlanarTransform.fromAffineMatrix(1, 0, 0.36, 1, -36, 0) }
}

方法文档

matrix4x4 fromAffineMatrix(real scaleX, real shearY, real shearX, real scaleY, real translateX, real translateY)

返回一个具有指定值的仿射(非投影)二维变换矩阵 4x4。

该方法及其参数顺序与 SVG 的matrix() 函数和六参数QTransform 构造函数相对应。结果就是这个 4x4 矩阵:

scaleXshearX0translateX
shearYscaleY0translateY
0010
0001

matrix4x4 fromRotate(real angle, real originX, real originY)

返回绕点 (originX,originY) 旋转angle 度的二维变换矩阵 4x4。

originX 和 为可选项,默认值为 (0, 0)。originY


matrix4x4 fromScale(real scaleX, real scaleY, real originX, real originY)

返回二维变换的矩阵 4x4,该变换以点为中心水平缩放scaleX ,垂直缩放scaleY (originX,originY)。

originX 和 为可选项,默认值为 (0,0)。originY


matrix4x4 fromShear(float shearX, float shearY, float originX, float originY)

返回二维变换的矩阵 4x4,该变换以点 (originX,originY) 为中心,水平剪切为shearX ,垂直剪切为shearY

originX 和 为可选项,默认值为 (0,0)。originY


matrix4x4 fromTranslate(real translateX, real translateY)

返回二维变换的矩阵 4x4,该变换的水平平移为translateX ,垂直平移为translateY


matrix4x4 identity()

返回同一变换的矩阵 4x4。

这等同于Qt::matrix4x4()。


© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.