00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef qwmf_h
00020 #define qwmf_h
00021
00022 #include <QString>
00023 #include <QPainter>
00024 #include <QMatrix>
00025 #include <q3pointarray.h>
00026 #include <QPen>
00027 #include <QColor>
00028 #include <QImage>
00029 #include <QRect>
00030
00031 class QBuffer;
00032 class QString;
00033 class WmfCmd;
00034 class WinObjHandle;
00035 class WinObjPenHandle;
00036 class WinObjBrushHandle;
00037 struct WmfPlaceableHeader;
00038
00051 class QWinMetaFile
00052 {
00053 public:
00054 QWinMetaFile();
00055 virtual ~QWinMetaFile();
00056
00061 virtual bool load( const QString &fileName );
00062 virtual bool load( QBuffer &buffer );
00063
00071 virtual bool paint( QPaintDevice* target, bool absolute=false );
00072
00076 bool isPlaceable( void ) const { return mIsPlaceable; }
00077
00081 bool isEnhanced( void ) const { return mIsEnhanced; }
00082
00086 QRect bbox( void ) const { return mBBox; }
00087
00088 public:
00089
00090
00092 void setWindowOrg( long num, short* parms );
00094 void setWindowExt( long num, short* parms );
00095
00096
00098 void lineTo( long num, short* parms );
00100 void moveTo( long num, short* parms );
00102 void ellipse( long num, short* parms );
00104 void polygon( long num, short* parms );
00106 void polyPolygon( long num, short* parms );
00108 void polyline( long num, short* parms );
00110 void rectangle( long num, short* parms );
00112 void roundRect( long num, short* parms );
00114 void arc( long num, short* parms );
00116 void chord( long num, short* parms );
00118 void pie( long num, short* parms );
00120 void setPolyFillMode( long num, short* parms );
00122 void setBkColor( long num, short* parms );
00124 void setBkMode( long num, short* parms );
00126 void setPixel( long num, short* parms );
00128 void setRop( long num, short* parms );
00130 void saveDC( long num, short* parms );
00132 void restoreDC( long num, short* parms );
00134 void intersectClipRect( long num, short* parms );
00136 void excludeClipRect( long num, short* parms );
00137
00138
00140 void setTextColor( long num, short* parms );
00142 void setTextAlign( long num, short* parms );
00144 void textOut( long num, short* parms );
00145 void extTextOut( long num, short* parms );
00146
00147
00149 void dibBitBlt( long num, short* parms );
00151 void dibStretchBlt( long num, short* parms );
00152 void stretchDib( long num, short* parms );
00154 void dibCreatePatternBrush( long num, short* parms );
00155
00156
00158 void selectObject( long num, short* parms );
00160 void deleteObject( long num, short* parms );
00162 void createEmptyObject( long num, short* parms );
00164 void createBrushIndirect( long num, short* parms );
00166 void createPenIndirect( long num, short* parms );
00168 void createFontIndirect( long num, short* parms );
00169
00170
00172 void noop( long , short* );
00174 void end( long , short* );
00176 int dpi( void ) const { return mDpi; }
00177
00178 protected:
00180 unsigned short calcCheckSum( WmfPlaceableHeader* );
00181
00184 virtual int findFunc( unsigned short aFunc ) const;
00185
00187 QPolygon* pointArray( short num, short* parms );
00188
00190 QColor color( short* parm );
00191
00193 unsigned int toDWord( short* parm );
00194
00196 void xyToAngle( int xStart, int yStart, int xEnd, int yEnd, int& angle, int& aLength );
00197
00199 void addHandle( WinObjHandle* );
00200 void deleteHandle( int );
00201
00203 QPainter::CompositionMode winToQtComposition( short parm ) const;
00204 QPainter::CompositionMode winToQtComposition( long parm ) const;
00205
00207 bool dibToBmp( QImage& bmp, const char* dib, long size);
00208
00209 protected:
00210 QPainter mPainter;
00211 bool mIsPlaceable, mIsEnhanced, mValid;
00212
00213
00214 bool mAbsoluteCoord;
00215 QMatrix mInternalWorldMatrix;
00216 QRect mHeaderBoundingBox;
00217 QRect mBBox;
00218
00219
00220 QColor mTextColor;
00221 int mTextAlign, mRotation;
00222 bool mWinding;
00223
00224 WmfCmd* mFirstCmd;
00225 WinObjHandle** mObjHandleTab;
00226 QPolygon mPoints;
00227 int mDpi;
00228 QPoint mLastPos;
00229 };
00230
00231 #endif