<?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>QTransform 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">QTransform Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1><p>The QTransform class specifies 2D transformations of a coordinate system. <a href="#details">More...</a></p> <h3>Types</h3><ul><li><div class="fn" />enum <b><a href="qtransform.html#TransformationType-enum">TransformationType</a></b> { TxNone, TxTranslate, TxScale, TxRotate, TxShear, TxProject }</li></ul><h3>Methods</h3><ul><li><div class="fn" /><b><a href="qtransform.html#QTransform">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qtransform.html#QTransform-2">__init__</a></b> (<i>self</i>, float <i>m11</i>, float <i>m12</i>, float <i>m13</i>, float <i>m21</i>, float <i>m22</i>, float <i>m23</i>, float <i>m31</i>, float <i>m32</i>, float <i>m33</i> = 1)</li><li><div class="fn" /><b><a href="qtransform.html#QTransform-3">__init__</a></b> (<i>self</i>, float <i>h11</i>, float <i>h12</i>, float <i>h13</i>, float <i>h21</i>, float <i>h22</i>, float <i>h23</i>)</li><li><div class="fn" /><b><a href="qtransform.html#QTransform-4">__init__</a></b> (<i>self</i>, QMatrix <i>mtx</i>)</li><li><div class="fn" /><b><a href="qtransform.html#QTransform-5">__init__</a></b> (<i>self</i>, QTransform)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#adjoint">adjoint</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#det">det</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#determinant">determinant</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#dx">dx</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#dy">dy</a></b> (<i>self</i>)</li><li><div class="fn" />(QTransform, bool <i>invertible</i>) <b><a href="qtransform.html#inverted">inverted</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#isAffine">isAffine</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#isIdentity">isIdentity</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#isInvertible">isInvertible</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#isRotating">isRotating</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#isScaling">isScaling</a></b> (<i>self</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#isTranslating">isTranslating</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#m11">m11</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#m12">m12</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#m13">m13</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#m21">m21</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#m22">m22</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#m23">m23</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#m31">m31</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#m32">m32</a></b> (<i>self</i>)</li><li><div class="fn" />float <b><a href="qtransform.html#m33">m33</a></b> (<i>self</i>)</li><li><div class="fn" />(int <i>tx</i>, int <i>ty</i>) <b><a href="qtransform.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="qtransform.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="qtransform.html#map-3">map</a></b> (<i>self</i>, QPoint <i>p</i>)</li><li><div class="fn" />QPointF <b><a href="qtransform.html#map-4">map</a></b> (<i>self</i>, QPointF <i>p</i>)</li><li><div class="fn" />QLine <b><a href="qtransform.html#map-5">map</a></b> (<i>self</i>, QLine <i>l</i>)</li><li><div class="fn" />QLineF <b><a href="qtransform.html#map-6">map</a></b> (<i>self</i>, QLineF <i>l</i>)</li><li><div class="fn" />QPolygonF <b><a href="qtransform.html#map-7">map</a></b> (<i>self</i>, QPolygonF <i>a</i>)</li><li><div class="fn" />QPolygon <b><a href="qtransform.html#map-8">map</a></b> (<i>self</i>, QPolygon <i>a</i>)</li><li><div class="fn" />QRegion <b><a href="qtransform.html#map-9">map</a></b> (<i>self</i>, QRegion <i>r</i>)</li><li><div class="fn" />QPainterPath <b><a href="qtransform.html#map-10">map</a></b> (<i>self</i>, QPainterPath <i>p</i>)</li><li><div class="fn" />QRect <b><a href="qtransform.html#mapRect">mapRect</a></b> (<i>self</i>, QRect)</li><li><div class="fn" />QRectF <b><a href="qtransform.html#mapRect-2">mapRect</a></b> (<i>self</i>, QRectF)</li><li><div class="fn" />QPolygon <b><a href="qtransform.html#mapToPolygon">mapToPolygon</a></b> (<i>self</i>, QRect <i>r</i>)</li><li><div class="fn" /><b><a href="qtransform.html#reset">reset</a></b> (<i>self</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#rotate">rotate</a></b> (<i>self</i>, float <i>angle</i>, Qt.Axis <i>axis</i> = Qt.ZAxis)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#rotateRadians">rotateRadians</a></b> (<i>self</i>, float <i>angle</i>, Qt.Axis <i>axis</i> = Qt.ZAxis)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#scale">scale</a></b> (<i>self</i>, float <i>sx</i>, float <i>sy</i>)</li><li><div class="fn" /><b><a href="qtransform.html#setMatrix">setMatrix</a></b> (<i>self</i>, float <i>m11</i>, float <i>m12</i>, float <i>m13</i>, float <i>m21</i>, float <i>m22</i>, float <i>m23</i>, float <i>m31</i>, float <i>m32</i>, float <i>m33</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.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="qtransform.html#toAffine">toAffine</a></b> (<i>self</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#translate">translate</a></b> (<i>self</i>, float <i>dx</i>, float <i>dy</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#transposed">transposed</a></b> (<i>self</i>)</li><li><div class="fn" />TransformationType <b><a href="qtransform.html#type">type</a></b> (<i>self</i>)</li></ul><h3>Static Methods</h3><ul><li><div class="fn" />QTransform <b><a href="qtransform.html#fromScale">fromScale</a></b> (float <i>dx</i>, float <i>dy</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#fromTranslate">fromTranslate</a></b> (float <i>dx</i>, float <i>dy</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#quadToQuad">quadToQuad</a></b> (QPolygonF <i>one</i>, QPolygonF <i>two</i>, QTransform <i>result</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#quadToSquare">quadToSquare</a></b> (QPolygonF <i>quad</i>, QTransform <i>result</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#squareToQuad">squareToQuad</a></b> (QPolygonF <i>square</i>, QTransform <i>result</i>)</li></ul><h3>Special Methods</h3><ul><li><div class="fn" />QTransform <b><a href="qtransform.html#__add__">__add__</a></b> (<i>self</i>, float <i>n</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#__div__">__div__</a></b> (<i>self</i>, float <i>n</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#__eq__">__eq__</a></b> (<i>self</i>, QTransform)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#__iadd__">__iadd__</a></b> (<i>self</i>, float <i>num</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#__idiv__">__idiv__</a></b> (<i>self</i>, float <i>div</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#__imul__">__imul__</a></b> (<i>self</i>, QTransform)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#__imul__-2">__imul__</a></b> (<i>self</i>, float <i>num</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#__isub__">__isub__</a></b> (<i>self</i>, float <i>num</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#__mul__">__mul__</a></b> (<i>self</i>, QTransform <i>o</i>)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#__mul__-2">__mul__</a></b> (<i>self</i>, float <i>n</i>)</li><li><div class="fn" />bool <b><a href="qtransform.html#__ne__">__ne__</a></b> (<i>self</i>, QTransform)</li><li><div class="fn" />QTransform <b><a href="qtransform.html#__sub__">__sub__</a></b> (<i>self</i>, float <i>n</i>)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>This class can be pickled.</p><p>The QTransform class specifies 2D transformations of a coordinate system.</p> <p>A transformation specifies how to translate, scale, shear, rotate or project the coordinate system, and is typically used when rendering graphics.</p> <p>QTransform differs from <a class="obsolete" href="qmatrix.html">QMatrix<sup>(obsolete)</sup></a> in that it is a true 3x3 matrix, allowing perspective transformations. QTransform's <a href="qtransform.html#toAffine">toAffine</a>() method allows casting QTransform to <a class="obsolete" href="qmatrix.html">QMatrix<sup>(obsolete)</sup></a>. If a perspective transformation has been specified on the matrix, then the conversion will cause loss of data.</p> <p>QTransform is the recommended transformation class in Qt.</p> <p>A QTransform object can be built using the <a href="qtransform.html#setMatrix">setMatrix</a>(), <a href="qtransform.html#scale">scale</a>(), <a href="qtransform.html#rotate">rotate</a>(), <a href="qtransform.html#translate">translate</a>() and <a href="qtransform.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="qtransform.html#reset">reset</a>() function.</p> <p>The QTransform 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="qtransform.html#map">map</a>() function. In case of a rectangle, its coordinates can be transformed using the <a href="qtransform.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="qtransform.html#mapToPolygon">mapToPolygon</a>() function.</p> <p>QTransform provides the <a href="qtransform.html#isIdentity">isIdentity</a>() function which returns true if the matrix is the identity matrix, and the <a href="qtransform.html#isInvertible">isInvertible</a>() function which returns true if the matrix is non-singular (i.e. AB = BA = I). The <a href="qtransform.html#inverted">inverted</a>() function returns an inverted copy of <i>this</i> matrix if it is invertible (otherwise it returns the identity matrix), and <a href="qtransform.html#adjoint">adjoint</a>() returns the matrix's classical adjoint. In addition, QTransform provides the <a href="qtransform.html#determinant">determinant</a>() function which returns the matrix's determinant.</p> <p>Finally, the QTransform class supports matrix multiplication, addition and subtraction, 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 QTransform. For example:</p> <table class="generic" width="100%"> <tr class="odd" valign="top"> <td><img alt="" src="images/qtransform-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">"QTransform"</span>); } </pre></td> </tr> </table> <p>Although these functions are very convenient, it can be more efficient to build a QTransform and call <a href="qpainter.html#setTransform">QPainter.setTransform</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/qtransform-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">QTransform</span> transform; transform<span class="operator">.</span>translate(<span class="number">50</span><span class="operator">,</span> <span class="number">50</span>); transform<span class="operator">.</span>rotate(<span class="number">45</span>); transform<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>setTransform(transform); 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">"QTransform"</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/qtransform-representation.png" /></p> <p>A QTransform object contains a 3 x 3 matrix. The <tt>m31</tt> (<tt>dx</tt>) and <tt>m32</tt> (<tt>dy</tt>) elements specify horizontal and vertical translation. The <tt>m11</tt> and <tt>m22</tt> elements specify horizontal and vertical scaling. The <tt>m21</tt> and <tt>m12</tt> elements specify horizontal and vertical <i>shearing</i>. And finally, the <tt>m13</tt> and <tt>m23</tt> elements specify horizontal and vertical projection, with <tt>m33</tt> as an additional projection factor.</p> <p>QTransform 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 <span class="keyword">if</span> (is <span class="keyword">not</span> affine) { w<span class="char">' = m13*x + m23*y + m33 x'</span> <span class="operator">/</span><span class="operator">=</span> w<span class="char">' y'</span> <span class="operator">/</span><span class="operator">=</span> w<span class="char">' }</span> </pre> <p><span class="char">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="qtransform.html#inverted">inverted</a>() matrix.</span></p> <p><span class="char">The various matrix elements can be set when constructing the matrix, or by using the <a href="qtransform.html#setMatrix">setMatrix</a>() function later on. They can also be manipulated using the <a href="qtransform.html#translate">translate</a>(), <a href="qtransform.html#rotate">rotate</a>(), <a href="qtransform.html#scale">scale</a>() and <a href="qtransform.html#shear">shear</a>() convenience functions. The currently set values can be retrieved using the <a href="qtransform.html#m11">m11</a>(), <a href="qtransform.html#m12">m12</a>(), <a href="qtransform.html#m13">m13</a>(), <a href="qtransform.html#m21">m21</a>(), <a href="qtransform.html#m22">m22</a>(), <a href="qtransform.html#m23">m23</a>(), <a href="qtransform.html#m31">m31</a>(), <a href="qtransform.html#m32">m32</a>(), <a href="qtransform.html#m33">m33</a>(), <a href="qtransform.html#dx">dx</a>() and <a href="qtransform.html#dy">dy</a>() functions.</span></p> <p><span class="char">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>, <tt>m22</tt>, and <tt>m33</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 setting both the shearing factors and the scaling factors. Perspective transformation is achieved by setting both the projection factors and the scaling factors.</span></p> <p><span class="char">Here's the combined transformations example using basic matrix operations:</span></p> <table class="generic" width="100%"> <tr class="odd" valign="top"> <td><img alt="" src="images/qtransform-combinedtransformation2.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">QTransform</span> translationTransform(<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">QTransform</span> rotationTransform(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">QTransform</span> scalingTransform(<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">QTransform</span> transform; transform <span class="operator">=</span> scalingTransform <span class="operator">*</span> rotationTransform <span class="operator">*</span> translationTransform; <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>setTransform(transform); 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">"QTransform"</span>); } </pre></td> </tr> </table> <hr /><h2>Type Documentation</h2><h3 class="fn"><a name="TransformationType-enum" />QTransform.TransformationType</h3><table class="valuelist"> <tr> <th class="tblConst">Constant</th> <th class="tblVal">Value</th> </tr> <tr> <td class="topAlign"><tt>QTransform.TxNone</tt></td> <td class="topAlign"><tt>0x00</tt></td> </tr> <tr> <td class="topAlign"><tt>QTransform.TxTranslate</tt></td> <td class="topAlign"><tt>0x01</tt></td> </tr> <tr> <td class="topAlign"><tt>QTransform.TxScale</tt></td> <td class="topAlign"><tt>0x02</tt></td> </tr> <tr> <td class="topAlign"><tt>QTransform.TxRotate</tt></td> <td class="topAlign"><tt>0x04</tt></td> </tr> <tr> <td class="topAlign"><tt>QTransform.TxShear</tt></td> <td class="topAlign"><tt>0x08</tt></td> </tr> <tr> <td class="topAlign"><tt>QTransform.TxProject</tt></td> <td class="topAlign"><tt>0x10</tt></td> </tr> </table> <hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QTransform" />QTransform.__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) and <tt>m13</tt> which are set to 1.</p> <p><b>See also</b> <a href="qtransform.html#reset">reset</a>().</p> <h3 class="fn"><a name="QTransform-2" />QTransform.__init__ (<i>self</i>, float <i>m11</i>, float <i>m12</i>, float <i>m13</i>, float <i>m21</i>, float <i>m22</i>, float <i>m23</i>, float <i>m31</i>, float <i>m32</i>, float <i>m33</i> = 1)</h3><h3 class="fn"><a name="QTransform-3" />QTransform.__init__ (<i>self</i>, float <i>h11</i>, float <i>h12</i>, float <i>h13</i>, float <i>h21</i>, float <i>h22</i>, float <i>h23</i>)</h3><p>Constructs a matrix with the elements, <i>m11</i>, <i>m12</i>, <i>m13</i>, <i>m21</i>, <i>m22</i>, <i>m23</i>, <i>m31</i>, <i>m32</i>, <i>m33</i>.</p> <p><b>See also</b> <a href="qtransform.html#setMatrix">setMatrix</a>().</p> <h3 class="fn"><a name="QTransform-4" />QTransform.__init__ (<i>self</i>, <a href="qmatrix.html">QMatrix</a> <i>mtx</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="qtransform.html#setMatrix">setMatrix</a>().</p> <h3 class="fn"><a name="QTransform-5" />QTransform.__init__ (<i>self</i>, <a href="qtransform.html">QTransform</a>)</h3><p>Constructs a matrix that is a copy of the given <i>matrix</i>. Note that the <tt>m13</tt>, <tt>m23</tt>, and <tt>m33</tt> elements are set to 0, 0, and 1 respectively.</p> <h3 class="fn"><a name="adjoint" /><a href="qtransform.html">QTransform</a> QTransform.adjoint (<i>self</i>)</h3><p>Returns the adjoint of this matrix.</p> <h3 class="fn"><a name="det" />float QTransform.det (<i>self</i>)</h3><h3 class="fn"><a name="determinant" />float QTransform.determinant (<i>self</i>)</h3><p>Returns the matrix's determinant.</p> <h3 class="fn"><a name="dx" />float QTransform.dx (<i>self</i>)</h3><p>Returns the horizontal translation factor.</p> <p><b>See also</b> <a href="qtransform.html#m31">m31</a>(), <a href="qtransform.html#translate">translate</a>(), and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="dy" />float QTransform.dy (<i>self</i>)</h3><p>Returns the vertical translation factor.</p> <p><b>See also</b> <a href="qtransform.html#translate">translate</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="fromScale" /><a href="qtransform.html">QTransform</a> QTransform.fromScale (float <i>dx</i>, float <i>dy</i>)</h3><p>Creates a matrix which corresponds to a scaling of <i>sx</i> horizontally and <i>sy</i> vertically. This is the same as <a href="qtransform.html#QTransform">QTransform</a>().scale(sx, sy) but slightly faster.</p> <p>This function was introduced in Qt 4.5.</p> <h3 class="fn"><a name="fromTranslate" /><a href="qtransform.html">QTransform</a> QTransform.fromTranslate (float <i>dx</i>, float <i>dy</i>)</h3><p>Creates a matrix which corresponds to a translation of <i>dx</i> along the x axis and <i>dy</i> along the y axis. This is the same as <a href="qtransform.html#QTransform">QTransform</a>().translate(dx, dy) but slightly faster.</p> <p>This function was introduced in Qt 4.5.</p> <h3 class="fn"><a name="inverted" />(<a href="qtransform.html">QTransform</a>, bool <i>invertible</i>) QTransform.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="qtransform.html#isInvertible">isInvertible</a>().</p> <h3 class="fn"><a name="isAffine" />bool QTransform.isAffine (<i>self</i>)</h3><p>Returns true if the matrix represent an affine transformation, otherwise returns false.</p> <h3 class="fn"><a name="isIdentity" />bool QTransform.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="qtransform.html#reset">reset</a>().</p> <h3 class="fn"><a name="isInvertible" />bool QTransform.isInvertible (<i>self</i>)</h3><p>Returns true if the matrix is invertible, otherwise returns false.</p> <p><b>See also</b> <a href="qtransform.html#inverted">inverted</a>().</p> <h3 class="fn"><a name="isRotating" />bool QTransform.isRotating (<i>self</i>)</h3><p>Returns true if the matrix represents some kind of a rotating transformation, otherwise returns false.</p> <p><b>See also</b> <a href="qtransform.html#reset">reset</a>().</p> <h3 class="fn"><a name="isScaling" />bool QTransform.isScaling (<i>self</i>)</h3><p>Returns true if the matrix represents a scaling transformation, otherwise returns false.</p> <p><b>See also</b> <a href="qtransform.html#reset">reset</a>().</p> <h3 class="fn"><a name="isTranslating" />bool QTransform.isTranslating (<i>self</i>)</h3><p>Returns true if the matrix represents a translating transformation, otherwise returns false.</p> <p><b>See also</b> <a href="qtransform.html#reset">reset</a>().</p> <h3 class="fn"><a name="m11" />float QTransform.m11 (<i>self</i>)</h3><p>Returns the horizontal scaling factor.</p> <p><b>See also</b> <a href="qtransform.html#scale">scale</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="m12" />float QTransform.m12 (<i>self</i>)</h3><p>Returns the vertical shearing factor.</p> <p><b>See also</b> <a href="qtransform.html#shear">shear</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="m13" />float QTransform.m13 (<i>self</i>)</h3><p>Returns the horizontal projection factor.</p> <p><b>See also</b> <a href="qtransform.html#translate">translate</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="m21" />float QTransform.m21 (<i>self</i>)</h3><p>Returns the horizontal shearing factor.</p> <p><b>See also</b> <a href="qtransform.html#shear">shear</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="m22" />float QTransform.m22 (<i>self</i>)</h3><p>Returns the vertical scaling factor.</p> <p><b>See also</b> <a href="qtransform.html#scale">scale</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="m23" />float QTransform.m23 (<i>self</i>)</h3><p>Returns the vertical projection factor.</p> <p><b>See also</b> <a href="qtransform.html#translate">translate</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="m31" />float QTransform.m31 (<i>self</i>)</h3><p>Returns the horizontal translation factor.</p> <p><b>See also</b> <a href="qtransform.html#dx">dx</a>(), <a href="qtransform.html#translate">translate</a>(), and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="m32" />float QTransform.m32 (<i>self</i>)</h3><p>Returns the vertical translation factor.</p> <p><b>See also</b> <a href="qtransform.html#dy">dy</a>(), <a href="qtransform.html#translate">translate</a>(), and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="m33" />float QTransform.m33 (<i>self</i>)</h3><p>Returns the division factor.</p> <p><b>See also</b> <a href="qtransform.html#translate">translate</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="map" />(int <i>tx</i>, int <i>ty</i>) QTransform.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="operator">=</span> m11<span class="operator">*</span>x <span class="operator">+</span> m21<span class="operator">*</span>y <span class="operator">+</span> dx y<span class="char">' = m22*y + m12*x + dy if (is not affine) { w'</span> <span class="operator">=</span> m13<span class="operator">*</span>x <span class="operator">+</span> m23<span class="operator">*</span>y <span class="operator">+</span> m33 x<span class="char">' /= w'</span> y<span class="char">' /= w'</span> } </pre> <p>The point (x, y) is the original point, and (x', y') is the transformed point.</p> <p><b>See also</b> <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="map-2" />(float <i>tx</i>, float <i>ty</i>) QTransform.map (<i>self</i>, float <i>x</i>, float <i>y</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 point, <i>p</i>, mapped into the coordinate system defined by this matrix.</p> <h3 class="fn"><a name="map-3" /><a href="qpoint.html">QPoint</a> QTransform.map (<i>self</i>, <a href="qpoint.html">QPoint</a> <i>p</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-4" /><a href="qpointf.html">QPointF</a> QTransform.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="qlinef.html">QLineF</a> object that is a copy of the given line, <i>l</i>, mapped into the coordinate system defined by this matrix.</p> <h3 class="fn"><a name="map-5" /><a href="qline.html">QLine</a> QTransform.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="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-6" /><a href="qlinef.html">QLineF</a> QTransform.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="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-7" /><a href="qpolygonf.html">QPolygonF</a> QTransform.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="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-8" /><a href="qpolygon.html">QPolygon</a> QTransform.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="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="map-9" /><a href="qregion.html">QRegion</a> QTransform.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="qpainterpath.html">QPainterPath</a> object that is a copy of the given <i>path</i>, mapped into the coordinate system defined by this matrix.</p> <h3 class="fn"><a name="map-10" /><a href="qpainterpath.html">QPainterPath</a> QTransform.map (<i>self</i>, <a href="qpainterpath.html">QPainterPath</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="mapRect" /><a href="qrect.html">QRect</a> QTransform.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 <span class="keyword">if</span> (is <span class="keyword">not</span> affine) { w<span class="char">' = m13*x + m23*y + m33 x'</span> <span class="operator">/</span><span class="operator">=</span> w<span class="char">' y'</span> <span class="operator">/</span><span class="operator">=</span> w<span class="char">' }</span> </pre> <p><span class="char">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="qtransform.html#mapToPolygon">mapToPolygon</a>() function instead.</span></p> <p><span class="char"><b>See also</b> <a href="qtransform.html#mapToPolygon">mapToPolygon</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</span></p> <h3 class="fn"><a name="mapRect-2" /><a href="qrectf.html">QRectF</a> QTransform.mapRect (<i>self</i>, <a href="qrectf.html">QRectF</a>)</h3><h3 class="fn"><a name="mapToPolygon" /><a href="qpolygon.html">QPolygon</a> QTransform.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="operator">=</span> m11<span class="operator">*</span>x <span class="operator">+</span> m21<span class="operator">*</span>y <span class="operator">+</span> dx y<span class="char">' = m22*y + m12*x + dy if (is not affine) { w'</span> <span class="operator">=</span> m13<span class="operator">*</span>x <span class="operator">+</span> m23<span class="operator">*</span>y <span class="operator">+</span> m33 x<span class="char">' /= w'</span> y<span class="char">' /= w'</span> } </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="qtransform.html#mapRect">mapRect</a>() and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="quadToQuad" />bool QTransform.quadToQuad (<a href="qpolygonf.html">QPolygonF</a> <i>one</i>, <a href="qpolygonf.html">QPolygonF</a> <i>two</i>, <a href="qtransform.html">QTransform</a> <i>result</i>)</h3><p>Creates a transformation matrix, <i>trans</i>, that maps a four-sided polygon, <i>one</i>, to another four-sided polygon, <i>two</i>. Returns true if the transformation is possible; otherwise returns false.</p> <p>This is a convenience method combining <a href="qtransform.html#quadToSquare">quadToSquare</a>() and <a href="qtransform.html#squareToQuad">squareToQuad</a>() methods. It allows the input quad to be transformed into any other quad.</p> <p><b>See also</b> <a href="qtransform.html#squareToQuad">squareToQuad</a>() and <a href="qtransform.html#quadToSquare">quadToSquare</a>().</p> <h3 class="fn"><a name="quadToSquare" />bool QTransform.quadToSquare (<a href="qpolygonf.html">QPolygonF</a> <i>quad</i>, <a href="qtransform.html">QTransform</a> <i>result</i>)</h3><p>Creates a transformation matrix, <i>trans</i>, that maps a four-sided polygon, <i>quad</i>, to a unit square. Returns true if the transformation is constructed or false if such a transformation does not exist.</p> <p><b>See also</b> <a href="qtransform.html#squareToQuad">squareToQuad</a>() and <a href="qtransform.html#quadToQuad">quadToQuad</a>().</p> <h3 class="fn"><a name="reset" />QTransform.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) and <tt>m33</tt> which are set to 1.</p> <p><b>See also</b> <a href="qtransform.html#QTransform">QTransform</a>(), <a href="qtransform.html#isIdentity">isIdentity</a>(), and <a href="qtransform.html#basic-matrix-operations">Basic Matrix Operations</a>.</p> <h3 class="fn"><a name="rotate" /><a href="qtransform.html">QTransform</a> QTransform.rotate (<i>self</i>, float <i>angle</i>, <a href="qt.html#Axis-enum">Qt.Axis</a> <i>axis</i> = Qt.ZAxis)</h3><p>Rotates the coordinate system counterclockwise by the given <i>angle</i> about the specified <i>axis</i> and returns a reference to the matrix.</p> <p>Note that if you apply a <a href="qtransform.html">QTransform</a> to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.</p> <p>The angle is specified in degrees.</p> <p><b>See also</b> <a href="qtransform.html#setMatrix">setMatrix</a>().</p> <h3 class="fn"><a name="rotateRadians" /><a href="qtransform.html">QTransform</a> QTransform.rotateRadians (<i>self</i>, float <i>angle</i>, <a href="qt.html#Axis-enum">Qt.Axis</a> <i>axis</i> = Qt.ZAxis)</h3><p>Rotates the coordinate system counterclockwise by the given <i>angle</i> about the specified <i>axis</i> and returns a reference to the matrix.</p> <p>Note that if you apply a <a href="qtransform.html">QTransform</a> to a point defined in widget coordinates, the direction of the rotation will be clockwise because the y-axis points downwards.</p> <p>The angle is specified in radians.</p> <p><b>See also</b> <a href="qtransform.html#setMatrix">setMatrix</a>().</p> <h3 class="fn"><a name="scale" /><a href="qtransform.html">QTransform</a> QTransform.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="qtransform.html#setMatrix">setMatrix</a>().</p> <h3 class="fn"><a name="setMatrix" />QTransform.setMatrix (<i>self</i>, float <i>m11</i>, float <i>m12</i>, float <i>m13</i>, float <i>m21</i>, float <i>m22</i>, float <i>m23</i>, float <i>m31</i>, float <i>m32</i>, float <i>m33</i>)</h3><p>Sets the matrix elements to the specified values, <i>m11</i>, <i>m12</i>, <i>m13</i> <i>m21</i>, <i>m22</i>, <i>m23</i> <i>m31</i>, <i>m32</i> and <i>m33</i>. Note that this function replaces the previous values. <a href="qtransform.html">QTransform</a> provides the <a href="qtransform.html#translate">translate</a>(), <a href="qtransform.html#rotate">rotate</a>(), <a href="qtransform.html#scale">scale</a>() and <a href="qtransform.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="qtransform.html#QTransform">QTransform</a>().</p> <h3 class="fn"><a name="shear" /><a href="qtransform.html">QTransform</a> QTransform.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="qtransform.html#setMatrix">setMatrix</a>().</p> <h3 class="fn"><a name="squareToQuad" />bool QTransform.squareToQuad (<a href="qpolygonf.html">QPolygonF</a> <i>square</i>, <a href="qtransform.html">QTransform</a> <i>result</i>)</h3><p>Creates a transformation matrix, <i>trans</i>, that maps a unit square to a four-sided polygon, <i>quad</i>. Returns true if the transformation is constructed or false if such a transformation does not exist.</p> <p><b>See also</b> <a href="qtransform.html#quadToSquare">quadToSquare</a>() and <a href="qtransform.html#quadToQuad">quadToQuad</a>().</p> <h3 class="fn"><a name="toAffine" /><a href="qmatrix.html">QMatrix</a> QTransform.toAffine (<i>self</i>)</h3><p>Returns the <a href="qtransform.html">QTransform</a> as an affine matrix.</p> <p><b>Warning:</b> If a perspective transformation has been specified, then the conversion will cause loss of data.</p> <h3 class="fn"><a name="translate" /><a href="qtransform.html">QTransform</a> QTransform.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="qtransform.html#setMatrix">setMatrix</a>().</p> <h3 class="fn"><a name="transposed" /><a href="qtransform.html">QTransform</a> QTransform.transposed (<i>self</i>)</h3><p>Returns the transpose of this matrix.</p> <h3 class="fn"><a name="type" /><a href="qtransform.html#TransformationType-enum">TransformationType</a> QTransform.type (<i>self</i>)</h3><p>Returns the transformation type of this matrix.</p> <p>The transformation type is the highest enumeration value capturing all of the matrix's transformations. For example, if the matrix both scales and shears, the type would be <tt>TxShear</tt>, because <tt>TxShear</tt> has a higher enumeration value than <tt>TxScale</tt>.</p> <p>Knowing the transformation type of a matrix is useful for optimization: you can often handle specific types more optimally than handling the generic case.</p> <h3 class="fn"><a name="__add__" /><a href="qtransform.html">QTransform</a> QTransform.__add__ (<i>self</i>, float <i>n</i>)</h3><h3 class="fn"><a name="__div__" /><a href="qtransform.html">QTransform</a> QTransform.__div__ (<i>self</i>, float <i>n</i>)</h3><h3 class="fn"><a name="__eq__" />bool QTransform.__eq__ (<i>self</i>, <a href="qtransform.html">QTransform</a>)</h3><h3 class="fn"><a name="__iadd__" /><a href="qtransform.html">QTransform</a> QTransform.__iadd__ (<i>self</i>, float <i>num</i>)</h3><h3 class="fn"><a name="__idiv__" /><a href="qtransform.html">QTransform</a> QTransform.__idiv__ (<i>self</i>, float <i>div</i>)</h3><h3 class="fn"><a name="__imul__" /><a href="qtransform.html">QTransform</a> QTransform.__imul__ (<i>self</i>, <a href="qtransform.html">QTransform</a>)</h3><h3 class="fn"><a name="__imul__-2" /><a href="qtransform.html">QTransform</a> QTransform.__imul__ (<i>self</i>, float <i>num</i>)</h3><h3 class="fn"><a name="__isub__" /><a href="qtransform.html">QTransform</a> QTransform.__isub__ (<i>self</i>, float <i>num</i>)</h3><h3 class="fn"><a name="__mul__" /><a href="qtransform.html">QTransform</a> QTransform.__mul__ (<i>self</i>, <a href="qtransform.html">QTransform</a> <i>o</i>)</h3><h3 class="fn"><a name="__mul__-2" /><a href="qtransform.html">QTransform</a> QTransform.__mul__ (<i>self</i>, float <i>n</i>)</h3><h3 class="fn"><a name="__ne__" />bool QTransform.__ne__ (<i>self</i>, <a href="qtransform.html">QTransform</a>)</h3><h3 class="fn"><a name="__sub__" /><a href="qtransform.html">QTransform</a> QTransform.__sub__ (<i>self</i>, float <i>n</i>)</h3><address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt 4.10.3 for X11</td><td align="center" width="50%">Copyright © <a href="http://www.riverbankcomputing.com">Riverbank Computing Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt 4.8.5</td></tr></table></div></address></body></html>