Logo Search packages:      
Sourcecode: qt4-x11 version File versions

QMatrix Class Reference

List of all members.


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.

A QMatrix object can be built using the setMatrix(), scale(), rotate(), translate() and shear() functions. Alternatively, it can be built by applying {QMatrix::Basic Matrix Operations}{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 det() 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.

Definition at line 56 of file qmatrix.h.


Public Member Functions

qreal det () const
qreal dx () const
qreal dy () const
QMatrix inverted (bool *invertible=0) const
bool isIdentity () const
bool isInvertible () const
qreal m11 () const
qreal m12 () const
qreal m21 () const
qreal m22 () const
QPainterPath map (const QPainterPath &p) const
QRegion map (const QRegion &r) const
QPolygon map (const QPolygon &a) const
QPolygonF map (const QPolygonF &a) const
QLineF map (const QLineF &l) const
QLine map (const QLine &l) const
QPointF map (const QPointF &p) const
QPoint map (const QPoint &p) const
void map (qreal x, qreal y, qreal *tx, qreal *ty) const
void map (int x, int y, int *tx, int *ty) const
QRectF mapRect (const QRectF &) const
QRect mapRect (const QRect &) const
QPolygon mapToPolygon (const QRect &r) const
 operator QVariant () const
bool operator!= (const QMatrix &) const
QMatrix operator* (const QMatrix &o) const
QMatrixoperator*= (const QMatrix &)
QMatrixoperator= (const QMatrix &)
bool operator== (const QMatrix &) const
 QMatrix (const QMatrix &matrix)
 QMatrix (qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy)
 QMatrix ()
void reset ()
QMatrixrotate (qreal a)
QMatrixscale (qreal sx, qreal sy)
void setMatrix (qreal m11, qreal m12, qreal m21, qreal m22, qreal dx, qreal dy)
QMatrixshear (qreal sh, qreal sv)
QMatrixtranslate (qreal dx, qreal dy)

Private Attributes

qreal _dx
qreal _dy
qreal _m11
qreal _m12
qreal _m21
qreal _m22

Friends

class QTransform

Related Functions

(Note that these are not member functions.)

QPainterPath operator* (const QPainterPath &path, const QMatrix &matrix)
QRegion operator* (const QRegion &region, const QMatrix &matrix)
QPolygon operator* (const QPolygon &polygon, const QMatrix &matrix)
QPolygonF operator* (const QPolygonF &polygon, const QMatrix &matrix)
QLine operator* (const QLine &line, const QMatrix &matrix)
QLineF operator* (const QLineF &line, const QMatrix &matrix)
QPointF operator* (const QPointF &point, const QMatrix &matrix)
QPoint operator* (const QPoint &point, const QMatrix &matrix)
QDataStreamoperator<< (QDataStream &stream, const QMatrix &matrix)
QDataStreamoperator>> (QDataStream &stream, QMatrix &matrix)

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index