File: qmatrix.html

package info (click to toggle)
python-qt4 4.7.3-1%2Bsqueeze1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 28,504 kB
  • ctags: 4,680
  • sloc: python: 28,738; cpp: 8,897; sh: 245; xml: 243; makefile: 150
file content (194 lines) | stat: -rw-r--r-- 27,385 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QMatrix Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="../pyqt4ref.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QMatrix Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QMatrix class specifies 2D transformations of a coordinate system. <a href="#details">More...</a></p>
<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qmatrix.html#QMatrix">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qmatrix.html#QMatrix-2">__init__</a></b> (<i>self</i>, float, float, float, float, float, float)</li><li><div class="fn" /><b><a href="qmatrix.html#QMatrix-3">__init__</a></b> (<i>self</i>, QMatrix)</li><li><div class="fn" />float <b><a href="qmatrix.html#det">det</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qmatrix.html#determinant">determinant</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qmatrix.html#dx">dx</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qmatrix.html#dy">dy</a></b> (<i>self</i>)</li><li><div class="fn" />(QMatrix, bool&#160;<i>invertible</i>) <b><a href="qmatrix.html#inverted">inverted</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmatrix.html#isIdentity">isIdentity</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qmatrix.html#isInvertible">isInvertible</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qmatrix.html#m11">m11</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qmatrix.html#m12">m12</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qmatrix.html#m21">m21</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qmatrix.html#m22">m22</a></b> (<i>self</i>)</li><li><div class="fn" />(int, int) <b><a href="qmatrix.html#map">map</a></b> (<i>self</i>, int, int)</li><li><div class="fn" />(float, float) <b><a href="qmatrix.html#map-2">map</a></b> (<i>self</i>, float, float)</li><li><div class="fn" />QPoint <b><a href="qmatrix.html#map-3">map</a></b> (<i>self</i>, QPoint)</li><li><div class="fn" />QPointF <b><a href="qmatrix.html#map-4">map</a></b> (<i>self</i>, QPointF)</li><li><div class="fn" />QLine <b><a href="qmatrix.html#map-5">map</a></b> (<i>self</i>, QLine)</li><li><div class="fn" />QLineF <b><a href="qmatrix.html#map-6">map</a></b> (<i>self</i>, QLineF)</li><li><div class="fn" />QPolygonF <b><a href="qmatrix.html#map-7">map</a></b> (<i>self</i>, QPolygonF)</li><li><div class="fn" />QPolygon <b><a href="qmatrix.html#map-8">map</a></b> (<i>self</i>, QPolygon)</li><li><div class="fn" />QRegion <b><a href="qmatrix.html#map-9">map</a></b> (<i>self</i>, QRegion)</li><li><div class="fn" />QPainterPath <b><a href="qmatrix.html#map-10">map</a></b> (<i>self</i>, QPainterPath)</li><li><div class="fn" />QRect <b><a href="qmatrix.html#mapRect">mapRect</a></b> (<i>self</i>, QRect)</li><li><div class="fn" />QRectF <b><a href="qmatrix.html#mapRect-2">mapRect</a></b> (<i>self</i>, QRectF)</li><li><div class="fn" />QPolygon <b><a href="qmatrix.html#mapToPolygon">mapToPolygon</a></b> (<i>self</i>, QRect)</li><li><div class="fn" /><b><a href="qmatrix.html#reset">reset</a></b> (<i>self</i>)</li><li><div class="fn" />QMatrix <b><a href="qmatrix.html#rotate">rotate</a></b> (<i>self</i>, float)</li><li><div class="fn" />QMatrix <b><a href="qmatrix.html#scale">scale</a></b> (<i>self</i>, float, float)</li><li><div class="fn" /><b><a href="qmatrix.html#setMatrix">setMatrix</a></b> (<i>self</i>, float, float, float, float, float, float)</li><li><div class="fn" />QMatrix <b><a href="qmatrix.html#shear">shear</a></b> (<i>self</i>, float, float)</li><li><div class="fn" />QMatrix <b><a href="qmatrix.html#translate">translate</a></b> (<i>self</i>, float, float)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />bool <b><a href="qmatrix.html#__eq__">__eq__</a></b> (<i>self</i>, QMatrix)</li><li><div class="fn" />QMatrix <b><a href="qmatrix.html#__imul__">__imul__</a></b> (<i>self</i>, QMatrix)</li><li><div class="fn" />QMatrix <b><a href="qmatrix.html#__mul__">__mul__</a></b> (<i>self</i>, QMatrix)</li><li><div class="fn" />bool <b><a href="qmatrix.html#__ne__">__ne__</a></b> (<i>self</i>, QMatrix)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>This class can be pickled.</p><p>The QMatrix class specifies 2D transformations of a coordinate system.</p>
<p>A matrix specifies how to translate, scale, shear or rotate the coordinate system, and is typically used when rendering graphics. QMatrix, in contrast to <a href="qtransform.html">QTransform</a>, does not allow perspective transformations. <a href="qtransform.html">QTransform</a> is the recommended transformation class in Qt.</p>
<p>A QMatrix object can be built using the <a href="qmatrix.html#setMatrix">setMatrix</a>(), <a href="qmatrix.html#scale">scale</a>(), <a href="qmatrix.html#rotate">rotate</a>(), <a href="qmatrix.html#translate">translate</a>() and <a href="qmatrix.html#shear">shear</a>() functions. Alternatively, it can be built by applying <a href="#basic-matrix-operations">basic matrix operations</a>. The matrix can also be defined when constructed, and it can be reset to the identity matrix (the default) using the <a href="qmatrix.html#reset">reset</a>() function.</p>
<p>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 <i>this</i> matrix using the <a href="qmatrix.html#map">map</a>() function. In case of a rectangle, its coordinates can be transformed using the <a href="qmatrix.html#mapRect">mapRect</a>() function. A rectangle can also be transformed into a <i>polygon</i> (mapped to the coordinate system defined by <i>this</i> matrix), using the <a href="qmatrix.html#mapToPolygon">mapToPolygon</a>() function.</p>
<p>QMatrix provides the <a href="qmatrix.html#isIdentity">isIdentity</a>() function which returns true if the matrix is the identity matrix, and the <a href="qmatrix.html#isInvertible">isInvertible</a>() function which returns true if the matrix is non-singular (i.e. AB = BA = I). The <a href="qmatrix.html#inverted">inverted</a>() function returns an inverted copy of <i>this</i> matrix if it is invertible (otherwise it returns the identity matrix). In addition, QMatrix provides the <a href="qmatrix.html#determinant">determinant</a>() function returning the matrix's determinant.</p>
<p>Finally, the QMatrix class supports matrix multiplication, and objects of the class can be streamed as well as compared.</p>
<ul><li><a href="#rendering-graphics">Rendering Graphics</a></li>
<li><a href="#basic-matrix-operations">Basic Matrix Operations</a></li>
</ul>
<a name="rendering-graphics" />
<h3>Rendering Graphics</h3>
<p>When rendering graphics, the matrix defines the transformations but the actual transformation is performed by the drawing routines in <a href="qpainter.html">QPainter</a>.</p>
<p>By default, <a href="qpainter.html">QPainter</a> operates on the associated device's own coordinate system. The standard coordinate system of a <a href="qpaintdevice.html">QPaintDevice</a> has its origin located at the top-left position. The <i>x</i> values increase to the right; <i>y</i> values increase downward. For a complete description, see the <a href="coordsys.html">coordinate system</a> documentation.</p>
<p><a href="qpainter.html">QPainter</a> has functions to translate, scale, shear and rotate the coordinate system without using a QMatrix. For example:</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic" width="100%">
<tr class="odd" valign="top"><td><img src="images/qmatrix-simpletransformation.png" /></td><td><pre> void SimpleTransformation.paintEvent(QPaintEvent *)
 {
     QPainter painter(this);
     painter.setPen(QPen(Qt.blue, 1, Qt.DashLine));
     painter.drawRect(0, 0, 100, 100);

     painter.rotate(45);

     painter.setFont(QFont("Helvetica", 24));
     painter.setPen(QPen(Qt.black, 1));
     painter.drawText(20, 10, "QMatrix");
 }</pre>
</td></tr>
</table></p>
<p>Although these functions are very convenient, it can be more efficient to build a QMatrix and call <a href="qpainter-obsolete.html#setMatrix">QPainter.setMatrix</a>() if you want to perform more than a single transform operation. For example:</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic" width="100%">
<tr class="odd" valign="top"><td><img src="images/qmatrix-combinedtransformation.png" /></td><td><pre> void CombinedTransformation.paintEvent(QPaintEvent *)
 {
     QPainter painter(this);
     painter.setPen(QPen(Qt.blue, 1, Qt.DashLine));
     painter.drawRect(0, 0, 100, 100);

     QMatrix matrix;
     matrix.translate(50, 50);
     matrix.rotate(45);
     matrix.scale(0.5, 1.0);
     painter.setMatrix(matrix);

     painter.setFont(QFont("Helvetica", 24));
     painter.setPen(QPen(Qt.black, 1));
     painter.drawText(20, 10, "QMatrix");
 }</pre>
</td></tr>
</table></p>
<a name="basic-matrix-operations" />
<h3>Basic Matrix Operations</h3>
<p align="center"><img src="images/qmatrix-representation.png" /></p><p>A QMatrix object contains a 3 x 3 matrix. The <tt>dx</tt> and <tt>dy</tt> elements specify horizontal and vertical translation. The <tt>m11</tt> and <tt>m22</tt> elements specify horizontal and vertical scaling. And finally, the <tt>m21</tt> and <tt>m12</tt> elements specify horizontal and vertical <i>shearing</i>.</p>
<p>QMatrix transforms a point in the plane to another point using the following formulas:</p>
<pre> x' = m11*x + m21*y + dx
 y' = m22*y + m12*x + dy</pre>
<p>The point <i>(x, y)</i> is the original point, and <i>(x', y')</i> is the transformed point. <i>(x', y')</i> can be transformed back to <i>(x, y)</i> by performing the same operation on the <a href="qmatrix.html#inverted">inverted</a>() matrix.</p>
<p>The various matrix elements can be set when constructing the matrix, or by using the <a href="qmatrix.html#setMatrix">setMatrix</a>() function later on. They can also be manipulated using the <a href="qmatrix.html#translate">translate</a>(), <a href="qmatrix.html#rotate">rotate</a>(), <a href="qmatrix.html#scale">scale</a>() and <a href="qmatrix.html#shear">shear</a>() convenience functions, The currently set values can be retrieved using the <a href="qmatrix.html#m11">m11</a>(), <a href="qmatrix.html#m12">m12</a>(), <a href="qmatrix.html#m21">m21</a>(), <a href="qmatrix.html#m22">m22</a>(), <a href="qmatrix.html#dx">dx</a>() and <a href="qmatrix.html#dy">dy</a>() functions.</p>
<p>Translation is the simplest transformation. Setting <tt>dx</tt> and <tt>dy</tt> will move the coordinate system <tt>dx</tt> units along the X axis and <tt>dy</tt> units along the Y axis. Scaling can be done by setting <tt>m11</tt> and <tt>m22</tt>. For example, setting <tt>m11</tt> to 2 and <tt>m22</tt> to 1.5 will double the height and increase the width by 50%. The identity matrix has <tt>m11</tt> and <tt>m22</tt> set to 1 (all others are set to 0) mapping a point to itself. Shearing is controlled by <tt>m12</tt> and <tt>m21</tt>. Setting these elements to values different from zero will twist the coordinate system. Rotation is achieved by carefully setting both the shearing factors and the scaling factors.</p>
<p>Here's the combined transformations example using basic matrix operations:</p>
<p><table align="center" border="0" cellpadding="2" cellspacing="1" class="generic" width="100%">
<tr class="odd" valign="top"><td><img src="images/qmatrix-combinedtransformation.png" /></td><td><pre> void BasicOperations.paintEvent(QPaintEvent *)
 {
     double pi = 3.14;

     double a    = pi/180 * 45.0;
     double sina = sin(a);
     double cosa = cos(a);

     QMatrix translationMatrix(1, 0, 0, 1, 50.0, 50.0);
     QMatrix rotationMatrix(cosa, sina, -sina, cosa, 0, 0);
     QMatrix scalingMatrix(0.5, 0, 0, 1.0, 0, 0);

     QMatrix matrix;
     matrix =  scalingMatrix * rotationMatrix * translationMatrix;

     QPainter painter(this);
     painter.setPen(QPen(Qt.blue, 1, Qt.DashLine));
     painter.drawRect(0, 0, 100, 100);

     painter.setMatrix(matrix);

     painter.setFont(QFont("Helvetica", 24));
     painter.setPen(QPen(Qt.black, 1));
     painter.drawText(20, 10, "QMatrix");
 }</pre>
</td></tr>
</table></p>
<p>See also <a href="qpainter.html">QPainter</a>, <a href="qtransform.html">QTransform</a>, <a href="coordsys.html">The Coordinate System</a>, <a href="demos-affine.html">Affine Transformations Demo</a>, and <a href="painting-transformations.html">Transformations Example</a>.</p>
<hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QMatrix" />QMatrix.__init__ (<i>self</i>)</h3><p>Constructs an identity matrix.</p>
<p>All elements are set to zero except <tt>m11</tt> and <tt>m22</tt> (specifying the scale), which are set to 1.</p>
<p>See also <a href="qmatrix.html#reset">reset</a>().</p>
<h3 class="fn"><a name="QMatrix-2" />QMatrix.__init__ (<i>self</i>, float, float, float, float, float, float)</h3><h3 class="fn"><a name="QMatrix-3" />QMatrix.__init__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>)</h3><p>Constructs a matrix with the elements, <i>m11</i>, <i>m12</i>, <i>m21</i>, <i>m22</i>, <i>dx</i> and <i>dy</i>.</p>
<p>See also <a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<h3 class="fn"><a name="det" />float QMatrix.det (<i>self</i>)</h3><h3 class="fn"><a name="determinant" />float QMatrix.determinant (<i>self</i>)</h3><p>Returns the matrix's determinant.</p>
<p>This function was introduced in Qt 4.6.</p>
<a name="//apple_ref/cpp/instm/QMatrix/dx" />
<h3 class="fn"><a name="dx" />float QMatrix.dx (<i>self</i>)</h3><p>Returns the horizontal translation factor.</p>
<p>See also <a href="qmatrix.html#translate">translate</a>() and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<a name="//apple_ref/cpp/instm/QMatrix/dy" />
<h3 class="fn"><a name="dy" />float QMatrix.dy (<i>self</i>)</h3><p>Returns the vertical translation factor.</p>
<p>See also <a href="qmatrix.html#translate">translate</a>() and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<a name="//apple_ref/cpp/instm/QMatrix/inverted" />
<h3 class="fn"><a name="inverted" />(<a href="qmatrix.html">QMatrix</a>, bool&#160;<i>invertible</i>) QMatrix.inverted (<i>self</i>)</h3><p>Returns an inverted copy of this matrix.</p>
<p>If the matrix is singular (not invertible), the returned matrix is the identity matrix. If <i>invertible</i> is valid (i.e. not 0), its value is set to true if the matrix is invertible, otherwise it is set to false.</p>
<p>See also <a href="qmatrix.html#isInvertible">isInvertible</a>().</p>
<a name="//apple_ref/cpp/instm/QMatrix/isIdentity" />
<h3 class="fn"><a name="isIdentity" />bool QMatrix.isIdentity (<i>self</i>)</h3><p>Returns true if the matrix is the identity matrix, otherwise returns false.</p>
<p>See also <a href="qmatrix.html#reset">reset</a>().</p>
<a name="//apple_ref/cpp/instm/QMatrix/isInvertible" />
<h3 class="fn"><a name="isInvertible" />bool QMatrix.isInvertible (<i>self</i>)</h3><p>Returns true if the matrix is invertible, otherwise returns false.</p>
<p>See also <a href="qmatrix.html#inverted">inverted</a>().</p>
<a name="//apple_ref/cpp/instm/QMatrix/map" />
<h3 class="fn"><a name="m11" />float QMatrix.m11 (<i>self</i>)</h3><p>Returns the horizontal scaling factor.</p>
<p>See also <a href="qmatrix.html#scale">scale</a>() and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<a name="//apple_ref/cpp/instm/QMatrix/m12" />
<h3 class="fn"><a name="m12" />float QMatrix.m12 (<i>self</i>)</h3><p>Returns the vertical shearing factor.</p>
<p>See also <a href="qmatrix.html#shear">shear</a>() and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<a name="//apple_ref/cpp/instm/QMatrix/m21" />
<h3 class="fn"><a name="m21" />float QMatrix.m21 (<i>self</i>)</h3><p>Returns the horizontal shearing factor.</p>
<p>See also <a href="qmatrix.html#shear">shear</a>() and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<a name="//apple_ref/cpp/instm/QMatrix/m22" />
<h3 class="fn"><a name="m22" />float QMatrix.m22 (<i>self</i>)</h3><p>Returns the vertical scaling factor.</p>
<p>See also <a href="qmatrix.html#scale">scale</a>() and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<a name="//apple_ref/cpp/instm/QMatrix/determinant" />
<h3 class="fn"><a name="map" />(int, int) QMatrix.map (<i>self</i>, int, int)</h3><p>Maps the given coordinates <i>x</i> and <i>y</i> into the coordinate system defined by this matrix. The resulting values are put in *<i>tx</i> and *<i>ty</i>, respectively.</p>
<p>The coordinates are transformed using the following formulas:</p>
<pre> x' = m11*x + m21*y + dx
 y' = m22*y + m12*x + dy</pre>
<p>The point (x, y) is the original point, and (x', y') is the transformed point.</p>
<p>See also <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<h3 class="fn"><a name="map-2" />(float, float) QMatrix.map (<i>self</i>, float, float)</h3><h3 class="fn"><a name="map-3" /><a href="qpoint.html">QPoint</a> QMatrix.map (<i>self</i>, <a href="qpoint.html">QPoint</a>)</h3><p>This is an overloaded function.</p>
<p>Maps the given coordinates <i>x</i> and <i>y</i> into the coordinate system defined by this matrix. The resulting values are put in *<i>tx</i> and *<i>ty</i>, respectively. Note that the transformed coordinates are rounded to the nearest integer.</p>
<h3 class="fn"><a name="map-4" /><a href="qpointf.html">QPointF</a> QMatrix.map (<i>self</i>, <a href="qpointf.html">QPointF</a>)</h3><p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpointf.html">QPointF</a> object that is a copy of the given <i>point</i>, mapped into the coordinate system defined by this matrix.</p>
<h3 class="fn"><a name="map-5" /><a href="qline.html">QLine</a> QMatrix.map (<i>self</i>, <a href="qline.html">QLine</a>)</h3><p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpoint.html">QPoint</a> object that is a copy of the given <i>point</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<h3 class="fn"><a name="map-6" /><a href="qlinef.html">QLineF</a> QMatrix.map (<i>self</i>, <a href="qlinef.html">QLineF</a>)</h3><p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qlinef.html">QLineF</a> object that is a copy of the given <i>line</i>, mapped into the coordinate system defined by this matrix.</p>
<h3 class="fn"><a name="map-7" /><a href="qpolygonf.html">QPolygonF</a> QMatrix.map (<i>self</i>, <a href="qpolygonf.html">QPolygonF</a>)</h3><p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qline.html">QLine</a> object that is a copy of the given <i>line</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<h3 class="fn"><a name="map-8" /><a href="qpolygon.html">QPolygon</a> QMatrix.map (<i>self</i>, <a href="qpolygon.html">QPolygon</a>)</h3><p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpolygonf.html">QPolygonF</a> object that is a copy of the given <i>polygon</i>, mapped into the coordinate system defined by this matrix.</p>
<h3 class="fn"><a name="map-9" /><a href="qregion.html">QRegion</a> QMatrix.map (<i>self</i>, <a href="qregion.html">QRegion</a>)</h3><p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qpolygon.html">QPolygon</a> object that is a copy of the given <i>polygon</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<h3 class="fn"><a name="map-10" /><a href="qpainterpath.html">QPainterPath</a> QMatrix.map (<i>self</i>, <a href="qpainterpath.html">QPainterPath</a>)</h3><p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qregion.html">QRegion</a> object that is a copy of the given <i>region</i>, mapped into the coordinate system defined by this matrix.</p>
<p>Calling this method can be rather expensive if rotations or shearing are used.</p>
<h3 class="fn"><a name="mapRect" /><a href="qrect.html">QRect</a> QMatrix.mapRect (<i>self</i>, <a href="qrect.html">QRect</a>)</h3><p>Creates and returns a <a href="qrectf.html">QRectF</a> object that is a copy of the given <i>rectangle</i>, mapped into the coordinate system defined by this matrix.</p>
<p>The rectangle's coordinates are transformed using the following formulas:</p>
<pre> x' = m11*x + m21*y + dx
 y' = m22*y + m12*x + dy</pre>
<p>If rotation or shearing has been specified, this function returns the <i>bounding</i> rectangle. To retrieve the exact region the given <i>rectangle</i> maps to, use the <a href="qmatrix.html#mapToPolygon">mapToPolygon</a>() function instead.</p>
<p>See also <a href="qmatrix.html#mapToPolygon">mapToPolygon</a>() and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<h3 class="fn"><a name="mapRect-2" /><a href="qrectf.html">QRectF</a> QMatrix.mapRect (<i>self</i>, <a href="qrectf.html">QRectF</a>)</h3><p>This is an overloaded function.</p>
<p>Creates and returns a <a href="qrect.html">QRect</a> object that is a copy of the given <i>rectangle</i>, mapped into the coordinate system defined by this matrix. Note that the transformed coordinates are rounded to the nearest integer.</p>
<a name="//apple_ref/cpp/instm/QMatrix/mapToPolygon" />
<h3 class="fn"><a name="mapToPolygon" /><a href="qpolygon.html">QPolygon</a> QMatrix.mapToPolygon (<i>self</i>, <a href="qrect.html">QRect</a>)</h3><p>Creates and returns a <a href="qpolygon.html">QPolygon</a> representation of the given <i>rectangle</i>, mapped into the coordinate system defined by this matrix.</p>
<p>The rectangle's coordinates are transformed using the following formulas:</p>
<pre> x' = m11*x + m21*y + dx
 y' = m22*y + m12*x + dy</pre>
<p>Polygons and rectangles behave slightly differently when transformed (due to integer rounding), so <tt>matrix.map(QPolygon(rectangle))</tt> is not always the same as <tt>matrix.mapToPolygon(rectangle)</tt>.</p>
<p>See also <a href="qmatrix.html#mapRect">mapRect</a>() and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<a name="//apple_ref/cpp/instm/QMatrix/reset" />
<h3 class="fn"><a name="reset" />QMatrix.reset (<i>self</i>)</h3><p>Resets the matrix to an identity matrix, i.e. all elements are set to zero, except <tt>m11</tt> and <tt>m22</tt> (specifying the scale) which are set to 1.</p>
<p>See also <a href="qmatrix.html#QMatrix">QMatrix</a>(), <a href="qmatrix.html#isIdentity">isIdentity</a>(), and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<a name="//apple_ref/cpp/instm/QMatrix/rotate" />
<h3 class="fn"><a name="rotate" /><a href="qmatrix.html">QMatrix</a> QMatrix.rotate (<i>self</i>, float)</h3><p>Rotates the coordinate system the given <i>degrees</i> counterclockwise.</p>
<p>Note that if you apply a <a class="obsolete" href="qmatrix.html">QMatrix</a> to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.</p>
<p>Returns a reference to the matrix.</p>
<p>See also <a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<a name="//apple_ref/cpp/instm/QMatrix/scale" />
<h3 class="fn"><a name="scale" /><a href="qmatrix.html">QMatrix</a> QMatrix.scale (<i>self</i>, float, float)</h3><p>Scales the coordinate system by <i>sx</i> horizontally and <i>sy</i> vertically, and returns a reference to the matrix.</p>
<p>See also <a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<a name="//apple_ref/cpp/instm/QMatrix/setMatrix" />
<h3 class="fn"><a name="setMatrix" />QMatrix.setMatrix (<i>self</i>, float, float, float, float, float, float)</h3><p>Sets the matrix elements to the specified values, <i>m11</i>, <i>m12</i>, <i>m21</i>, <i>m22</i>, <i>dx</i> and <i>dy</i>.</p>
<p>Note that this function replaces the previous values. <a class="obsolete" href="qmatrix.html">QMatrix</a> provide the <a href="qmatrix.html#translate">translate</a>(), <a href="qmatrix.html#rotate">rotate</a>(), <a href="qmatrix.html#scale">scale</a>() and <a href="qmatrix.html#shear">shear</a>() convenience functions to manipulate the various matrix elements based on the currently defined coordinate system.</p>
<p>See also <a href="qmatrix.html#QMatrix">QMatrix</a>().</p>
<a name="//apple_ref/cpp/instm/QMatrix/shear" />
<h3 class="fn"><a name="shear" /><a href="qmatrix.html">QMatrix</a> QMatrix.shear (<i>self</i>, float, float)</h3><p>Shears the coordinate system by <i>sh</i> horizontally and <i>sv</i> vertically, and returns a reference to the matrix.</p>
<p>See also <a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<a name="//apple_ref/cpp/instm/QMatrix/translate" />
<h3 class="fn"><a name="translate" /><a href="qmatrix.html">QMatrix</a> QMatrix.translate (<i>self</i>, float, float)</h3><p>Moves the coordinate system <i>dx</i> along the x axis and <i>dy</i> along the y axis, and returns a reference to the matrix.</p>
<p>See also <a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<a name="//apple_ref/cpp/instm/QMatrix/operator QVariant" />
<h3 class="fn"><a name="__eq__" />bool QMatrix.__eq__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>)</h3><h3 class="fn"><a name="__imul__" /><a href="qmatrix.html">QMatrix</a> QMatrix.__imul__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>)</h3><h3 class="fn"><a name="__mul__" /><a href="qmatrix.html">QMatrix</a> QMatrix.__mul__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>)</h3><h3 class="fn"><a name="__ne__" />bool QMatrix.__ne__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.7.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2010</td><td align="right" width="25%">Qt&#160;4.6.2</td></tr></table></div></address></body></html>