Qt 4.8
Classes | Functions
qmatrix.h File Reference
#include <QtGui/qpolygon.h>
#include <QtGui/qregion.h>
#include <QtGui/qwindowdefs.h>
#include <QtCore/qline.h>
#include <QtCore/qpoint.h>
#include <QtCore/qrect.h>

Go to the source code of this file.

Classes

class  QMatrix
 The QMatrix class specifies 2D transformations of a coordinate system. More...
 

Functions

Q_GUI_EXPORT_INLINE QPoint operator* (const QPoint &p, const QMatrix &m)
 
Q_GUI_EXPORT_INLINE QPointF operator* (const QPointF &p, const QMatrix &m)
 
Q_GUI_EXPORT_INLINE QLineF operator* (const QLineF &l, const QMatrix &m)
 
Q_GUI_EXPORT_INLINE QLine operator* (const QLine &l, const QMatrix &m)
 
Q_GUI_EXPORT_INLINE QPolygon operator* (const QPolygon &a, const QMatrix &m)
 
Q_GUI_EXPORT_INLINE QPolygonF operator* (const QPolygonF &a, const QMatrix &m)
 
Q_GUI_EXPORT_INLINE QRegion operator* (const QRegion &r, const QMatrix &m)
 
Q_GUI_EXPORT QPainterPath operator* (const QPainterPath &p, const QMatrix &m)
 
Q_GUI_EXPORT QDataStreamoperator<< (QDataStream &, const QMatrix &)
 
Q_GUI_EXPORT QDebug operator<< (QDebug, const QMatrix &)
 
Q_GUI_EXPORT QDataStreamoperator>> (QDataStream &, QMatrix &)
 
 Q_DECLARE_TYPEINFO (QMatrix, Q_MOVABLE_TYPE)
 
bool qFuzzyCompare (const QMatrix &m1, const QMatrix &m2)
 

Function Documentation

◆ operator*() [1/8]

Q_GUI_EXPORT_INLINE QPoint operator* ( const QPoint p,
const QMatrix m 
)
related

Definition at line 150 of file qmatrix.h.

Referenced by QMatrix::det(), and operator*().

151 { return m.map(p); }
void map(int x, int y, int *tx, int *ty) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qmatrix.cpp:384

◆ operator*() [2/8]

Q_GUI_EXPORT_INLINE QPointF operator* ( const QPointF p,
const QMatrix m 
)
related

Definition at line 152 of file qmatrix.h.

153 { return m.map(p); }
void map(int x, int y, int *tx, int *ty) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qmatrix.cpp:384

◆ operator*() [3/8]

Q_GUI_EXPORT_INLINE QLineF operator* ( const QLineF l,
const QMatrix m 
)
related

Definition at line 154 of file qmatrix.h.

155 { return m.map(l); }
void map(int x, int y, int *tx, int *ty) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qmatrix.cpp:384

◆ operator*() [4/8]

Q_GUI_EXPORT_INLINE QLine operator* ( const QLine l,
const QMatrix m 
)
related

Definition at line 156 of file qmatrix.h.

157 { return m.map(l); }
void map(int x, int y, int *tx, int *ty) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qmatrix.cpp:384

◆ operator*() [5/8]

Q_GUI_EXPORT_INLINE QPolygon operator* ( const QPolygon a,
const QMatrix m 
)
related

Definition at line 158 of file qmatrix.h.

159 { return m.map(a); }
void map(int x, int y, int *tx, int *ty) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qmatrix.cpp:384

◆ operator*() [6/8]

Q_GUI_EXPORT_INLINE QPolygonF operator* ( const QPolygonF a,
const QMatrix m 
)
related

Definition at line 160 of file qmatrix.h.

161 { return m.map(a); }
void map(int x, int y, int *tx, int *ty) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qmatrix.cpp:384

◆ operator*() [7/8]

Q_GUI_EXPORT_INLINE QRegion operator* ( const QRegion r,
const QMatrix m 
)
related

Definition at line 162 of file qmatrix.h.

163 { return m.map(r); }
void map(int x, int y, int *tx, int *ty) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qmatrix.cpp:384

◆ operator*() [8/8]

Q_GUI_EXPORT QPainterPath operator* ( const QPainterPath p,
const QMatrix m 
)
related

Definition at line 1200 of file qmatrix.cpp.

1201 {
1202  return m.map(p);
1203 }
void map(int x, int y, int *tx, int *ty) const
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qmatrix.cpp:384

◆ operator<<() [1/2]

Q_GUI_EXPORT QDataStream& operator<< ( QDataStream ,
const QMatrix  
)
related

Definition at line 1223 of file qmatrix.cpp.

Referenced by qFuzzyCompare().

1224 {
1225  if (s.version() == 1) {
1226  s << (float)m.m11() << (float)m.m12() << (float)m.m21()
1227  << (float)m.m22() << (float)m.dx() << (float)m.dy();
1228  } else {
1229  s << double(m.m11())
1230  << double(m.m12())
1231  << double(m.m21())
1232  << double(m.m22())
1233  << double(m.dx())
1234  << double(m.dy());
1235  }
1236  return s;
1237 }

◆ operator<<() [2/2]

Q_GUI_EXPORT QDebug operator<< ( QDebug  ,
const QMatrix  
)

Definition at line 1275 of file qmatrix.cpp.

1276 {
1277  dbg.nospace() << "QMatrix("
1278  << "11=" << m.m11()
1279  << " 12=" << m.m12()
1280  << " 21=" << m.m21()
1281  << " 22=" << m.m22()
1282  << " dx=" << m.dx()
1283  << " dy=" << m.dy()
1284  << ')';
1285  return dbg.space();
1286 }

◆ operator>>()

Q_GUI_EXPORT QDataStream& operator>> ( QDataStream ,
QMatrix  
)
related

Definition at line 1252 of file qmatrix.cpp.

Referenced by qFuzzyCompare().

1253 {
1254  if (s.version() == 1) {
1255  float m11, m12, m21, m22, dx, dy;
1256  s >> m11; s >> m12; s >> m21; s >> m22;
1257  s >> dx; s >> dy;
1258  m.setMatrix(m11, m12, m21, m22, dx, dy);
1259  }
1260  else {
1261  double m11, m12, m21, m22, dx, dy;
1262  s >> m11;
1263  s >> m12;
1264  s >> m21;
1265  s >> m22;
1266  s >> dx;
1267  s >> dy;
1268  m.setMatrix(m11, m12, m21, m22, dx, dy);
1269  }
1270  return s;
1271 }

◆ Q_DECLARE_TYPEINFO()

Q_DECLARE_TYPEINFO ( QMatrix  ,
Q_MOVABLE_TYPE   
)

◆ qFuzzyCompare()

bool qFuzzyCompare ( const QMatrix m1,
const QMatrix m2 
)
related

Definition at line 172 of file qmatrix.h.

173 {
174  return qFuzzyCompare(m1.m11(), m2.m11())
175  && qFuzzyCompare(m1.m12(), m2.m12())
176  && qFuzzyCompare(m1.m21(), m2.m21())
177  && qFuzzyCompare(m1.m22(), m2.m22())
178  && qFuzzyCompare(m1.dx(), m2.dx())
179  && qFuzzyCompare(m1.dy(), m2.dy());
180 }
qreal dx() const
Returns the horizontal translation factor.
Definition: qmatrix.h:77
qreal m12() const
Returns the vertical shearing factor.
Definition: qmatrix.h:74
qreal m11() const
Returns the horizontal scaling factor.
Definition: qmatrix.h:73
qreal m21() const
Returns the horizontal shearing factor.
Definition: qmatrix.h:75
qreal dy() const
Returns the vertical translation factor.
Definition: qmatrix.h:78
bool qFuzzyCompare(const QMatrix &m1, const QMatrix &m2)
The qFuzzyCompare function is for comparing two matrices using a fuzziness factor.
Definition: qmatrix.h:172
qreal m22() const
Returns the vertical scaling factor.
Definition: qmatrix.h:76