PlanarTransform QML Type | Qt Quick | Qt 6.10.3
Description: Provides utility functions for matrix4x4 when used for 2D transforms.

- Qt 6.10
- Qt Quick
- QML Types
- PlanarTransform
- Qt 6.10.3 Reference Documentation

# PlanarTransform QML Type

Provides utility functions for matrix4x4 when used for 2D transforms. More...

Import Statement: | `import QtQuick`
Since: | Qt 6.8

- List of all members, including inherited members

## Methods

- 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()

## Detailed Description

The `PlanarTransform` is a global object with utility functions.

It is not instantiable; to use it, call the members of the global `PlanarTransform` object directly. For example:

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

## Method Documentation

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 horizontally and 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 horizontally and 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 horizontally and translateY vertically.

matrix4x4 identity()

Returns a matrix4x4 for the identity transform.

This is equivalent to Qt::matrix4x4().