📄 qwmatrix.3qt
字号:
.PPQPainter 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 QPainter::setWorldMatrix() if you want to perform more than a single transform operation..PPSee also QPainter::setWorldMatrix(), QPixmap::xForm(), Graphics Classes, and Image Processing Classes..SS "Member Type Documentation".SH "QWMatrix::TransformationMode".PPQWMatrix offers two transformation modes. Calculations can either be done in terms of points (Points mode, the default), or in terms of area (Area mode)..PPIn 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..TP\fCQWMatrix::Points\fR - transformations are applied to the shape's points..TP\fCQWMatrix::Areas\fR - transformations are applied (e.g. to the width and height) so that the area is transformed..PPExample:.PPSuppose we have a rectangle, \fCQRect( 10, 20, 30, 40 )\fR and a transformation matrix \fCQWMatrix( 2, 0, 0, 2, 0, 0 )\fR to double the rectangle's size..PPIn 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..PPIn 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..PPBecause 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..PPUnder Points mode, \fCmatrix * ( region1 | region2 )\fR is not equal to \fCmatrix * region1 | matrix * region2\fR. Under Area mode, \fCmatrix * (pointarray[i])\fR is not neccesarily equal to \fC(matrix * pointarry)[i]\fR..PP<center>.ce 1.B "[Image Omitted]".PP</center>.SH MEMBER FUNCTION DOCUMENTATION.SH "QWMatrix::QWMatrix ()"Constructs an identity matrix. All elements are set to zero except \fIm11\fR and \fIm22\fR (scaling), which are set to 1..SH "QWMatrix::QWMatrix ( double m11, double m12, double m21, double m22, double dx, double dy )"Constructs a matrix with the elements, \fIm11\fR, \fIm12\fR, \fIm21\fR, \fIm22\fR, \fIdx\fR and \fIdy\fR..SH "double QWMatrix::det () const"Returns the matrix's determinant..SH "double QWMatrix::dx () const"Returns the horizontal translation..SH "double QWMatrix::dy () const"Returns the vertical translation..SH "QWMatrix QWMatrix::invert ( bool * invertible = 0 ) const"Returns the inverted matrix..PPIf the matrix is singular (not invertible), the identity matrix is returned..PPIf \fIinvertible\fR is not 0: the value of \fI*invertible\fR is set to TRUE if the matrix is invertible; otherwise \fI*invertible\fR is set to FALSE..PPSee also isInvertible()..PPExample: t14/cannon.cpp..SH "bool QWMatrix::isIdentity () const"Returns TRUE if the matrix is the identity matrix; otherwise returns FALSE..PPSee also reset()..SH "bool QWMatrix::isInvertible () const"Returns TRUE if the matrix is invertible; otherwise returns FALSE..PPSee also invert()..SH "double QWMatrix::m11 () const"Returns the X scaling factor..SH "double QWMatrix::m12 () const"Returns the vertical shearing factor..SH "double QWMatrix::m21 () const"Returns the horizontal shearing factor..SH "double QWMatrix::m22 () const"Returns the Y scaling factor..SH "void QWMatrix::map ( int x, int y, int * tx, int * ty ) const"Transforms ( \fIx\fR, \fIy\fR ) to ( \fI*tx\fR, \fI*ty\fR ) using the formulae:.PP.nf.br *tx = m11*x + m21*y + dx (rounded to the nearest integer).br *ty = m22*y + m12*x + dy (rounded to the nearest integer).br.fi.PPExamples:.)l t14/cannon.cpp and xform/xform.cpp..SH "void QWMatrix::map ( double x, double y, double * tx, double * ty ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPTransforms ( \fIx\fR, \fIy\fR ) to ( \fI*tx\fR, \fI*ty\fR ) using the following formulae:.PP.nf.br *tx = m11*x + m21*y + dx.br *ty = m22*y + m12*x + dy.br.fi.SH "QPoint QWMatrix::map ( const QPoint & p ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPTransforms \fIp\fR to using the formulae:.PP.nf.br retx = m11*px + m21*py + dx (rounded to the nearest integer).br rety = m22*py + m12*px + dy (rounded to the nearest integer).br.fi.SH "QRect QWMatrix::map ( const QRect & r ) const"\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code..PPPlease use QWMatrix::mapRect() instead..PPNote that this method does return the bounding rectangle of the \fIr\fR, when shearing or rotations are used..SH "QPointArray QWMatrix::map ( const QPointArray & a ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPReturns the point array \fIa\fR transformed by calling map for each point..SH "QRegion QWMatrix::map ( const QRegion & r ) const"This is an overloaded member function, provided for convenience. It behaves essentially like the above function..PPTransforms the region \fIr\fR..PPCalling this method can be rather expensive, if rotations or shearing are used..SH "QRect QWMatrix::mapRect ( const QRect & rect ) const"Returns the transformed rectangle \fIrect\fR..PPThe bounding rectangle is returned if rotation or shearing has been specified..PPIf you need to know the exact region \fIrect\fR maps to use operator*()..PPSee also operator*()..SH "QPointArray QWMatrix::mapToPolygon ( const QRect & rect ) const"Returns the transformed rectangle \fIrect\fR as a polygon..PPPolygons and rectangles behave slightly differently when transformed (due to integer rounding), so \fCmatrix.map( QPointArray( rect ) )\fR is not always the same as \fCmatrix.mapToPolygon( rect )\fR..SH "QRegion QWMatrix::mapToRegion ( const QRect & rect ) const"Returns the transformed rectangle \fIrect\fR..PPA rectangle which has been rotated or sheared may result in a non-rectangular region being returned..PPCalling 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 mapRect() which is a lot faster than this function..PPSee also QWMatrix::mapRect()..SH "bool QWMatrix::operator!= ( const QWMatrix & m ) const"Returns TRUE if this matrix is not equal to \fIm\fR; otherwise returns FALSE..SH "QWMatrix & QWMatrix::operator*= ( const QWMatrix & m )"Returns the result of multiplying this matrix by matrix \fIm\fR..SH "bool QWMatrix::operator== ( const QWMatrix & m ) const"Returns TRUE if this matrix is equal to \fIm\fR; otherwise returns FALSE..SH "void QWMatrix::reset ()"Resets the matrix to an identity matrix..PPAll elements are set to zero, except \fIm11\fR and \fIm22\fR (scaling) which are set to 1..PPSee also isIdentity()..SH "QWMatrix & QWMatrix::rotate ( double a )"Rotates the coordinate system \fIa\fR degrees counterclockwise..PPReturns a reference to the matrix..PPSee also translate(), scale(), and shear()..PPExamples:.)l canvas/canvas.cpp, desktop/desktop.cpp, drawdemo/drawdemo.cpp, t14/cannon.cpp, and xform/xform.cpp..SH "QWMatrix & QWMatrix::scale ( double sx, double sy )"Scales the coordinate system unit by \fIsx\fR horizontally and \fIsy\fR vertically..PPReturns a reference to the matrix..PPSee also translate(), shear(), and rotate()..PPExamples:.)l canvas/canvas.cpp, fileiconview/qfileiconview.cpp, movies/main.cpp, qmag/qmag.cpp, showimg/showimg.cpp, and xform/xform.cpp..SH "void QWMatrix::setMatrix ( double m11, double m12, double m21, double m22, double dx, double dy )"Sets the matrix elements to the specified values, \fIm11\fR, \fIm12\fR, \fIm21\fR, \fIm22\fR, \fIdx\fR and \fIdy\fR..SH "void QWMatrix::setTransformationMode ( QWMatrix::TransformationMode m )\fC [static]\fR"Sets the transformation mode that QWMatrix and painter transformations use to \fIm\fR..PPSee also QWMatrix::TransformationMode..SH "QWMatrix & QWMatrix::shear ( double sh, double sv )"Shears the coordinate system by \fIsh\fR horizontally and \fIsv\fR vertically..PPReturns a reference to the matrix..PPSee also translate(), scale(), and rotate()..PPExamples:.)l drawdemo/drawdemo.cpp and xform/xform.cpp..SH "TransformationMode QWMatrix::transformationMode ()\fC [static]\fR"Returns the current transformation mode..PPSee also QWMatrix::TransformationMode..SH "QWMatrix & QWMatrix::translate ( double dx, double dy )"Moves the coordinate system \fIdx\fR along the X-axis and \fIdy\fR along the Y-axis..PPReturns a reference to the matrix..PPSee also scale(), shear(), and rotate()..PPExamples:.)l canvas/canvas.cpp, drawdemo/drawdemo.cpp, t14/cannon.cpp, and xform/xform.cpp..SH RELATED FUNCTION DOCUMENTATION.SH "QDataStream & operator<< ( QDataStream & s, const QWMatrix & m )"Writes the matrix \fIm\fR to the stream \fIs\fR and returns a reference to the stream..PPSee also Format of the QDataStream operators..SH "QDataStream & operator>> ( QDataStream & s, QWMatrix & m )"Reads the matrix \fIm\fR from the stream \fIs\fR and returns a reference to the stream..PPSee also Format of the QDataStream operators..SH "SEE ALSO".BR http://doc.trolltech.com/qwmatrix.html.BR http://www.trolltech.com/faq/tech.html.SH COPYRIGHTCopyright 1992-2001 Trolltech AS, http://www.trolltech.com. See thelicense file included in the distribution for a complete licensestatement..SH AUTHORGenerated automatically from the source code..SH BUGSIf you find a bug in Qt, please report it as described in.BR http://doc.trolltech.com/bughowto.html .Good bug reports help us to help you. Thank you..PThe definitive Qt documentation is provided in HTML format; it islocated at $QTDIR/doc/html and can be read using Qt Assistant or witha web browser. This man page is provided as a convenience for thoseusers who prefer man pages, although this format is not officiallysupported by Trolltech. .PIf you find errors in this manual page, please report them to.BR qt-bugs@trolltech.com .Please include the name of the manual page (qwmatrix.3qt) and the Qtversion (3.1.1).
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -