Struct qt_gui::QTransform

source ·
#[repr(C)]
pub struct QTransform { /* private fields */ }
Expand description

The QTransform class specifies 2D transformations of a coordinate system.

C++ class: QTransform.

C++ documentation:

The QTransform class specifies 2D transformations of a coordinate system.

A transformation specifies how to translate, scale, shear, rotate or project the coordinate system, and is typically used when rendering graphics.

QTransform differs from QMatrix in that it is a true 3x3 matrix, allowing perspective transformations. QTransform's toAffine() method allows casting QTransform to QMatrix. If a perspective transformation has been specified on the matrix, then the conversion will cause loss of data.

QTransform is the recommended transformation class in Qt.

A QTransform 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 QTransform 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.

QTransform 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), and adjoint() returns the matrix's classical adjoint. In addition, QTransform provides the determinant() function which returns the matrix's determinant.

Finally, the QTransform class supports matrix multiplication, addition and subtraction, and objects of the class can be streamed as well as compared.

Implementations§

source§

impl QTransform

source

pub unsafe fn add_assign(&self, div: c_double) -> Ref<QTransform>

This is an overloaded function.

Calls C++ function: QTransform& QTransform::operator+=(double div).

C++ documentation:

This is an overloaded function.

Returns the matrix obtained by adding the given scalar to each element of this matrix.

source

pub unsafe fn adjoint(&self) -> CppBox<QTransform>

Returns the adjoint of this matrix.

Calls C++ function: QTransform QTransform::adjoint() const.

C++ documentation:

Returns the adjoint of this matrix.

source

pub unsafe fn copy_from( &self, arg1: impl CastInto<Ref<QTransform>> ) -> Ref<QTransform>

Assigns the given matrix's values to this matrix.

Calls C++ function: QTransform& QTransform::operator=(const QTransform& arg1).

C++ documentation:

Assigns the given matrix’s values to this matrix.

source

pub unsafe fn det(&self) -> c_double

Returns the matrix's determinant. Use determinant() instead.

Calls C++ function: double QTransform::det() const.

C++ documentation:

Returns the matrix’s determinant. Use determinant() instead.

source

pub unsafe fn determinant(&self) -> c_double

Returns the matrix's determinant.

Calls C++ function: double QTransform::determinant() const.

C++ documentation:

Returns the matrix’s determinant.

source

pub unsafe fn div_assign(&self, div: c_double) -> Ref<QTransform>

This is an overloaded function.

Calls C++ function: QTransform& QTransform::operator/=(double div).

C++ documentation:

This is an overloaded function.

Returns the result of performing an element-wise division of this matrix by the given scalar.

source

pub unsafe fn dx(&self) -> c_double

Returns the horizontal translation factor.

Calls C++ function: double QTransform::dx() const.

C++ documentation:

Returns the horizontal translation factor.

See also m31(), translate(), and Basic Matrix Operations.

source

pub unsafe fn dy(&self) -> c_double

Returns the vertical translation factor.

Calls C++ function: double QTransform::dy() const.

C++ documentation:

Returns the vertical translation factor.

See also translate() and Basic Matrix Operations.

source

pub unsafe fn from_scale(dx: c_double, dy: c_double) -> CppBox<QTransform>

Creates a matrix which corresponds to a scaling of sx horizontally and sy vertically. This is the same as QTransform().scale(sx, sy) but slightly faster.

Calls C++ function: static QTransform QTransform::fromScale(double dx, double dy).

C++ documentation:

Creates a matrix which corresponds to a scaling of sx horizontally and sy vertically. This is the same as QTransform().scale(sx, sy) but slightly faster.

This function was introduced in Qt 4.5.

source

pub unsafe fn from_translate(dx: c_double, dy: c_double) -> CppBox<QTransform>

Creates a matrix which corresponds to a translation of dx along the x axis and dy along the y axis. This is the same as QTransform().translate(dx, dy) but slightly faster.

Calls C++ function: static QTransform QTransform::fromTranslate(double dx, double dy).

C++ documentation:

Creates a matrix which corresponds to a translation of dx along the x axis and dy along the y axis. This is the same as QTransform().translate(dx, dy) but slightly faster.

This function was introduced in Qt 4.5.

source

pub unsafe fn inverted_1a(&self, invertible: *mut bool) -> CppBox<QTransform>

Returns an inverted copy of this matrix.

Calls C++ function: QTransform QTransform::inverted(bool* invertible = …) const.

C++ documentation:

Returns an inverted copy of this matrix.

If the matrix is singular (not invertible), the returned matrix is the identity matrix. If invertible is valid (i.e. not 0), its value is set to true if the matrix is invertible, otherwise it is set to false.

See also isInvertible().

source

pub unsafe fn inverted_0a(&self) -> CppBox<QTransform>

Returns an inverted copy of this matrix.

Calls C++ function: QTransform QTransform::inverted() const.

C++ documentation:

Returns an inverted copy of this matrix.

If the matrix is singular (not invertible), the returned matrix is the identity matrix. If invertible is valid (i.e. not 0), its value is set to true if the matrix is invertible, otherwise it is set to false.

See also isInvertible().

source

pub unsafe fn is_affine(&self) -> bool

Returns true if the matrix represent an affine transformation, otherwise returns false.

Calls C++ function: bool QTransform::isAffine() const.

C++ documentation:

Returns true if the matrix represent an affine transformation, otherwise returns false.

source

pub unsafe fn is_identity(&self) -> bool

Returns true if the matrix is the identity matrix, otherwise returns false.

Calls C++ function: bool QTransform::isIdentity() const.

C++ documentation:

Returns true if the matrix is the identity matrix, otherwise returns false.

See also reset().

source

pub unsafe fn is_invertible(&self) -> bool

Returns true if the matrix is invertible, otherwise returns false.

Calls C++ function: bool QTransform::isInvertible() const.

C++ documentation:

Returns true if the matrix is invertible, otherwise returns false.

See also inverted().

source

pub unsafe fn is_rotating(&self) -> bool

Returns true if the matrix represents some kind of a rotating transformation, otherwise returns false.

Calls C++ function: bool QTransform::isRotating() const.

C++ documentation:

Returns true if the matrix represents some kind of a rotating transformation, otherwise returns false.

Note: A rotation transformation of 180 degrees and/or 360 degrees is treated as a scaling transformation.

See also reset().

source

pub unsafe fn is_scaling(&self) -> bool

Returns true if the matrix represents a scaling transformation, otherwise returns false.

Calls C++ function: bool QTransform::isScaling() const.

C++ documentation:

Returns true if the matrix represents a scaling transformation, otherwise returns false.

See also reset().

source

pub unsafe fn is_translating(&self) -> bool

Returns true if the matrix represents a translating transformation, otherwise returns false.

Calls C++ function: bool QTransform::isTranslating() const.

C++ documentation:

Returns true if the matrix represents a translating transformation, otherwise returns false.

See also reset().

source

pub unsafe fn m11(&self) -> c_double

Returns the horizontal scaling factor.

Calls C++ function: double QTransform::m11() const.

C++ documentation:

Returns the horizontal scaling factor.

See also scale() and Basic Matrix Operations.

source

pub unsafe fn m12(&self) -> c_double

Returns the vertical shearing factor.

Calls C++ function: double QTransform::m12() const.

C++ documentation:

Returns the vertical shearing factor.

See also shear() and Basic Matrix Operations.

source

pub unsafe fn m13(&self) -> c_double

Returns the horizontal projection factor.

Calls C++ function: double QTransform::m13() const.

C++ documentation:

Returns the horizontal projection factor.

See also translate() and Basic Matrix Operations.

source

pub unsafe fn m21(&self) -> c_double

Returns the horizontal shearing factor.

Calls C++ function: double QTransform::m21() const.

C++ documentation:

Returns the horizontal shearing factor.

See also shear() and Basic Matrix Operations.

source

pub unsafe fn m22(&self) -> c_double

Returns the vertical scaling factor.

Calls C++ function: double QTransform::m22() const.

C++ documentation:

Returns the vertical scaling factor.

See also scale() and Basic Matrix Operations.

source

pub unsafe fn m23(&self) -> c_double

Returns the vertical projection factor.

Calls C++ function: double QTransform::m23() const.

C++ documentation:

Returns the vertical projection factor.

See also translate() and Basic Matrix Operations.

source

pub unsafe fn m31(&self) -> c_double

Returns the horizontal translation factor.

Calls C++ function: double QTransform::m31() const.

C++ documentation:

Returns the horizontal translation factor.

See also dx(), translate(), and Basic Matrix Operations.

source

pub unsafe fn m32(&self) -> c_double

Returns the vertical translation factor.

Calls C++ function: double QTransform::m32() const.

C++ documentation:

Returns the vertical translation factor.

See also dy(), translate(), and Basic Matrix Operations.

source

pub unsafe fn m33(&self) -> c_double

Returns the division factor.

Calls C++ function: double QTransform::m33() const.

C++ documentation:

Returns the division factor.

See also translate() and Basic Matrix Operations.

source

pub unsafe fn map_q_point( &self, p: impl CastInto<Ref<QPoint>> ) -> CppBox<QPoint>

This is an overloaded function.

Calls C++ function: QPoint QTransform::map(const QPoint& p) const.

C++ documentation:

This is an overloaded function.

Creates and returns a QPoint object that is a copy of the given point, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.

source

pub unsafe fn map_q_point_f( &self, p: impl CastInto<Ref<QPointF>> ) -> CppBox<QPointF>

This is an overloaded function.

Calls C++ function: QPointF QTransform::map(const QPointF& p) const.

C++ documentation:

This is an overloaded function.

Creates and returns a QPointF object that is a copy of the given point, p, mapped into the coordinate system defined by this matrix.

source

pub unsafe fn map_q_line(&self, l: impl CastInto<Ref<QLine>>) -> CppBox<QLine>

This is an overloaded function.

Calls C++ function: QLine QTransform::map(const QLine& l) const.

C++ documentation:

This is an overloaded function.

Creates and returns a QLineF object that is a copy of the given line, l, mapped into the coordinate system defined by this matrix.

source

pub unsafe fn map_q_line_f( &self, l: impl CastInto<Ref<QLineF>> ) -> CppBox<QLineF>

This is an overloaded function.

Calls C++ function: QLineF QTransform::map(const QLineF& l) const.

C++ documentation:

This is an overloaded function.

Creates and returns a QLine object that is a copy of the given line, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.

source

pub unsafe fn map_q_polygon_f( &self, a: impl CastInto<Ref<QPolygonF>> ) -> CppBox<QPolygonF>

This is an overloaded function.

Calls C++ function: QPolygonF QTransform::map(const QPolygonF& a) const.

C++ documentation:

This is an overloaded function.

Creates and returns a QPolygonF object that is a copy of the given polygon, mapped into the coordinate system defined by this matrix.

source

pub unsafe fn map_q_polygon( &self, a: impl CastInto<Ref<QPolygon>> ) -> CppBox<QPolygon>

This is an overloaded function.

Calls C++ function: QPolygon QTransform::map(const QPolygon& a) const.

C++ documentation:

This is an overloaded function.

Creates and returns a QPolygon object that is a copy of the given polygon, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.

source

pub unsafe fn map_q_region( &self, r: impl CastInto<Ref<QRegion>> ) -> CppBox<QRegion>

This is an overloaded function.

Calls C++ function: QRegion QTransform::map(const QRegion& r) const.

C++ documentation:

This is an overloaded function.

Creates and returns a QRegion object that is a copy of the given region, mapped into the coordinate system defined by this matrix.

Calling this method can be rather expensive if rotations or shearing are used.

source

pub unsafe fn map_q_painter_path( &self, p: impl CastInto<Ref<QPainterPath>> ) -> CppBox<QPainterPath>

This is an overloaded function.

Calls C++ function: QPainterPath QTransform::map(const QPainterPath& p) const.

C++ documentation:

This is an overloaded function.

Creates and returns a QPainterPath object that is a copy of the given path, mapped into the coordinate system defined by this matrix.

source

pub unsafe fn map_2_int2_int( &self, x: c_int, y: c_int, tx: *mut c_int, ty: *mut c_int )

This is an overloaded function.

Calls C++ function: void QTransform::map(int x, int y, int* tx, int* ty) const.

C++ documentation:

This is an overloaded function.

Maps the given coordinates x and y into the coordinate system defined by this matrix. The resulting values are put in *tx and *ty, respectively. Note that the transformed coordinates are rounded to the nearest integer.

source

pub unsafe fn map_2_double2_double( &self, x: c_double, y: c_double, tx: *mut c_double, ty: *mut c_double )

Maps the given coordinates x and y into the coordinate system defined by this matrix. The resulting values are put in *tx and *ty, respectively.

Calls C++ function: void QTransform::map(double x, double y, double* tx, double* ty) const.

C++ documentation:

Maps the given coordinates x and y into the coordinate system defined by this matrix. The resulting values are put in *tx and *ty, respectively.

The coordinates are transformed using the following formulas:

x’ = m11x + m21y + dx y’ = m22y + m12x + dy if (is not affine) { w’ = m13x + m23y + m33 x’ /= w’ y’ /= w’ }

The point (x, y) is the original point, and (x', y') is the transformed point.

See also Basic Matrix Operations.

source

pub unsafe fn map_rect_q_rect( &self, arg1: impl CastInto<Ref<QRect>> ) -> CppBox<QRect>

This is an overloaded function.

Calls C++ function: QRect QTransform::mapRect(const QRect& arg1) const.

C++ documentation:

This is an overloaded function.

Creates and returns a QRect object that is a copy of the given rectangle, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.

source

pub unsafe fn map_rect_q_rect_f( &self, arg1: impl CastInto<Ref<QRectF>> ) -> CppBox<QRectF>

Creates and returns a QRectF object that is a copy of the given rectangle, mapped into the coordinate system defined by this matrix.

Calls C++ function: QRectF QTransform::mapRect(const QRectF& arg1) const.

C++ documentation:

Creates and returns a QRectF object that is a copy of the given rectangle, mapped into the coordinate system defined by this matrix.

The rectangle's coordinates are transformed using the following formulas:

x’ = m11x + m21y + dx y’ = m22y + m12x + dy if (is not affine) { w’ = m13x + m23y + m33 x’ /= w’ y’ /= w’ }

If rotation or shearing has been specified, this function returns the bounding rectangle. To retrieve the exact region the given rectangle maps to, use the mapToPolygon() function instead.

See also mapToPolygon() and Basic Matrix Operations.

source

pub unsafe fn map_to_polygon( &self, r: impl CastInto<Ref<QRect>> ) -> CppBox<QPolygon>

Creates and returns a QPolygon representation of the given rectangle, mapped into the coordinate system defined by this matrix.

Calls C++ function: QPolygon QTransform::mapToPolygon(const QRect& r) const.

C++ documentation:

Creates and returns a QPolygon representation of the given rectangle, mapped into the coordinate system defined by this matrix.

The rectangle's coordinates are transformed using the following formulas:

x’ = m11x + m21y + dx y’ = m22y + m12x + dy if (is not affine) { w’ = m13x + m23y + m33 x’ /= w’ y’ /= w’ }

Polygons and rectangles behave slightly differently when transformed (due to integer rounding), so matrix.map(QPolygon(rectangle)) is not always the same as matrix.mapToPolygon(rectangle).

See also mapRect() and Basic Matrix Operations.

source

pub unsafe fn mul_assign_q_transform( &self, arg1: impl CastInto<Ref<QTransform>> ) -> Ref<QTransform>

This is an overloaded function.

Calls C++ function: QTransform& QTransform::operator*=(const QTransform& arg1).

C++ documentation:

This is an overloaded function.

Returns the result of multiplying this matrix by the given matrix.

source

pub unsafe fn mul_assign_double(&self, div: c_double) -> Ref<QTransform>

This is an overloaded function.

Calls C++ function: QTransform& QTransform::operator*=(double div).

C++ documentation:

This is an overloaded function.

Returns the result of performing an element-wise multiplication of this matrix with the given scalar.

source

pub unsafe fn new_0a() -> CppBox<QTransform>

Constructs an identity matrix.

Calls C++ function: [constructor] void QTransform::QTransform().

C++ documentation:

Constructs an identity matrix.

All elements are set to zero except m11 and m22 (specifying the scale) and m33 which are set to 1.

See also reset().

source

pub unsafe fn new_9a( h11: c_double, h12: c_double, h13: c_double, h21: c_double, h22: c_double, h23: c_double, h31: c_double, h32: c_double, h33: c_double ) -> CppBox<QTransform>

Constructs a matrix with the elements, m11, m12, m13, m21, m22, m23, m31, m32, m33.

Calls C++ function: [constructor] void QTransform::QTransform(double h11, double h12, double h13, double h21, double h22, double h23, double h31, double h32, double h33 = …).

C++ documentation:

Constructs a matrix with the elements, m11, m12, m13, m21, m22, m23, m31, m32, m33.

See also setMatrix().

source

pub unsafe fn new_6a( h11: c_double, h12: c_double, h21: c_double, h22: c_double, dx: c_double, dy: c_double ) -> CppBox<QTransform>

Constructs a matrix with the elements, m11, m12, m21, m22, dx and dy.

Calls C++ function: [constructor] void QTransform::QTransform(double h11, double h12, double h21, double h22, double dx, double dy).

C++ documentation:

Constructs a matrix with the elements, m11, m12, m21, m22, dx and dy.

See also setMatrix().

source

pub unsafe fn new_1a(mtx: impl CastInto<Ref<QMatrix>>) -> CppBox<QTransform>

Constructs a matrix that is a copy of the given matrix. Note that the m13, m23, and m33 elements are set to 0, 0, and 1 respectively.

Calls C++ function: [constructor] void QTransform::QTransform(const QMatrix& mtx).

C++ documentation:

Constructs a matrix that is a copy of the given matrix. Note that the m13, m23, and m33 elements are set to 0, 0, and 1 respectively.

source

pub unsafe fn new_8a( h11: c_double, h12: c_double, h13: c_double, h21: c_double, h22: c_double, h23: c_double, h31: c_double, h32: c_double ) -> CppBox<QTransform>

Constructs a matrix with the elements, m11, m12, m13, m21, m22, m23, m31, m32, m33.

Calls C++ function: [constructor] void QTransform::QTransform(double h11, double h12, double h13, double h21, double h22, double h23, double h31, double h32).

C++ documentation:

Constructs a matrix with the elements, m11, m12, m13, m21, m22, m23, m31, m32, m33.

See also setMatrix().

source

pub unsafe fn new_copy( other: impl CastInto<Ref<QTransform>> ) -> CppBox<QTransform>

Copy constructor.

Calls C++ function: [constructor] void QTransform::QTransform(const QTransform& other).

C++ documentation:

Copy constructor.

source

pub unsafe fn quad_to_quad( one: impl CastInto<Ref<QPolygonF>>, two: impl CastInto<Ref<QPolygonF>>, result: impl CastInto<Ref<QTransform>> ) -> bool

Creates a transformation matrix, trans, that maps a four-sided polygon, one, to another four-sided polygon, two. Returns true if the transformation is possible; otherwise returns false.

Calls C++ function: static bool QTransform::quadToQuad(const QPolygonF& one, const QPolygonF& two, QTransform& result).

C++ documentation:

Creates a transformation matrix, trans, that maps a four-sided polygon, one, to another four-sided polygon, two. Returns true if the transformation is possible; otherwise returns false.

This is a convenience method combining quadToSquare() and squareToQuad() methods. It allows the input quad to be transformed into any other quad.

See also squareToQuad() and quadToSquare().

source

pub unsafe fn quad_to_square( quad: impl CastInto<Ref<QPolygonF>>, result: impl CastInto<Ref<QTransform>> ) -> bool

Creates a transformation matrix, trans, that maps a four-sided polygon, quad, to a unit square. Returns true if the transformation is constructed or false if such a transformation does not exist.

Calls C++ function: static bool QTransform::quadToSquare(const QPolygonF& quad, QTransform& result).

C++ documentation:

Creates a transformation matrix, trans, that maps a four-sided polygon, quad, to a unit square. Returns true if the transformation is constructed or false if such a transformation does not exist.

See also squareToQuad() and quadToQuad().

source

pub unsafe fn reset(&self)

Resets the matrix to an identity matrix, i.e. all elements are set to zero, except m11 and m22 (specifying the scale) and m33 which are set to 1.

Calls C++ function: void QTransform::reset().

C++ documentation:

Resets the matrix to an identity matrix, i.e. all elements are set to zero, except m11 and m22 (specifying the scale) and m33 which are set to 1.

See also QTransform(), isIdentity(), and Basic Matrix Operations.

source

pub unsafe fn rotate_2a(&self, a: c_double, axis: Axis) -> Ref<QTransform>

Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.

Calls C++ function: QTransform& QTransform::rotate(double a, Qt::Axis axis = …).

C++ documentation:

Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.

Note that if you apply a QTransform to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.

The angle is specified in degrees.

See also setMatrix().

source

pub unsafe fn rotate_1a(&self, a: c_double) -> Ref<QTransform>

Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.

Calls C++ function: QTransform& QTransform::rotate(double a).

C++ documentation:

Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.

Note that if you apply a QTransform to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.

The angle is specified in degrees.

See also setMatrix().

source

pub unsafe fn rotate_radians_2a( &self, a: c_double, axis: Axis ) -> Ref<QTransform>

Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.

Calls C++ function: QTransform& QTransform::rotateRadians(double a, Qt::Axis axis = …).

C++ documentation:

Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.

Note that if you apply a QTransform to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.

The angle is specified in radians.

See also setMatrix().

source

pub unsafe fn rotate_radians_1a(&self, a: c_double) -> Ref<QTransform>

Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.

Calls C++ function: QTransform& QTransform::rotateRadians(double a).

C++ documentation:

Rotates the coordinate system counterclockwise by the given angle about the specified axis and returns a reference to the matrix.

Note that if you apply a QTransform to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.

The angle is specified in radians.

See also setMatrix().

source

pub unsafe fn scale(&self, sx: c_double, sy: c_double) -> Ref<QTransform>

Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the matrix.

Calls C++ function: QTransform& QTransform::scale(double sx, double sy).

C++ documentation:

Scales the coordinate system by sx horizontally and sy vertically, and returns a reference to the matrix.

See also setMatrix().

source

pub unsafe fn set_matrix( &self, m11: c_double, m12: c_double, m13: c_double, m21: c_double, m22: c_double, m23: c_double, m31: c_double, m32: c_double, m33: c_double )

Sets the matrix elements to the specified values, m11, m12, m13 m21, m22, m23 m31, m32 and m33. Note that this function replaces the previous values. QTransform provides the translate(), rotate(), scale() and shear() convenience functions to manipulate the various matrix elements based on the currently defined coordinate system.

Calls C++ function: void QTransform::setMatrix(double m11, double m12, double m13, double m21, double m22, double m23, double m31, double m32, double m33).

C++ documentation:

Sets the matrix elements to the specified values, m11, m12, m13 m21, m22, m23 m31, m32 and m33. Note that this function replaces the previous values. QTransform provides the translate(), rotate(), scale() and shear() convenience functions to manipulate the various matrix elements based on the currently defined coordinate system.

See also QTransform().

source

pub unsafe fn shear(&self, sh: c_double, sv: c_double) -> Ref<QTransform>

Shears the coordinate system by sh horizontally and sv vertically, and returns a reference to the matrix.

Calls C++ function: QTransform& QTransform::shear(double sh, double sv).

C++ documentation:

Shears the coordinate system by sh horizontally and sv vertically, and returns a reference to the matrix.

See also setMatrix().

source

pub unsafe fn square_to_quad( square: impl CastInto<Ref<QPolygonF>>, result: impl CastInto<Ref<QTransform>> ) -> bool

Creates a transformation matrix, trans, that maps a unit square to a four-sided polygon, quad. Returns true if the transformation is constructed or false if such a transformation does not exist.

Calls C++ function: static bool QTransform::squareToQuad(const QPolygonF& square, QTransform& result).

C++ documentation:

Creates a transformation matrix, trans, that maps a unit square to a four-sided polygon, quad. Returns true if the transformation is constructed or false if such a transformation does not exist.

See also quadToSquare() and quadToQuad().

source

pub unsafe fn sub_assign(&self, div: c_double) -> Ref<QTransform>

This is an overloaded function.

Calls C++ function: QTransform& QTransform::operator-=(double div).

C++ documentation:

This is an overloaded function.

Returns the matrix obtained by subtracting the given scalar from each element of this matrix.

source

pub unsafe fn to_affine(&self) -> Ref<QMatrix>

Returns the QTransform as an affine matrix.

Calls C++ function: const QMatrix& QTransform::toAffine() const.

C++ documentation:

Returns the QTransform as an affine matrix.

Warning: If a perspective transformation has been specified, then the conversion will cause loss of data.

source

pub unsafe fn to_q_variant(&self) -> CppBox<QVariant>

Returns the transform as a QVariant.

Calls C++ function: QVariant QTransform::operator QVariant() const.

C++ documentation:

Returns the transform as a QVariant.

source

pub unsafe fn translate(&self, dx: c_double, dy: c_double) -> Ref<QTransform>

Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to the matrix.

Calls C++ function: QTransform& QTransform::translate(double dx, double dy).

C++ documentation:

Moves the coordinate system dx along the x axis and dy along the y axis, and returns a reference to the matrix.

See also setMatrix().

source

pub unsafe fn transposed(&self) -> CppBox<QTransform>

Returns the transpose of this matrix.

Calls C++ function: QTransform QTransform::transposed() const.

C++ documentation:

Returns the transpose of this matrix.

source

pub unsafe fn type_(&self) -> TransformationType

Returns the transformation type of this matrix.

Calls C++ function: QTransform::TransformationType QTransform::type() const.

C++ documentation:

Returns the transformation type of this matrix.

The transformation type is the highest enumeration value capturing all of the matrix's transformations. For example, if the matrix both scales and shears, the type would be TxShear, because TxShear has a higher enumeration value than TxScale.

Knowing the transformation type of a matrix is useful for optimization: you can often handle specific types more optimally than handling the generic case.

Trait Implementations§

source§

impl Add<f64> for &QTransform

source§

fn add(self, n: c_double) -> CppBox<QTransform>

Calls C++ function: QTransform operator+(const QTransform& a, double n).

§

type Output = CppBox<QTransform>

The resulting type after applying the + operator.
source§

impl CppDeletable for QTransform

source§

unsafe fn delete(&self)

The QTransform class specifies 2D transformations of a coordinate system.

Calls C++ function: [destructor] void QTransform::~QTransform().

C++ documentation:

The QTransform class specifies 2D transformations of a coordinate system.

A transformation specifies how to translate, scale, shear, rotate or project the coordinate system, and is typically used when rendering graphics.

QTransform differs from QMatrix in that it is a true 3x3 matrix, allowing perspective transformations. QTransform's toAffine() method allows casting QTransform to QMatrix. If a perspective transformation has been specified on the matrix, then the conversion will cause loss of data.

QTransform is the recommended transformation class in Qt.

A QTransform 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 QTransform 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.

QTransform 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), and adjoint() returns the matrix's classical adjoint. In addition, QTransform provides the determinant() function which returns the matrix's determinant.

Finally, the QTransform class supports matrix multiplication, addition and subtraction, and objects of the class can be streamed as well as compared.

source§

impl Div<f64> for &QTransform

source§

fn div(self, n: c_double) -> CppBox<QTransform>

Calls C++ function: QTransform operator/(const QTransform& a, double n).

§

type Output = CppBox<QTransform>

The resulting type after applying the / operator.
source§

impl Mul<Ref<QTransform>> for &QTransform

source§

fn mul(self, o: Ref<QTransform>) -> CppBox<QTransform>

Returns the result of multiplying this matrix by the given matrix.

Calls C++ function: QTransform QTransform::operator*(const QTransform& o) const.

C++ documentation:

Returns the result of multiplying this matrix by the given matrix.

Note that matrix multiplication is not commutative, i.e. a*b != b*a.

§

type Output = CppBox<QTransform>

The resulting type after applying the * operator.
source§

impl Mul<f64> for &QTransform

source§

fn mul(self, n: c_double) -> CppBox<QTransform>

Calls C++ function: QTransform operator*(const QTransform& a, double n).

§

type Output = CppBox<QTransform>

The resulting type after applying the * operator.
source§

impl PartialEq<Ref<QTransform>> for QTransform

source§

fn eq(&self, arg1: &Ref<QTransform>) -> bool

Returns true if this matrix is equal to the given matrix, otherwise returns false.

Calls C++ function: bool QTransform::operator==(const QTransform& arg1) const.

C++ documentation:

Returns true if this matrix is equal to the given matrix, otherwise returns false.

1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Sub<f64> for &QTransform

source§

fn sub(self, n: c_double) -> CppBox<QTransform>

Calls C++ function: QTransform operator-(const QTransform& a, double n).

§

type Output = CppBox<QTransform>

The resulting type after applying the - operator.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

unsafe fn cast_into(self) -> U

Performs the conversion. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> StaticUpcast<T> for T

source§

unsafe fn static_upcast(ptr: Ptr<T>) -> Ptr<T>

Convert type of a const pointer. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.