home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qwmatrix.h.z / qwmatrix.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  2.6 KB  |  90 lines

  1. /****************************************************************************
  2. ** $Id: qwmatrix.h,v 2.4 1998/07/03 00:09:42 hanord Exp $
  3. **
  4. ** Definition of QWMatrix class
  5. **
  6. ** Created : 941020
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QWMATRIX_H
  25. #define QWMATRIX_H
  26.  
  27. #ifndef QT_H
  28. #include "qwindowdefs.h"
  29. #include "qpointarray.h"
  30. #include "qrect.h"
  31. #endif // QT_H
  32.  
  33.  
  34. class QWMatrix                    // 2D transform matrix
  35. {
  36. public:
  37.     QWMatrix();
  38.     QWMatrix( float m11, float m12, float m21, float m22,
  39.           float dx,     float dy );
  40.  
  41.     void    setMatrix( float m11, float m12, float m21, float m22,
  42.                float dx,  float dy );
  43.  
  44.     float    m11() const { return _m11; }
  45.     float    m12() const { return _m12; }
  46.     float    m21() const { return _m21; }
  47.     float    m22() const { return _m22; }
  48.     float    dx()  const { return _dx; }
  49.     float    dy()  const { return _dy; }
  50.  
  51.     void    map( int x, int y, int *tx, int *ty )          const;
  52.     void    map( float x, float y, float *tx, float *ty ) const;
  53.     QPoint    map( const QPoint & )    const;
  54.     QRect    map( const QRect & )    const;
  55.     QPointArray map( const QPointArray & ) const;
  56.  
  57.     void    reset();
  58.  
  59.     QWMatrix   &translate( float dx, float dy );
  60.     QWMatrix   &scale( float sx, float sy );
  61.     QWMatrix   &shear( float sh, float sv );
  62.     QWMatrix   &rotate( float a );
  63.  
  64.     QWMatrix    invert( bool * = 0 ) const;
  65.  
  66.     bool    operator==( const QWMatrix & ) const;
  67.     bool    operator!=( const QWMatrix & ) const;
  68.     QWMatrix   &operator*=( const QWMatrix & );
  69.  
  70. private:
  71.     QWMatrix   &bmul( const QWMatrix & );
  72.     float    _m11, _m12;
  73.     float    _m21, _m22;
  74.     float    _dx,  _dy;
  75. };
  76.  
  77.  
  78. QWMatrix operator*( const QWMatrix &, const QWMatrix & );
  79.  
  80.  
  81. /*****************************************************************************
  82.   QWMatrix stream functions
  83.  *****************************************************************************/
  84.  
  85. QDataStream &operator<<( QDataStream &, const QWMatrix & );
  86. QDataStream &operator>>( QDataStream &, QWMatrix & );
  87.  
  88.  
  89. #endif // QWMATRIX_H
  90.