00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef CANVASPIXMAP_H
00022 #define CANVASPIXMAP_H
00023
00024 #include <qcanvas.h>
00025 #include <qwmatrix.h>
00026
00027 class QBitmap;
00028
00034 class CanvasPixmap : public QCanvasItem {
00035 public:
00036 typedef enum {
00037 none,
00038 anti90,
00039 anti180,
00040 anti270
00041 } eRotate;
00042
00043 CanvasPixmap(QCanvas * canvas);
00044
00045 ~CanvasPixmap();
00046
00047 virtual bool collidesWith ( const QCanvasItem * other ) const;
00048
00049 virtual void draw ( QPainter & painter );
00050
00051 virtual QRect boundingRect () const;
00052
00053 virtual bool collidesWith( const QCanvasSprite*,
00054 const QCanvasPolygonalItem*,
00055 const QCanvasRectangle*,
00056 const QCanvasEllipse*,
00057 const QCanvasText* ) const;
00058
00059 virtual int rtti () const;
00060
00061 void flipH ( void );
00062
00063 void flipV ( void );
00064
00065 int width ( void );
00066
00067 int height ( void );
00068
00069 void rotate ( void );
00070
00071 void setRotation ( eRotate orthoAngle );
00072
00073 eRotate rotation ( void );
00074
00075 QPixmap * pixmap ( void );
00076
00077 void setPixmap ( QPixmap * _pm );
00078
00079 protected:
00080 eRotate orthoAngle;
00081 bool bFlippedX;
00082 bool bFlippedY;
00083
00084 static QWMatrix wmFlipH;
00085 static QWMatrix wmFlipV;
00086 static QWMatrix wmOrtho [4];
00087
00088
00089 virtual void drawTransformed ( QPainter & painter );
00090 virtual void drawUntransformed ( QPainter & painter );
00091
00092 private:
00093 QPixmap * pm;
00094
00095 int iPixmapWidth;
00096 int iPixmapHeight;
00097 };
00098
00099 #endif