summaryrefslogtreecommitdiffstats
path: root/doc/html/qwmatrix.html
blob: b634a152464d633bc1686a8f38f6b3c9e7a8141b (plain)
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
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/qwmatrix.cpp:51 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QWMatrix Class</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QWMatrix Class Reference</h1>

<p>The QWMatrix class specifies 2D transformations of a
coordinate system.
<a href="#details">More...</a>
<p><tt>#include &lt;<a href="qwmatrix-h.html">qwmatrix.h</a>&gt;</tt>
<p><a href="qwmatrix-members.html">List of all member functions.</a>
<h2>Public Members</h2>
<ul>
<li class=fn><a href="#QWMatrix"><b>QWMatrix</b></a> ()</li>
<li class=fn><a href="#QWMatrix-2"><b>QWMatrix</b></a> ( double&nbsp;m11, double&nbsp;m12, double&nbsp;m21, double&nbsp;m22, double&nbsp;dx, double&nbsp;dy )</li>
<li class=fn>void <a href="#setMatrix"><b>setMatrix</b></a> ( double&nbsp;m11, double&nbsp;m12, double&nbsp;m21, double&nbsp;m22, double&nbsp;dx, double&nbsp;dy )</li>
<li class=fn>double <a href="#m11"><b>m11</b></a> () const</li>
<li class=fn>double <a href="#m12"><b>m12</b></a> () const</li>
<li class=fn>double <a href="#m21"><b>m21</b></a> () const</li>
<li class=fn>double <a href="#m22"><b>m22</b></a> () const</li>
<li class=fn>double <a href="#dx"><b>dx</b></a> () const</li>
<li class=fn>double <a href="#dy"><b>dy</b></a> () const</li>
<li class=fn>void <a href="#map"><b>map</b></a> ( int&nbsp;x, int&nbsp;y, int&nbsp;*&nbsp;tx, int&nbsp;*&nbsp;ty ) const</li>
<li class=fn>void <a href="#map-2"><b>map</b></a> ( double&nbsp;x, double&nbsp;y, double&nbsp;*&nbsp;tx, double&nbsp;*&nbsp;ty ) const</li>
<li class=fn>QRect <a href="#mapRect"><b>mapRect</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;rect ) const</li>
<li class=fn>QPoint <a href="#map-3"><b>map</b></a> ( const&nbsp;QPoint&nbsp;&amp;&nbsp;p ) const</li>
<li class=fn>QRect map ( const&nbsp;QRect&nbsp;&amp;&nbsp;r ) const &nbsp;<em>(obsolete)</em></li>
<li class=fn>QPointArray <a href="#map-5"><b>map</b></a> ( const&nbsp;QPointArray&nbsp;&amp;&nbsp;a ) const</li>
<li class=fn>QRegion <a href="#map-6"><b>map</b></a> ( const&nbsp;QRegion&nbsp;&amp;&nbsp;r ) const</li>
<li class=fn>QRegion <a href="#mapToRegion"><b>mapToRegion</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;rect ) const</li>
<li class=fn>QPointArray <a href="#mapToPolygon"><b>mapToPolygon</b></a> ( const&nbsp;QRect&nbsp;&amp;&nbsp;rect ) const</li>
<li class=fn>void <a href="#reset"><b>reset</b></a> ()</li>
<li class=fn>bool <a href="#isIdentity"><b>isIdentity</b></a> () const</li>
<li class=fn>QWMatrix &amp; <a href="#translate"><b>translate</b></a> ( double&nbsp;dx, double&nbsp;dy )</li>
<li class=fn>QWMatrix &amp; <a href="#scale"><b>scale</b></a> ( double&nbsp;sx, double&nbsp;sy )</li>
<li class=fn>QWMatrix &amp; <a href="#shear"><b>shear</b></a> ( double&nbsp;sh, double&nbsp;sv )</li>
<li class=fn>QWMatrix &amp; <a href="#rotate"><b>rotate</b></a> ( double&nbsp;a )</li>
<li class=fn>bool <a href="#isInvertible"><b>isInvertible</b></a> () const</li>
<li class=fn>double <a href="#det"><b>det</b></a> () const</li>
<li class=fn>QWMatrix <a href="#invert"><b>invert</b></a> ( bool&nbsp;*&nbsp;invertible = 0 ) const</li>
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const&nbsp;QWMatrix&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const&nbsp;QWMatrix&nbsp;&amp;&nbsp;m ) const</li>
<li class=fn>QWMatrix &amp; <a href="#operator*-eq"><b>operator*=</b></a> ( const&nbsp;QWMatrix&nbsp;&amp;&nbsp;m )</li>
<li class=fn>enum <a href="#TransformationMode-enum"><b>TransformationMode</b></a> { Points, Areas }</li>
</ul>
<h2>Static Public Members</h2>
<ul>
<li class=fn>void <a href="#setTransformationMode"><b>setTransformationMode</b></a> ( QWMatrix::TransformationMode&nbsp;m )</li>
<li class=fn>TransformationMode <a href="#transformationMode"><b>transformationMode</b></a> ()</li>
</ul>
<h2>Related Functions</h2>
<ul>
<li class=fn>QDataStream &amp; <a href="#operator-lt-lt"><b>operator&lt;&lt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, const&nbsp;QWMatrix&nbsp;&amp;&nbsp;m )</li>
<li class=fn>QDataStream &amp; <a href="#operator-gt-gt"><b>operator&gt;&gt;</b></a> ( QDataStream&nbsp;&amp;&nbsp;s, QWMatrix&nbsp;&amp;&nbsp;m )</li>
</ul>
<hr><a name="details"></a><h2>Detailed Description</h2>


The QWMatrix class specifies 2D transformations of a
coordinate system.
<p> 

<p> The standard coordinate system of a <a href="qpaintdevice.html">paint
    device</a> has the origin located at the top-left position. X
values increase to the right; Y values increase downward.
<p> This coordinate system is the default for the <a href="qpainter.html">QPainter</a>, which
renders graphics in a paint device. A user-defined coordinate
system can be specified by setting a QWMatrix for the painter.
<p> Example:
<pre>
        MyWidget::paintEvent( <a href="qpaintevent.html">QPaintEvent</a> * )
        {
            <a href="qpainter.html">QPainter</a> p;                      // our painter
            QWMatrix m;                      // our transformation matrix
            m.<a href="#rotate">rotate</a>( 22.5 );                // rotated coordinate system
            p.<a href="qpainter.html#begin">begin</a>( this );                 // start painting
            p.<a href="qpainter.html#setWorldMatrix">setWorldMatrix</a>( m );           // use rotated coordinate system
            p.<a href="qpainter.html#drawText">drawText</a>( 30,20, "detator" );  // draw rotated text at 30,20
            p.<a href="qpainter.html#end">end</a>();                         // painting done
        }
    </pre>
 
<p> A matrix specifies how to translate, scale, shear or rotate the
graphics; the actual transformation is performed by the drawing
routines in <a href="qpainter.html">QPainter</a> and by <a href="qpixmap.html#xForm">QPixmap::xForm</a>().
<p> The QWMatrix class contains a 3x3 matrix of the form:
<table align=center border=1 cellpadding=1 cellspacing=0>
<tr align=center><td>m11</td><td>m12</td><td>&nbsp;0 </td></tr>
<tr align=center><td>m21</td><td>m22</td><td>&nbsp;0 </td></tr>
<tr align=center><td>dx</td> <td>dy</td> <td>&nbsp;1 </td></tr>
</table>
<p> A matrix transforms a point in the plane to another point:
<pre>
        x' = m11*x + m21*y + dx
        y' = m22*y + m12*x + dy
    </pre>
 
<p> The point <em>(x, y)</em> is the original point, and <em>(x', y')</em> is the
transformed point. <em>(x', y')</em> can be transformed back to <em>(x, y)</em> by performing the same operation on the <a href="#invert">inverted matrix</a>.
<p> The elements <em>dx</em> and <em>dy</em> specify horizontal and vertical
translation. The elements <em>m11</em> and <em>m22</em> specify horizontal and
vertical scaling. The elements <em>m12</em> and <em>m21</em> specify
horizontal and vertical shearing.
<p> The identity matrix has <em>m11</em> and <em>m22</em> set to 1; all others are
set to 0. This matrix maps a point to itself.
<p> Translation is the simplest transformation. Setting <em>dx</em> and <em>dy</em> will move the coordinate system <em>dx</em> units along the X axis
and <em>dy</em> units along the Y axis.
<p> Scaling can be done by setting <em>m11</em> and <em>m22</em>. For example,
setting <em>m11</em> to 2 and <em>m22</em> to 1.5 will double the height and
increase the width by 50%.
<p> Shearing is controlled by <em>m12</em> and <em>m21</em>. Setting these
elements to values different from zero will twist the coordinate
system.
<p> Rotation is achieved by carefully setting both the shearing
factors and the scaling factors. The QWMatrix also has a function
that sets <a href="#rotate">rotation</a> directly.
<p> QWMatrix lets you combine transformations like this:
<pre>
        QWMatrix m;           // identity matrix
        m.<a href="#translate">translate</a>(10, -20); // first translate (10,-20)
        m.<a href="#rotate">rotate</a>(25);         // then rotate 25 degrees
        m.<a href="#scale">scale</a>(1.2, 0.7);    // finally scale it
    </pre>
 
<p> Here's the same example using basic matrix operations:
<pre>
        double a    = pi/180 * 25;         // convert 25 to radians
        double sina = sin(a);
        double cosa = cos(a);
        QWMatrix m1(1, 0, 0, 1, 10, -20);  // translation matrix
        QWMatrix m2( cosa, sina,           // rotation matrix
                    -sina, cosa, 0, 0 );
        QWMatrix m3(1.2, 0, 0, 0.7, 0, 0); // scaling matrix
        QWMatrix m;
        m = m3 * m2 * m1;                  // combine all transformations
    </pre>
 
<p> <a href="qpainter.html">QPainter</a> has functions to translate, scale, shear and rotate the
coordinate system without using a QWMatrix. Although these
functions are very convenient, it can be more efficient to build a
QWMatrix and call <a href="qpainter.html#setWorldMatrix">QPainter::setWorldMatrix</a>() if you want to perform
more than a single transform operation.
<p> <p>See also <a href="qpainter.html#setWorldMatrix">QPainter::setWorldMatrix</a>(), <a href="qpixmap.html#xForm">QPixmap::xForm</a>(), <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.

<hr><h2>Member Type Documentation</h2>
<h3 class=fn><a name="TransformationMode-enum"></a>QWMatrix::TransformationMode</h3>

<p> <!-- index transformation matrix -->
<p> QWMatrix offers two transformation modes. Calculations can either
be done in terms of points (Points mode, the default), or in
terms of area (Area mode).
<p> In Points mode the transformation is applied to the points that
mark out the shape's bounding line. In Areas mode the
transformation is applied in such a way that the area of the
contained region is correctly transformed under the matrix.
<ul>
<li><tt>QWMatrix::Points</tt> - transformations are applied to the shape's points.
<li><tt>QWMatrix::Areas</tt> - transformations are applied (e.g. to the width and
height) so that the area is transformed.
</ul><p> Example:
<p> Suppose we have a rectangle,
<tt>QRect( 10, 20, 30, 40 )</tt> and a transformation matrix
<tt>QWMatrix( 2, 0, 0, 2, 0, 0 )</tt> to double the rectangle's size.
<p> In Points mode, the matrix will transform the top-left (10,20) and
the bottom-right (39,59) points producing a rectangle with its
top-left point at (20,40) and its bottom-right point at (78,118),
i.e. with a width of 59 and a height of 79.
<p> In Areas mode, the matrix will transform the top-left point in
the same way as in Points mode to (20/40), and double the width
and height, so the bottom-right will become (69,99), i.e. a width
of 60 and a height of 80.
<p> Because integer arithmetic is used (for speed), rounding
differences mean that the modes will produce slightly different
results given the same shape and the same transformation,
especially when scaling up. This also means that some operations
are not commutative.
<p> Under Points mode, <tt>matrix * ( region1 | region2 )</tt> is not equal to
<tt>matrix * region1 | matrix * region2</tt>. Under Area mode, <tt>matrix * (pointarray[i])</tt> is not neccesarily equal to
<tt>(matrix * pointarry)[i]</tt>.
<p> <center><img src="xform.png" alt="Comparison of Points and Areas TransformationModes"></center> 
<hr><h2>Member Function Documentation</h2>
<h3 class=fn><a name="QWMatrix"></a>QWMatrix::QWMatrix ()
</h3>
Constructs an identity matrix. All elements are set to zero except
<em>m11</em> and <em>m22</em> (scaling), which are set to 1.

<h3 class=fn><a name="QWMatrix-2"></a>QWMatrix::QWMatrix ( double&nbsp;m11, double&nbsp;m12, double&nbsp;m21, double&nbsp;m22, double&nbsp;dx, double&nbsp;dy )
</h3>
Constructs a matrix with the elements, <em>m11</em>, <em>m12</em>, <em>m21</em>, <em>m22</em>, <em>dx</em> and <em>dy</em>.

<h3 class=fn>double <a name="det"></a>QWMatrix::det () const
</h3>

<p> Returns the matrix's determinant.

<h3 class=fn>double <a name="dx"></a>QWMatrix::dx () const
</h3>

<p> Returns the horizontal translation.

<h3 class=fn>double <a name="dy"></a>QWMatrix::dy () const
</h3>

<p> Returns the vertical translation.

<h3 class=fn><a href="qwmatrix.html">QWMatrix</a> <a name="invert"></a>QWMatrix::invert ( bool&nbsp;*&nbsp;invertible = 0 ) const
</h3>
Returns the inverted matrix.
<p> If the matrix is singular (not invertible), the identity matrix is
returned.
<p> If <em>invertible</em> is not 0: the value of <em>*invertible</em> is set
to TRUE if the matrix is invertible; otherwise <em>*invertible</em> is
set to FALSE.
<p> <p>See also <a href="#isInvertible">isInvertible</a>().

<p>Example: <a href="tutorial1-14.html#x2433">t14/cannon.cpp</a>.
<h3 class=fn>bool <a name="isIdentity"></a>QWMatrix::isIdentity () const
</h3>
Returns TRUE if the matrix is the identity matrix; otherwise returns FALSE.
<p> <p>See also <a href="#reset">reset</a>().

<h3 class=fn>bool <a name="isInvertible"></a>QWMatrix::isInvertible () const
</h3>

<p> Returns TRUE if the matrix is invertible; otherwise returns FALSE.
<p> <p>See also <a href="#invert">invert</a>().

<h3 class=fn>double <a name="m11"></a>QWMatrix::m11 () const
</h3>

<p> Returns the X scaling factor.

<h3 class=fn>double <a name="m12"></a>QWMatrix::m12 () const
</h3>

<p> Returns the vertical shearing factor.

<h3 class=fn>double <a name="m21"></a>QWMatrix::m21 () const
</h3>

<p> Returns the horizontal shearing factor.

<h3 class=fn>double <a name="m22"></a>QWMatrix::m22 () const
</h3>

<p> Returns the Y scaling factor.

<h3 class=fn>void <a name="map"></a>QWMatrix::map ( int&nbsp;x, int&nbsp;y, int&nbsp;*&nbsp;tx, int&nbsp;*&nbsp;ty ) const
</h3>
Transforms ( <em>x</em>, <em>y</em> ) to ( <em>*tx</em>, <em>*ty</em> ) using the formulae:
<p> <pre>
        *tx = m11*x + m21*y + dx  (rounded to the nearest integer)
        *ty = m22*y + m12*x + dy  (rounded to the nearest integer)
    </pre>
 

<p>Examples: <a href="tutorial1-14.html#x2434">t14/cannon.cpp</a> and <a href="xform-example.html#x1278">xform/xform.cpp</a>.
<h3 class=fn>void <a name="map-2"></a>QWMatrix::map ( double&nbsp;x, double&nbsp;y, double&nbsp;*&nbsp;tx, double&nbsp;*&nbsp;ty ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Transforms ( <em>x</em>, <em>y</em> ) to ( <em>*tx</em>, <em>*ty</em> ) using the
following formulae:
<p> <pre>
        *tx = m11*x + m21*y + dx
        *ty = m22*y + m12*x + dy
    </pre>
 

<h3 class=fn><a href="qpoint.html">QPoint</a> <a name="map-3"></a>QWMatrix::map ( const&nbsp;<a href="qpoint.html">QPoint</a>&nbsp;&amp;&nbsp;p ) const
</h3>

<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Transforms <em>p</em> to using the formulae:
<p> <pre>
        retx = m11*px + m21*py + dx  (rounded to the nearest integer)
        rety = m22*py + m12*px + dy  (rounded to the nearest integer)
    </pre>
 

<h3 class=fn><a href="qrect.html">QRect</a> <a name="map-4"></a>QWMatrix::map ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;r ) const
</h3>

<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
<p> Please use <a href="#mapRect">QWMatrix::mapRect</a>() instead.
<p> Note that this method does return the bounding rectangle of the <em>r</em>, when
shearing or rotations are used.

<h3 class=fn><a href="qpointarray.html">QPointArray</a> <a name="map-5"></a>QWMatrix::map ( const&nbsp;<a href="qpointarray.html">QPointArray</a>&nbsp;&amp;&nbsp;a ) const
</h3>

<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Returns the point array <em>a</em> transformed by calling map for each point.

<h3 class=fn><a href="qregion.html">QRegion</a> <a name="map-6"></a>QWMatrix::map ( const&nbsp;<a href="qregion.html">QRegion</a>&nbsp;&amp;&nbsp;r ) const
</h3>

<p> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> Transforms the region <em>r</em>.
<p> Calling this method can be rather expensive, if rotations or
shearing are used.

<h3 class=fn><a href="qrect.html">QRect</a> <a name="mapRect"></a>QWMatrix::mapRect ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;rect ) const
</h3>
Returns the transformed rectangle <em>rect</em>.
<p> The bounding rectangle is returned if rotation or shearing has
been specified.
<p> If you need to know the exact region <em>rect</em> maps to use <a href="qsize.html#operator*-4">operator*</a>().
<p> <p>See also <a href="qsize.html#operator*-4">operator*</a>().

<p>Example: <a href="xform-example.html#x1279">xform/xform.cpp</a>.
<h3 class=fn><a href="qpointarray.html">QPointArray</a> <a name="mapToPolygon"></a>QWMatrix::mapToPolygon ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;rect ) const
</h3>
Returns the transformed rectangle <em>rect</em> as a polygon.
<p> Polygons and rectangles behave slightly differently
when transformed (due to integer rounding), so
<tt>matrix.map( QPointArray( rect ) )</tt> is not always the same as
<tt>matrix.mapToPolygon( rect )</tt>.

<h3 class=fn><a href="qregion.html">QRegion</a> <a name="mapToRegion"></a>QWMatrix::mapToRegion ( const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;rect ) const
</h3>

<p> Returns the transformed rectangle <em>rect</em>.
<p> A rectangle which has been rotated or sheared may result in a
non-rectangular region being returned.
<p> Calling this method can be expensive, if rotations or shearing are
used. If you just need to know the bounding rectangle of the
returned region, use <a href="#mapRect">mapRect</a>() which is a lot faster than this
function.
<p> <p>See also <a href="#mapRect">QWMatrix::mapRect</a>().

<h3 class=fn>bool <a name="operator!-eq"></a>QWMatrix::operator!= ( const&nbsp;<a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp;&nbsp;m ) const
</h3>
Returns TRUE if this matrix is not equal to <em>m</em>; otherwise returns FALSE.

<h3 class=fn><a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp; <a name="operator*-eq"></a>QWMatrix::operator*= ( const&nbsp;<a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp;&nbsp;m )
</h3>
Returns the result of multiplying this matrix by matrix <em>m</em>.

<h3 class=fn>bool <a name="operator-eq-eq"></a>QWMatrix::operator== ( const&nbsp;<a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp;&nbsp;m ) const
</h3>
Returns TRUE if this matrix is equal to <em>m</em>; otherwise returns FALSE.

<h3 class=fn>void <a name="reset"></a>QWMatrix::reset ()
</h3>
Resets the matrix to an identity matrix.
<p> All elements are set to zero, except <em>m11</em> and <em>m22</em> (scaling)
which are set to 1.
<p> <p>See also <a href="#isIdentity">isIdentity</a>().

<h3 class=fn><a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp; <a name="rotate"></a>QWMatrix::rotate ( double&nbsp;a )
</h3>
Rotates the coordinate system <em>a</em> degrees counterclockwise.
<p> Returns a reference to the matrix.
<p> <p>See also <a href="#translate">translate</a>(), <a href="#scale">scale</a>(), and <a href="#shear">shear</a>().

<p>Examples: <a href="canvas-example.html#x2955">canvas/canvas.cpp</a>, <a href="desktop-example.html#x1764">desktop/desktop.cpp</a>, <a href="drawdemo-example.html#x1095">drawdemo/drawdemo.cpp</a>, <a href="tutorial1-14.html#x2435">t14/cannon.cpp</a>, and <a href="xform-example.html#x1280">xform/xform.cpp</a>.
<h3 class=fn><a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp; <a name="scale"></a>QWMatrix::scale ( double&nbsp;sx, double&nbsp;sy )
</h3>
Scales the coordinate system unit by <em>sx</em> horizontally and <em>sy</em>
vertically.
<p> Returns a reference to the matrix.
<p> <p>See also <a href="#translate">translate</a>(), <a href="#shear">shear</a>(), and <a href="#rotate">rotate</a>().

<p>Examples: <a href="canvas-example.html#x2956">canvas/canvas.cpp</a>, <a href="fileiconview-example.html#x876">fileiconview/qfileiconview.cpp</a>, <a href="movies-example.html#x524">movies/main.cpp</a>, <a href="qmag-example.html#x1809">qmag/qmag.cpp</a>, <a href="showimg-example.html#x1357">showimg/showimg.cpp</a>, and <a href="xform-example.html#x1281">xform/xform.cpp</a>.
<h3 class=fn>void <a name="setMatrix"></a>QWMatrix::setMatrix ( double&nbsp;m11, double&nbsp;m12, double&nbsp;m21, double&nbsp;m22, double&nbsp;dx, double&nbsp;dy )
</h3>
Sets the matrix elements to the specified values, <em>m11</em>, <em>m12</em>,
<em>m21</em>, <em>m22</em>, <em>dx</em> and <em>dy</em>.

<h3 class=fn>void <a name="setTransformationMode"></a>QWMatrix::setTransformationMode ( <a href="qwmatrix.html#TransformationMode-enum">QWMatrix::TransformationMode</a>&nbsp;m )<tt> [static]</tt>
</h3>
Sets the transformation mode that QWMatrix and painter
transformations use to <em>m</em>.
<p> <p>See also <a href="#TransformationMode-enum">QWMatrix::TransformationMode</a>.

<h3 class=fn><a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp; <a name="shear"></a>QWMatrix::shear ( double&nbsp;sh, double&nbsp;sv )
</h3>
Shears the coordinate system by <em>sh</em> horizontally and <em>sv</em>
vertically.
<p> Returns a reference to the matrix.
<p> <p>See also <a href="#translate">translate</a>(), <a href="#scale">scale</a>(), and <a href="#rotate">rotate</a>().

<p>Examples: <a href="drawdemo-example.html#x1096">drawdemo/drawdemo.cpp</a> and <a href="xform-example.html#x1282">xform/xform.cpp</a>.
<h3 class=fn><a href="qwmatrix.html#TransformationMode-enum">TransformationMode</a> <a name="transformationMode"></a>QWMatrix::transformationMode ()<tt> [static]</tt>
</h3>
Returns the current transformation mode.
<p> <p>See also <a href="#TransformationMode-enum">QWMatrix::TransformationMode</a>.

<h3 class=fn><a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp; <a name="translate"></a>QWMatrix::translate ( double&nbsp;dx, double&nbsp;dy )
</h3>
Moves the coordinate system <em>dx</em> along the X-axis and <em>dy</em> along
the Y-axis.
<p> Returns a reference to the matrix.
<p> <p>See also <a href="#scale">scale</a>(), <a href="#shear">shear</a>(), and <a href="#rotate">rotate</a>().

<p>Examples: <a href="canvas-example.html#x2957">canvas/canvas.cpp</a>, <a href="drawdemo-example.html#x1097">drawdemo/drawdemo.cpp</a>, <a href="tutorial1-14.html#x2436">t14/cannon.cpp</a>, and <a href="xform-example.html#x1283">xform/xform.cpp</a>.
<hr><h2>Related Functions</h2>
<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-lt-lt"></a>operator&lt;&lt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, const&nbsp;<a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp;&nbsp;m )
</h3>

<p> Writes the matrix <em>m</em> to the stream <em>s</em> and returns a reference
to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.

<h3 class=fn><a href="qdatastream.html">QDataStream</a>&nbsp;&amp; <a name="operator-gt-gt"></a>operator&gt;&gt; ( <a href="qdatastream.html">QDataStream</a>&nbsp;&amp;&nbsp;s, <a href="qwmatrix.html">QWMatrix</a>&nbsp;&amp;&nbsp;m )
</h3>

<p> Reads the matrix <em>m</em> from the stream <em>s</em> and returns a reference
to the stream.
<p> <p>See also <a href="datastreamformat.html">Format of the QDataStream operators</a>.

<!-- eof -->
<hr><p>
This file is part of the <a href="index.html">Qt toolkit</a>.
Copyright &copy; 1995-2007
<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>