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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389
|
<?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">  </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <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 <i>m11</i>, float <i>m12</i>, float <i>m21</i>, float <i>m22</i>, float <i>dx</i>, float <i>dy</i>)</li><li><div class="fn" /><b><a href="qmatrix.html#QMatrix-3">__init__</a></b> (<i>self</i>, QMatrix <i>matrix</i>)</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 <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 <i>tx</i>, int <i>ty</i>) <b><a href="qmatrix.html#map">map</a></b> (<i>self</i>, int <i>x</i>, int <i>y</i>)</li><li><div class="fn" />(float <i>tx</i>, float <i>ty</i>) <b><a href="qmatrix.html#map-2">map</a></b> (<i>self</i>, float <i>x</i>, float <i>y</i>)</li><li><div class="fn" />QPoint <b><a href="qmatrix.html#map-3">map</a></b> (<i>self</i>, QPoint <i>p</i>)</li><li><div class="fn" />QPointF <b><a href="qmatrix.html#map-4">map</a></b> (<i>self</i>, QPointF <i>p</i>)</li><li><div class="fn" />QLine <b><a href="qmatrix.html#map-5">map</a></b> (<i>self</i>, QLine <i>l</i>)</li><li><div class="fn" />QLineF <b><a href="qmatrix.html#map-6">map</a></b> (<i>self</i>, QLineF <i>l</i>)</li><li><div class="fn" />QPolygonF <b><a href="qmatrix.html#map-7">map</a></b> (<i>self</i>, QPolygonF <i>a</i>)</li><li><div class="fn" />QPolygon <b><a href="qmatrix.html#map-8">map</a></b> (<i>self</i>, QPolygon <i>a</i>)</li><li><div class="fn" />QRegion <b><a href="qmatrix.html#map-9">map</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QPainterPath <b><a href="qmatrix.html#map-10">map</a></b> (<i>self</i>, QPainterPath <i>p</i>)</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 <i>r</i>)</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 <i>a</i>)</li><li><div class="fn" />QMatrix <b><a href="qmatrix.html#scale">scale</a></b> (<i>self</i>, float <i>sx</i>, float <i>sy</i>)</li><li><div class="fn" /><b><a href="qmatrix.html#setMatrix">setMatrix</a></b> (<i>self</i>, float <i>m11</i>, float <i>m12</i>, float <i>m21</i>, float <i>m22</i>, float <i>dx</i>, float <i>dy</i>)</li><li><div class="fn" />QMatrix <b><a href="qmatrix.html#shear">shear</a></b> (<i>self</i>, float <i>sh</i>, float <i>sv</i>)</li><li><div class="fn" />QMatrix <b><a href="qmatrix.html#translate">translate</a></b> (<i>self</i>, float <i>dx</i>, float <i>dy</i>)</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 <i>o</i>)</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>
<a id="rendering-graphics" 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>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qmatrix-simpletransformation.png" /></td>
<td>
<pre class="cpp">
<span class="type">void</span> SimpleTransformation<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
{
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>blue<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>DashLine));
painter<span class="operator">.</span>drawRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">100</span>);
painter<span class="operator">.</span>rotate(<span class="number">45</span>);
painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">"Helvetica"</span><span class="operator">,</span> <span class="number">24</span>));
painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>black<span class="operator">,</span> <span class="number">1</span>));
painter<span class="operator">.</span>drawText(<span class="number">20</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">"QMatrix"</span>);
}
</pre></td>
</tr>
</table>
<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>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qmatrix-combinedtransformation.png" /></td>
<td>
<pre class="cpp">
<span class="type">void</span> CombinedTransformation<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
{
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>blue<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>DashLine));
painter<span class="operator">.</span>drawRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">100</span>);
<span class="type">QMatrix</span> matrix;
matrix<span class="operator">.</span>translate(<span class="number">50</span><span class="operator">,</span> <span class="number">50</span>);
matrix<span class="operator">.</span>rotate(<span class="number">45</span>);
matrix<span class="operator">.</span>scale(<span class="number">0.5</span><span class="operator">,</span> <span class="number">1.0</span>);
painter<span class="operator">.</span>setMatrix(matrix);
painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">"Helvetica"</span><span class="operator">,</span> <span class="number">24</span>));
painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>black<span class="operator">,</span> <span class="number">1</span>));
painter<span class="operator">.</span>drawText(<span class="number">20</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">"QMatrix"</span>);
}
</pre></td>
</tr>
</table>
<a id="basic-matrix-operations" name="basic-matrix-operations" />
<h3>Basic Matrix Operations</h3>
<p class="centerAlign"><img alt="" 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 class="cpp">
x<span class="char">' = m11*x + m21*y + dx
y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> 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>
<table class="generic" width="100%">
<tr class="odd" valign="top">
<td><img alt="" src="images/qmatrix-combinedtransformation.png" /></td>
<td>
<pre class="cpp">
<span class="type">void</span> BasicOperations<span class="operator">.</span>paintEvent(<span class="type"><a href="qpaintevent.html">QPaintEvent</a></span> <span class="operator">*</span>)
{
<span class="type">double</span> pi <span class="operator">=</span> <span class="number">3.14</span>;
<span class="type">double</span> a <span class="operator">=</span> pi<span class="operator">/</span><span class="number">180</span> <span class="operator">*</span> <span class="number">45.0</span>;
<span class="type">double</span> sina <span class="operator">=</span> sin(a);
<span class="type">double</span> cosa <span class="operator">=</span> cos(a);
<span class="type">QMatrix</span> translationMatrix(<span class="number">1</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="number">50.0</span><span class="operator">,</span> <span class="number">50.0</span>);
<span class="type">QMatrix</span> rotationMatrix(cosa<span class="operator">,</span> sina<span class="operator">,</span> <span class="operator">-</span>sina<span class="operator">,</span> cosa<span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
<span class="type">QMatrix</span> scalingMatrix(<span class="number">0.5</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">1.0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">0</span>);
<span class="type">QMatrix</span> matrix;
matrix <span class="operator">=</span> scalingMatrix <span class="operator">*</span> rotationMatrix <span class="operator">*</span> translationMatrix;
<span class="type"><a href="qpainter.html">QPainter</a></span> painter(<span class="keyword">this</span>);
painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>blue<span class="operator">,</span> <span class="number">1</span><span class="operator">,</span> <span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>DashLine));
painter<span class="operator">.</span>drawRect(<span class="number">0</span><span class="operator">,</span> <span class="number">0</span><span class="operator">,</span> <span class="number">100</span><span class="operator">,</span> <span class="number">100</span>);
painter<span class="operator">.</span>setMatrix(matrix);
painter<span class="operator">.</span>setFont(<span class="type"><a href="qfont.html">QFont</a></span>(<span class="string">"Helvetica"</span><span class="operator">,</span> <span class="number">24</span>));
painter<span class="operator">.</span>setPen(<span class="type"><a href="qpen.html">QPen</a></span>(<span class="type"><a href="qt.html">Qt</a></span><span class="operator">.</span>black<span class="operator">,</span> <span class="number">1</span>));
painter<span class="operator">.</span>drawText(<span class="number">20</span><span class="operator">,</span> <span class="number">10</span><span class="operator">,</span> <span class="string">"QMatrix"</span>);
}
</pre></td>
</tr>
</table>
<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><b>See also</b> <a href="qmatrix.html#reset">reset</a>().</p>
<h3 class="fn"><a name="QMatrix-2" />QMatrix.__init__ (<i>self</i>, float <i>m11</i>, float <i>m12</i>, float <i>m21</i>, float <i>m22</i>, float <i>dx</i>, float <i>dy</i>)</h3><h3 class="fn"><a name="QMatrix-3" />QMatrix.__init__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a> <i>matrix</i>)</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><b>See also</b> <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>
<h3 class="fn"><a name="dx" />float QMatrix.dx (<i>self</i>)</h3><p>Returns the horizontal translation factor.</p>
<p><b>See also</b> <a href="qmatrix.html#translate">translate</a>()
and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<h3 class="fn"><a name="dy" />float QMatrix.dy (<i>self</i>)</h3><p>Returns the vertical translation factor.</p>
<p><b>See also</b> <a href="qmatrix.html#translate">translate</a>()
and <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<h3 class="fn"><a name="inverted" />(<a href="qmatrix.html">QMatrix</a>, bool <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><b>See also</b> <a href="qmatrix.html#isInvertible">isInvertible</a>().</p>
<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><b>See also</b> <a href="qmatrix.html#reset">reset</a>().</p>
<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><b>See also</b> <a href="qmatrix.html#inverted">inverted</a>().</p>
<h3 class="fn"><a name="m11" />float QMatrix.m11 (<i>self</i>)</h3><p>Returns the horizontal scaling factor.</p>
<p><b>See also</b> <a href="qmatrix.html#scale">scale</a>() and
<a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<h3 class="fn"><a name="m12" />float QMatrix.m12 (<i>self</i>)</h3><p>Returns the vertical shearing factor.</p>
<p><b>See also</b> <a href="qmatrix.html#shear">shear</a>() and
<a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<h3 class="fn"><a name="m21" />float QMatrix.m21 (<i>self</i>)</h3><p>Returns the horizontal shearing factor.</p>
<p><b>See also</b> <a href="qmatrix.html#shear">shear</a>() and
<a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<h3 class="fn"><a name="m22" />float QMatrix.m22 (<i>self</i>)</h3><p>Returns the vertical scaling factor.</p>
<p><b>See also</b> <a href="qmatrix.html#scale">scale</a>() and
<a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<h3 class="fn"><a name="map" />(int <i>tx</i>, int <i>ty</i>) QMatrix.map (<i>self</i>, int <i>x</i>, int <i>y</i>)</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 class="cpp">
x<span class="char">' = m11*x + m21*y + dx
y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> dy
</pre>
<p>The point (x, y) is the original point, and (x', y') is the
transformed point.</p>
<p><b>See also</b> <a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<h3 class="fn"><a name="map-2" />(float <i>tx</i>, float <i>ty</i>) QMatrix.map (<i>self</i>, float <i>x</i>, float <i>y</i>)</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> <i>p</i>)</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> <i>p</i>)</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> <i>l</i>)</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> <i>l</i>)</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> <i>a</i>)</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> <i>a</i>)</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> <i>r</i>)</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> <i>p</i>)</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 class="cpp">
x<span class="char">' = m11*x + m21*y + dx
y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> 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><b>See also</b> <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>
<h3 class="fn"><a name="mapToPolygon" /><a href="qpolygon.html">QPolygon</a> QMatrix.mapToPolygon (<i>self</i>, <a href="qrect.html">QRect</a> <i>r</i>)</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 class="cpp">
x<span class="char">' = m11*x + m21*y + dx
y'</span> <span class="operator">=</span> m22<span class="operator">*</span>y <span class="operator">+</span> m12<span class="operator">*</span>x <span class="operator">+</span> 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><b>See also</b> <a href="qmatrix.html#mapRect">mapRect</a>() and
<a class="obsolete" href="qmatrix.html#basic-matrix-operations">Basic Matrix Operations</a>.</p>
<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><b>See also</b> <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>
<h3 class="fn"><a name="rotate" /><a href="qmatrix.html">QMatrix</a> QMatrix.rotate (<i>self</i>, float <i>a</i>)</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><b>See also</b> <a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<h3 class="fn"><a name="scale" /><a href="qmatrix.html">QMatrix</a> QMatrix.scale (<i>self</i>, float <i>sx</i>, float <i>sy</i>)</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><b>See also</b> <a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<h3 class="fn"><a name="setMatrix" />QMatrix.setMatrix (<i>self</i>, float <i>m11</i>, float <i>m12</i>, float <i>m21</i>, float <i>m22</i>, float <i>dx</i>, float <i>dy</i>)</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><b>See also</b> <a href="qmatrix.html#QMatrix">QMatrix</a>().</p>
<h3 class="fn"><a name="shear" /><a href="qmatrix.html">QMatrix</a> QMatrix.shear (<i>self</i>, float <i>sh</i>, float <i>sv</i>)</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><b>See also</b> <a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<h3 class="fn"><a name="translate" /><a href="qmatrix.html">QMatrix</a> QMatrix.translate (<i>self</i>, float <i>dx</i>, float <i>dy</i>)</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><b>See also</b> <a href="qmatrix.html#setMatrix">setMatrix</a>().</p>
<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> <i>o</i>)</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 4.12.1 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qt.io">The Qt Company</a> 2015</td><td align="right" width="25%">Qt 4.8.7</td></tr></table></div></address></body></html>
|