Qt logo

qwmatrix.h


This is the verbatim text of the qwmatrix.h include file. It is is provided only for illustration; the copyright remains with Troll Tech.
/****************************************************************************
** $Id: qwmatrix.h,v 2.4.2.2 1998/08/25 09:20:53 hanord Exp $
**
** Definition of QWMatrix class
**
** Created : 941020
**
** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
**
** This file is part of Troll Tech's internal development tree for Qt.
**
** This header text will be replaced by an appropriate text by the
** mkdist script which generates external distributions.
**
** If you are using the Qt Professional Edition or the Qt Free Edition,
** please notify Troll Tech at <info@troll.no> if you see this text.
**
** To Troll Tech developers: This header was generated by the script
** fixcopyright-int. It has the same number of text lines as the free
** and professional editions to avoid line number inconsistency.
**
*****************************************************************************/

#ifndef QWMATRIX_H
#define QWMATRIX_H

#ifndef QT_H
#include "qwindowdefs.h"
#include "qpointarray.h"
#include "qrect.h"
#endif // QT_H


class Q_EXPORT QWMatrix                                 // 2D transform matrix
{
public:
    QWMatrix();
    QWMatrix( float m11, float m12, float m21, float m22,
              float dx,  float dy );

    void        setMatrix( float m11, float m12, float m21, float m22,
                           float dx,  float dy );

    float       m11() const { return _m11; }
    float       m12() const { return _m12; }
    float       m21() const { return _m21; }
    float       m22() const { return _m22; }
    float       dx()  const { return _dx; }
    float       dy()  const { return _dy; }

    void        map( int x, int y, int *tx, int *ty )         const;
    void        map( float x, float y, float *tx, float *ty ) const;
    QPoint      map( const QPoint & )   const;
    QRect       map( const QRect & )    const;
    QPointArray map( const QPointArray & ) const;

    void        reset();

    QWMatrix   &translate( float dx, float dy );
    QWMatrix   &scale( float sx, float sy );
    QWMatrix   &shear( float sh, float sv );
    QWMatrix   &rotate( float a );

    QWMatrix    invert( bool * = 0 ) const;

    bool        operator==( const QWMatrix & ) const;
    bool        operator!=( const QWMatrix & ) const;
    QWMatrix   &operator*=( const QWMatrix & );

private:
    QWMatrix   &bmul( const QWMatrix & );
    float       _m11, _m12;
    float       _m21, _m22;
    float       _dx,  _dy;
};


Q_EXPORT QWMatrix operator*( const QWMatrix &, const QWMatrix & );


/*****************************************************************************
  QWMatrix stream functions
 *****************************************************************************/

Q_EXPORT QDataStream &operator<<( QDataStream &, const QWMatrix & );
Q_EXPORT QDataStream &operator>>( QDataStream &, QWMatrix & );


#endif // QWMATRIX_H


Copyright © 1998 Troll TechTrademarks
Qt version 1.41