You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
450 lines
24 KiB
450 lines
24 KiB
13 years ago
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||
5 months ago
|
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/kernel/tqwmatrix.cpp:51 -->
|
||
13 years ago
|
<html>
|
||
|
<head>
|
||
|
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||
|
<title>TQWMatrix 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 Classes</font></a>
|
||
|
| <a href="mainclasses.html">
|
||
|
<font color="#004faf">Main Classes</font></a>
|
||
|
| <a href="annotated.html">
|
||
|
<font color="#004faf">Annotated</font></a>
|
||
|
| <a href="groups.html">
|
||
|
<font color="#004faf">Grouped 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>TQWMatrix Class Reference</h1>
|
||
|
|
||
|
<p>The TQWMatrix class specifies 2D transformations of a
|
||
|
coordinate system.
|
||
|
<a href="#details">More...</a>
|
||
5 months ago
|
<p><tt>#include <<a href="tqwmatrix-h.html">tqwmatrix.h</a>></tt>
|
||
|
<p><a href="tqwmatrix-members.html">List of all member functions.</a>
|
||
13 years ago
|
<h2>Public Members</h2>
|
||
|
<ul>
|
||
|
<li class=fn><a href="#TQWMatrix"><b>TQWMatrix</b></a> ()</li>
|
||
|
<li class=fn><a href="#TQWMatrix-2"><b>TQWMatrix</b></a> ( double m11, double m12, double m21, double m22, double dx, double dy )</li>
|
||
|
<li class=fn>void <a href="#setMatrix"><b>setMatrix</b></a> ( double m11, double m12, double m21, double m22, double dx, double 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 x, int y, int * tx, int * ty ) const</li>
|
||
|
<li class=fn>void <a href="#map-2"><b>map</b></a> ( double x, double y, double * tx, double * ty ) const</li>
|
||
|
<li class=fn>TQRect <a href="#mapRect"><b>mapRect</b></a> ( const TQRect & rect ) const</li>
|
||
|
<li class=fn>TQPoint <a href="#map-3"><b>map</b></a> ( const TQPoint & p ) const</li>
|
||
|
<li class=fn>TQRect map ( const TQRect & r ) const <em>(obsolete)</em></li>
|
||
|
<li class=fn>TQPointArray <a href="#map-5"><b>map</b></a> ( const TQPointArray & a ) const</li>
|
||
|
<li class=fn>TQRegion <a href="#map-6"><b>map</b></a> ( const TQRegion & r ) const</li>
|
||
|
<li class=fn>TQRegion <a href="#mapToRegion"><b>mapToRegion</b></a> ( const TQRect & rect ) const</li>
|
||
|
<li class=fn>TQPointArray <a href="#mapToPolygon"><b>mapToPolygon</b></a> ( const TQRect & 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>TQWMatrix & <a href="#translate"><b>translate</b></a> ( double dx, double dy )</li>
|
||
|
<li class=fn>TQWMatrix & <a href="#scale"><b>scale</b></a> ( double sx, double sy )</li>
|
||
|
<li class=fn>TQWMatrix & <a href="#shear"><b>shear</b></a> ( double sh, double sv )</li>
|
||
|
<li class=fn>TQWMatrix & <a href="#rotate"><b>rotate</b></a> ( double 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>TQWMatrix <a href="#invert"><b>invert</b></a> ( bool * invertible = 0 ) const</li>
|
||
|
<li class=fn>bool <a href="#operator-eq-eq"><b>operator==</b></a> ( const TQWMatrix & m ) const</li>
|
||
|
<li class=fn>bool <a href="#operator!-eq"><b>operator!=</b></a> ( const TQWMatrix & m ) const</li>
|
||
|
<li class=fn>TQWMatrix & <a href="#operator*-eq"><b>operator*=</b></a> ( const TQWMatrix & 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> ( TQWMatrix::TransformationMode m )</li>
|
||
|
<li class=fn>TransformationMode <a href="#transformationMode"><b>transformationMode</b></a> ()</li>
|
||
|
</ul>
|
||
|
<h2>Related Functions</h2>
|
||
|
<ul>
|
||
|
<li class=fn>TQDataStream & <a href="#operator-lt-lt"><b>operator<<</b></a> ( TQDataStream & s, const TQWMatrix & m )</li>
|
||
|
<li class=fn>TQDataStream & <a href="#operator-gt-gt"><b>operator>></b></a> ( TQDataStream & s, TQWMatrix & m )</li>
|
||
|
</ul>
|
||
|
<hr><a name="details"></a><h2>Detailed Description</h2>
|
||
|
|
||
|
|
||
|
The TQWMatrix class specifies 2D transformations of a
|
||
|
coordinate system.
|
||
|
<p>
|
||
|
|
||
5 months ago
|
<p> The standard coordinate system of a <a href="tqpaintdevice.html">paint
|
||
13 years ago
|
device</a> has the origin located at the top-left position. X
|
||
|
values increase to the right; Y values increase downward.
|
||
5 months ago
|
<p> This coordinate system is the default for the <a href="tqpainter.html">TQPainter</a>, which
|
||
13 years ago
|
renders graphics in a paint device. A user-defined coordinate
|
||
|
system can be specified by setting a TQWMatrix for the painter.
|
||
|
<p> Example:
|
||
|
<pre>
|
||
5 months ago
|
MyWidget::paintEvent( <a href="tqpaintevent.html">TQPaintEvent</a> * )
|
||
13 years ago
|
{
|
||
5 months ago
|
<a href="tqpainter.html">TQPainter</a> p; // our painter
|
||
13 years ago
|
TQWMatrix m; // our transformation matrix
|
||
|
m.<a href="#rotate">rotate</a>( 22.5 ); // rotated coordinate system
|
||
5 months ago
|
p.<a href="tqpainter.html#begin">begin</a>( this ); // start painting
|
||
|
p.<a href="tqpainter.html#setWorldMatrix">setWorldMatrix</a>( m ); // use rotated coordinate system
|
||
|
p.<a href="tqpainter.html#drawText">drawText</a>( 30,20, "detator" ); // draw rotated text at 30,20
|
||
|
p.<a href="tqpainter.html#end">end</a>(); // painting done
|
||
13 years ago
|
}
|
||
|
</pre>
|
||
|
|
||
|
<p> A matrix specifies how to translate, scale, shear or rotate the
|
||
|
graphics; the actual transformation is performed by the drawing
|
||
5 months ago
|
routines in <a href="tqpainter.html">TQPainter</a> and by <a href="tqpixmap.html#xForm">TQPixmap::xForm</a>().
|
||
13 years ago
|
<p> The TQWMatrix 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> 0 </td></tr>
|
||
|
<tr align=center><td>m21</td><td>m22</td><td> 0 </td></tr>
|
||
|
<tr align=center><td>dx</td> <td>dy</td> <td> 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 TQWMatrix also has a function
|
||
|
that sets <a href="#rotate">rotation</a> directly.
|
||
|
<p> TQWMatrix lets you combine transformations like this:
|
||
|
<pre>
|
||
|
TQWMatrix 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);
|
||
|
TQWMatrix m1(1, 0, 0, 1, 10, -20); // translation matrix
|
||
|
TQWMatrix m2( cosa, sina, // rotation matrix
|
||
|
-sina, cosa, 0, 0 );
|
||
|
TQWMatrix m3(1.2, 0, 0, 0.7, 0, 0); // scaling matrix
|
||
|
TQWMatrix m;
|
||
|
m = m3 * m2 * m1; // combine all transformations
|
||
|
</pre>
|
||
|
|
||
5 months ago
|
<p> <a href="tqpainter.html">TQPainter</a> has functions to translate, scale, shear and rotate the
|
||
13 years ago
|
coordinate system without using a TQWMatrix. Although these
|
||
|
functions are very convenient, it can be more efficient to build a
|
||
5 months ago
|
TQWMatrix and call <a href="tqpainter.html#setWorldMatrix">TQPainter::setWorldMatrix</a>() if you want to perform
|
||
13 years ago
|
more than a single transform operation.
|
||
5 months ago
|
<p> <p>See also <a href="tqpainter.html#setWorldMatrix">TQPainter::setWorldMatrix</a>(), <a href="tqpixmap.html#xForm">TQPixmap::xForm</a>(), <a href="graphics.html">Graphics Classes</a>, and <a href="images.html">Image Processing Classes</a>.
|
||
13 years ago
|
|
||
|
<hr><h2>Member Type Documentation</h2>
|
||
|
<h3 class=fn><a name="TransformationMode-enum"></a>TQWMatrix::TransformationMode</h3>
|
||
|
|
||
|
<p> <!-- index transformation matrix -->
|
||
|
<p> TQWMatrix 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>TQWMatrix::Points</tt> - transformations are applied to the shape's points.
|
||
|
<li><tt>TQWMatrix::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>TQRect( 10, 20, 30, 40 )</tt> and a transformation matrix
|
||
|
<tt>TQWMatrix( 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="TQWMatrix"></a>TQWMatrix::TQWMatrix ()
|
||
|
</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="TQWMatrix-2"></a>TQWMatrix::TQWMatrix ( double m11, double m12, double m21, double m22, double dx, double 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>TQWMatrix::det () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the matrix's determinant.
|
||
|
|
||
|
<h3 class=fn>double <a name="dx"></a>TQWMatrix::dx () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the horizontal translation.
|
||
|
|
||
|
<h3 class=fn>double <a name="dy"></a>TQWMatrix::dy () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the vertical translation.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqwmatrix.html">TQWMatrix</a> <a name="invert"></a>TQWMatrix::invert ( bool * invertible = 0 ) const
|
||
13 years ago
|
</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>TQWMatrix::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>TQWMatrix::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>TQWMatrix::m11 () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the X scaling factor.
|
||
|
|
||
|
<h3 class=fn>double <a name="m12"></a>TQWMatrix::m12 () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the vertical shearing factor.
|
||
|
|
||
|
<h3 class=fn>double <a name="m21"></a>TQWMatrix::m21 () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the horizontal shearing factor.
|
||
|
|
||
|
<h3 class=fn>double <a name="m22"></a>TQWMatrix::m22 () const
|
||
|
</h3>
|
||
|
|
||
|
<p> Returns the Y scaling factor.
|
||
|
|
||
|
<h3 class=fn>void <a name="map"></a>TQWMatrix::map ( int x, int y, int * tx, int * 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>TQWMatrix::map ( double x, double y, double * tx, double * 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>
|
||
|
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqpoint.html">TQPoint</a> <a name="map-3"></a>TQWMatrix::map ( const <a href="tqpoint.html">TQPoint</a> & p ) const
|
||
13 years ago
|
</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>
|
||
|
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqrect.html">TQRect</a> <a name="map-4"></a>TQWMatrix::map ( const <a href="tqrect.html">TQRect</a> & r ) const
|
||
13 years ago
|
</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">TQWMatrix::mapRect</a>() instead.
|
||
|
<p> Note that this method does return the bounding rectangle of the <em>r</em>, when
|
||
|
shearing or rotations are used.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqpointarray.html">TQPointArray</a> <a name="map-5"></a>TQWMatrix::map ( const <a href="tqpointarray.html">TQPointArray</a> & a ) const
|
||
13 years ago
|
</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.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqregion.html">TQRegion</a> <a name="map-6"></a>TQWMatrix::map ( const <a href="tqregion.html">TQRegion</a> & r ) const
|
||
13 years ago
|
</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.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqrect.html">TQRect</a> <a name="mapRect"></a>TQWMatrix::mapRect ( const <a href="tqrect.html">TQRect</a> & rect ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns the transformed rectangle <em>rect</em>.
|
||
|
<p> The bounding rectangle is returned if rotation or shearing has
|
||
|
been specified.
|
||
5 months ago
|
<p> If you need to know the exact region <em>rect</em> maps to use <a href="tqsize.html#operator*-4">operator*</a>().
|
||
|
<p> <p>See also <a href="tqsize.html#operator*-4">operator*</a>().
|
||
13 years ago
|
|
||
|
<p>Example: <a href="xform-example.html#x1279">xform/xform.cpp</a>.
|
||
5 months ago
|
<h3 class=fn><a href="tqpointarray.html">TQPointArray</a> <a name="mapToPolygon"></a>TQWMatrix::mapToPolygon ( const <a href="tqrect.html">TQRect</a> & rect ) const
|
||
13 years ago
|
</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( TQPointArray( rect ) )</tt> is not always the same as
|
||
|
<tt>matrix.mapToPolygon( rect )</tt>.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqregion.html">TQRegion</a> <a name="mapToRegion"></a>TQWMatrix::mapToRegion ( const <a href="tqrect.html">TQRect</a> & rect ) const
|
||
13 years ago
|
</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">TQWMatrix::mapRect</a>().
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator!-eq"></a>TQWMatrix::operator!= ( const <a href="tqwmatrix.html">TQWMatrix</a> & m ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns TRUE if this matrix is not equal to <em>m</em>; otherwise returns FALSE.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqwmatrix.html">TQWMatrix</a> & <a name="operator*-eq"></a>TQWMatrix::operator*= ( const <a href="tqwmatrix.html">TQWMatrix</a> & m )
|
||
13 years ago
|
</h3>
|
||
|
Returns the result of multiplying this matrix by matrix <em>m</em>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>bool <a name="operator-eq-eq"></a>TQWMatrix::operator== ( const <a href="tqwmatrix.html">TQWMatrix</a> & m ) const
|
||
13 years ago
|
</h3>
|
||
|
Returns TRUE if this matrix is equal to <em>m</em>; otherwise returns FALSE.
|
||
|
|
||
|
<h3 class=fn>void <a name="reset"></a>TQWMatrix::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>().
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqwmatrix.html">TQWMatrix</a> & <a name="rotate"></a>TQWMatrix::rotate ( double a )
|
||
13 years ago
|
</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>.
|
||
5 months ago
|
<h3 class=fn><a href="tqwmatrix.html">TQWMatrix</a> & <a name="scale"></a>TQWMatrix::scale ( double sx, double sy )
|
||
13 years ago
|
</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>().
|
||
|
|
||
5 months ago
|
<p>Examples: <a href="canvas-example.html#x2956">canvas/canvas.cpp</a>, <a href="fileiconview-example.html#x876">fileiconview/tqfileiconview.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>.
|
||
13 years ago
|
<h3 class=fn>void <a name="setMatrix"></a>TQWMatrix::setMatrix ( double m11, double m12, double m21, double m22, double dx, double 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>.
|
||
|
|
||
5 months ago
|
<h3 class=fn>void <a name="setTransformationMode"></a>TQWMatrix::setTransformationMode ( <a href="tqwmatrix.html#TransformationMode-enum">TQWMatrix::TransformationMode</a> m )<tt> [static]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Sets the transformation mode that TQWMatrix and painter
|
||
|
transformations use to <em>m</em>.
|
||
|
<p> <p>See also <a href="#TransformationMode-enum">TQWMatrix::TransformationMode</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqwmatrix.html">TQWMatrix</a> & <a name="shear"></a>TQWMatrix::shear ( double sh, double sv )
|
||
13 years ago
|
</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>.
|
||
5 months ago
|
<h3 class=fn><a href="tqwmatrix.html#TransformationMode-enum">TransformationMode</a> <a name="transformationMode"></a>TQWMatrix::transformationMode ()<tt> [static]</tt>
|
||
13 years ago
|
</h3>
|
||
|
Returns the current transformation mode.
|
||
|
<p> <p>See also <a href="#TransformationMode-enum">TQWMatrix::TransformationMode</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqwmatrix.html">TQWMatrix</a> & <a name="translate"></a>TQWMatrix::translate ( double dx, double dy )
|
||
13 years ago
|
</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>
|
||
5 months ago
|
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-lt-lt"></a>operator<< ( <a href="tqdatastream.html">TQDataStream</a> & s, const <a href="tqwmatrix.html">TQWMatrix</a> & m )
|
||
13 years ago
|
</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 TQDataStream operators</a>.
|
||
|
|
||
5 months ago
|
<h3 class=fn><a href="tqdatastream.html">TQDataStream</a> & <a name="operator-gt-gt"></a>operator>> ( <a href="tqdatastream.html">TQDataStream</a> & s, <a href="tqwmatrix.html">TQWMatrix</a> & m )
|
||
13 years ago
|
</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 TQDataStream operators</a>.
|
||
|
|
||
|
<!-- eof -->
|
||
|
<hr><p>
|
||
|
This file is part of the <a href="index.html">TQt toolkit</a>.
|
||
|
Copyright © 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 © 2007
|
||
|
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
|
||
|
<td align=right><div align=right>TQt 3.3.8</div>
|
||
|
</table></div></address></body>
|
||
|
</html>
|