PlanarTransform QML Type

Provides utility functions for matrix4x4 when used for 2D transforms. 更多...

import 语句: 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 ()

详细描述

The PlanarTransform is a global object with utility functions.

它不可实例化;要使用它,调用成员来自全局 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 )

Returns a matrix4x4 for an affine (non-projecting) 2D transform with the specified values.

This method and its argument order correspond to SVG's matrix() function and the six-argument QTransform constructor. The result is this 4x4 matrix:

scaleX shearX 0 translateX
shearY scaleY 0 translateY
0 0 1 0
0 0 0 1

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

Returns a matrix4x4 for a 2D transform that rotates by angle degrees around the point ( originX , originY ).

originX and originY are optional and default to (0, 0).

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

Returns a matrix4x4 for a 2D transform that scales by scaleX 水平和 scaleY vertically, centered at the point ( originX , originY ).

originX and originY are optional and default to (0, 0).

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

Returns a matrix4x4 for a 2D transform that shears by shearX 水平和 shearY vertically, centered at the point ( originX , originY ).

originX and originY are optional and default to (0, 0).

matrix4x4 fromTranslate ( real translateX , real translateY )

Returns a matrix4x4 for a 2D transform that translates by translateX 水平和 translateY vertically.

matrix4x4 identity ()

Returns a matrix4x4 for the identity transform.

这相当于 Qt::matrix4x4 ().