Eneboo - Documentación para desarrolladores
src/qt/src/kernel/qwmatrix.h
Ir a la documentación de este archivo.
00001 /****************************************************************************
00002 ** $Id: qt/qwmatrix.h   3.3.8   edited Jan 11 14:38 $
00003 **
00004 ** Definition of QWMatrix class
00005 **
00006 ** Created : 941020
00007 **
00008 ** Copyright (C) 1992-2007 Trolltech ASA.  All rights reserved.
00009 **
00010 ** This file is part of the kernel module of the Qt GUI Toolkit.
00011 **
00012 ** This file may be distributed under the terms of the Q Public License
00013 ** as defined by Trolltech ASA of Norway and appearing in the file
00014 ** LICENSE.QPL included in the packaging of this file.
00015 **
00016 ** This file may be distributed and/or modified under the terms of the
00017 ** GNU General Public License version 2 as published by the Free Software
00018 ** Foundation and appearing in the file LICENSE.GPL included in the
00019 ** packaging of this file.
00020 **
00021 ** Licensees holding valid Qt Enterprise Edition or Qt Professional Edition
00022 ** licenses may use this file in accordance with the Qt Commercial License
00023 ** Agreement provided with the Software.
00024 **
00025 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
00026 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
00027 **
00028 ** See http://www.trolltech.com/pricing.html or email sales@trolltech.com for
00029 **   information about Qt Commercial License Agreements.
00030 ** See http://www.trolltech.com/qpl/ for QPL licensing information.
00031 ** See http://www.trolltech.com/gpl/ for GPL licensing information.
00032 **
00033 ** Contact info@trolltech.com if any conditions of this licensing are
00034 ** not clear to you.
00035 **
00036 **********************************************************************/
00037 
00038 #ifndef QWMATRIX_H
00039 #define QWMATRIX_H
00040 
00041 #ifndef QT_H
00042 #include "qwindowdefs.h"
00043 #include "qpointarray.h"
00044 #include "qrect.h"
00045 #include "qregion.h"
00046 #endif // QT_H
00047 
00048 #ifndef QT_NO_WMATRIX
00049 
00050 
00051 class Q_EXPORT QWMatrix                                 // 2D transform matrix
00052 {
00053 public:
00054     QWMatrix();
00055     QWMatrix( double m11, double m12, double m21, double m22,
00056               double dx, double dy );
00057 
00058     void        setMatrix( double m11, double m12, double m21, double m22,
00059                            double dx,  double dy );
00060 
00061     double      m11() const { return _m11; }
00062     double      m12() const { return _m12; }
00063     double      m21() const { return _m21; }
00064     double      m22() const { return _m22; }
00065     double      dx()  const { return _dx; }
00066     double      dy()  const { return _dy; }
00067 
00068     void        map( int x, int y, int *tx, int *ty )         const;
00069     void        map( double x, double y, double *tx, double *ty ) const;
00070     QRect       mapRect( const QRect & )        const;
00071 
00072     QPoint      map( const QPoint &p )  const { return operator *( p ); }
00073     QRect       map( const QRect &r )   const { return mapRect ( r ); }
00074     QPointArray map( const QPointArray &a ) const { return operator * ( a ); }
00075     QRegion     map( const QRegion &r ) const { return operator *( r ); }
00076     QRegion     mapToRegion( const QRect &r ) const { return operator *( r ); }
00077     QPointArray mapToPolygon( const QRect &r )  const;
00078 
00079     void        reset();
00080     bool        isIdentity() const;
00081 
00082     QWMatrix   &translate( double dx, double dy );
00083     QWMatrix   &scale( double sx, double sy );
00084     QWMatrix   &shear( double sh, double sv );
00085     QWMatrix   &rotate( double a );
00086 
00087     bool isInvertible() const { return (_m11*_m22 - _m12*_m21) != 0; }
00088     double det() const { return _m11*_m22 - _m12*_m21; }
00089 
00090     QWMatrix    invert( bool * = 0 ) const;
00091 
00092     bool        operator==( const QWMatrix & ) const;
00093     bool        operator!=( const QWMatrix & ) const;
00094     QWMatrix   &operator*=( const QWMatrix & );
00095 
00096     /* we use matrix multiplication semantics here */
00097     QPoint operator * (const QPoint & ) const;
00098     QRegion operator * (const QRect & ) const;
00099     QRegion operator * (const QRegion & ) const;
00100     QPointArray operator *  ( const QPointArray &a ) const;
00101 
00102     enum TransformationMode {
00103         Points, Areas
00104     };
00105     static void setTransformationMode( QWMatrix::TransformationMode m );
00106     static TransformationMode transformationMode();
00107 private:
00108     double      _m11, _m12;
00109     double      _m21, _m22;
00110     double      _dx,  _dy;
00111 };
00112 
00113 Q_EXPORT QWMatrix operator*( const QWMatrix &, const QWMatrix & );
00114 
00115 
00116 /*****************************************************************************
00117   QWMatrix stream functions
00118  *****************************************************************************/
00119 
00120 Q_EXPORT QDataStream &operator<<( QDataStream &, const QWMatrix & );
00121 Q_EXPORT QDataStream &operator>>( QDataStream &, QWMatrix & );
00122 
00123 
00124 #endif // QT_NO_WMATRIX
00125 
00126 #endif // QWMATRIX_H
 Todo Clases Namespaces Archivos Funciones Variables 'typedefs' Enumeraciones Valores de enumeraciones Propiedades Amigas 'defines'