| 1 | /****************************************************************************
|
|---|
| 2 | **
|
|---|
| 3 | ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
|
|---|
| 4 | ** Contact: Qt Software Information ([email protected])
|
|---|
| 5 | **
|
|---|
| 6 | ** This file is part of the QtGui module of the Qt Toolkit.
|
|---|
| 7 | **
|
|---|
| 8 | ** $QT_BEGIN_LICENSE:LGPL$
|
|---|
| 9 | ** Commercial Usage
|
|---|
| 10 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
|---|
| 11 | ** accordance with the Qt Commercial License Agreement provided with the
|
|---|
| 12 | ** Software or, alternatively, in accordance with the terms contained in
|
|---|
| 13 | ** a written agreement between you and Nokia.
|
|---|
| 14 | **
|
|---|
| 15 | ** GNU Lesser General Public License Usage
|
|---|
| 16 | ** Alternatively, this file may be used under the terms of the GNU Lesser
|
|---|
| 17 | ** General Public License version 2.1 as published by the Free Software
|
|---|
| 18 | ** Foundation and appearing in the file LICENSE.LGPL included in the
|
|---|
| 19 | ** packaging of this file. Please review the following information to
|
|---|
| 20 | ** ensure the GNU Lesser General Public License version 2.1 requirements
|
|---|
| 21 | ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|---|
| 22 | **
|
|---|
| 23 | ** In addition, as a special exception, Nokia gives you certain
|
|---|
| 24 | ** additional rights. These rights are described in the Nokia Qt LGPL
|
|---|
| 25 | ** Exception version 1.0, included in the file LGPL_EXCEPTION.txt in this
|
|---|
| 26 | ** package.
|
|---|
| 27 | **
|
|---|
| 28 | ** GNU General Public License Usage
|
|---|
| 29 | ** Alternatively, this file may be used under the terms of the GNU
|
|---|
| 30 | ** General Public License version 3.0 as published by the Free Software
|
|---|
| 31 | ** Foundation and appearing in the file LICENSE.GPL included in the
|
|---|
| 32 | ** packaging of this file. Please review the following information to
|
|---|
| 33 | ** ensure the GNU General Public License version 3.0 requirements will be
|
|---|
| 34 | ** met: http://www.gnu.org/copyleft/gpl.html.
|
|---|
| 35 | **
|
|---|
| 36 | ** If you are unsure which license is appropriate for your use, please
|
|---|
| 37 | ** contact the sales department at [email protected].
|
|---|
| 38 | ** $QT_END_LICENSE$
|
|---|
| 39 | **
|
|---|
| 40 | ****************************************************************************/
|
|---|
| 41 | #ifndef QTRANSFORM_H
|
|---|
| 42 | #define QTRANSFORM_H
|
|---|
| 43 |
|
|---|
| 44 | #include <QtGui/qmatrix.h>
|
|---|
| 45 | #include <QtGui/qpainterpath.h>
|
|---|
| 46 | #include <QtGui/qpolygon.h>
|
|---|
| 47 | #include <QtGui/qregion.h>
|
|---|
| 48 | #include <QtGui/qwindowdefs.h>
|
|---|
| 49 | #include <QtCore/qline.h>
|
|---|
| 50 | #include <QtCore/qpoint.h>
|
|---|
| 51 | #include <QtCore/qrect.h>
|
|---|
| 52 |
|
|---|
| 53 | QT_BEGIN_HEADER
|
|---|
| 54 |
|
|---|
| 55 | QT_BEGIN_NAMESPACE
|
|---|
| 56 |
|
|---|
| 57 | QT_MODULE(Gui)
|
|---|
| 58 |
|
|---|
| 59 | class QVariant;
|
|---|
| 60 |
|
|---|
| 61 | class Q_GUI_EXPORT QTransform
|
|---|
| 62 | {
|
|---|
| 63 | Q_ENUMS(TransformationType)
|
|---|
| 64 | public:
|
|---|
| 65 | enum TransformationType {
|
|---|
| 66 | TxNone = 0x00,
|
|---|
| 67 | TxTranslate = 0x01,
|
|---|
| 68 | TxScale = 0x02,
|
|---|
| 69 | TxRotate = 0x04,
|
|---|
| 70 | TxShear = 0x08,
|
|---|
| 71 | TxProject = 0x10
|
|---|
| 72 | };
|
|---|
| 73 |
|
|---|
| 74 | QTransform();
|
|---|
| 75 | QTransform(qreal h11, qreal h12, qreal h13,
|
|---|
| 76 | qreal h21, qreal h22, qreal h23,
|
|---|
| 77 | qreal h31, qreal h32, qreal h33 = 1.0);
|
|---|
| 78 | QTransform(qreal h11, qreal h12, qreal h21,
|
|---|
| 79 | qreal h22, qreal dx, qreal dy);
|
|---|
| 80 | explicit QTransform(const QMatrix &mtx);
|
|---|
| 81 |
|
|---|
| 82 | bool isAffine() const;
|
|---|
| 83 | bool isIdentity() const;
|
|---|
| 84 | bool isInvertible() const;
|
|---|
| 85 | bool isScaling() const;
|
|---|
| 86 | bool isRotating() const;
|
|---|
| 87 | bool isTranslating() const;
|
|---|
| 88 |
|
|---|
| 89 | TransformationType type() const;
|
|---|
| 90 |
|
|---|
| 91 | inline qreal determinant() const;
|
|---|
| 92 | qreal det() const;
|
|---|
| 93 |
|
|---|
| 94 | qreal m11() const;
|
|---|
| 95 | qreal m12() const;
|
|---|
| 96 | qreal m13() const;
|
|---|
| 97 | qreal m21() const;
|
|---|
| 98 | qreal m22() const;
|
|---|
| 99 | qreal m23() const;
|
|---|
| 100 | qreal m31() const;
|
|---|
| 101 | qreal m32() const;
|
|---|
| 102 | qreal m33() const;
|
|---|
| 103 | qreal dx() const;
|
|---|
| 104 | qreal dy() const;
|
|---|
| 105 |
|
|---|
| 106 | void setMatrix(qreal m11, qreal m12, qreal m13,
|
|---|
| 107 | qreal m21, qreal m22, qreal m23,
|
|---|
| 108 | qreal m31, qreal m32, qreal m33);
|
|---|
| 109 |
|
|---|
| 110 | QTransform inverted(bool *invertible = 0) const;
|
|---|
| 111 | QTransform adjoint() const;
|
|---|
| 112 | QTransform transposed() const;
|
|---|
| 113 |
|
|---|
| 114 | QTransform &translate(qreal dx, qreal dy);
|
|---|
| 115 | QTransform &scale(qreal sx, qreal sy);
|
|---|
| 116 | QTransform &shear(qreal sh, qreal sv);
|
|---|
| 117 | QTransform &rotate(qreal a, Qt::Axis axis = Qt::ZAxis);
|
|---|
| 118 | QTransform &rotateRadians(qreal a, Qt::Axis axis = Qt::ZAxis);
|
|---|
| 119 |
|
|---|
| 120 | static bool squareToQuad(const QPolygonF &square, QTransform &result);
|
|---|
| 121 | static bool quadToSquare(const QPolygonF &quad, QTransform &result);
|
|---|
| 122 | static bool quadToQuad(const QPolygonF &one,
|
|---|
| 123 | const QPolygonF &two,
|
|---|
| 124 | QTransform &result);
|
|---|
| 125 |
|
|---|
| 126 | bool operator==(const QTransform &) const;
|
|---|
| 127 | bool operator!=(const QTransform &) const;
|
|---|
| 128 |
|
|---|
| 129 | QTransform &operator*=(const QTransform &);
|
|---|
| 130 | QTransform operator*(const QTransform &o) const;
|
|---|
| 131 |
|
|---|
|
|---|