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.h>
00023 #include <qpainter.h>
00024 #include <qwmatrix.h>
00025 #include <qpointarray.h>
00026 #include <qpen.h>
00027 #include <qcolor.h>
00028 #include <qimage.h>
00029 #include <qrect.h>
00030
00031 class QBuffer;
00032 class QString;
00033 class WmfCmd;
00034 class WinObjHandle;
00035 class WinObjPenHandle;
00036 class WinObjBrushHandle;
00037 struct WmfPlaceableHeader;
00038
00052 class QWinMetaFile
00053 {
00054 public:
00055 QWinMetaFile();
00056 virtual ~QWinMetaFile();
00057
00062 virtual bool load( const QString &fileName );
00063 virtual bool load( QBuffer &buffer );
00064
00072 virtual bool paint( const QPaintDevice* target, bool absolute=false );
00073
00077 bool isPlaceable( void ) const { return mIsPlaceable; }
00078
00082 bool isEnhanced( void ) const { return mIsEnhanced; }
00083
00087 QRect bbox( void ) const { return mBBox; }
00088
00089 public:
00090
00091
00093 void setWindowOrg( long num, short* parms );
00095 void setWindowExt( long num, short* parms );
00096
00097
00099 void lineTo( long num, short* parms );
00101 void moveTo( long num, short* parms );
00103 void ellipse( long num, short* parms );
00105 void polygon( long num, short* parms );
00107 void polyPolygon( long num, short* parms );
00109 void polyline( long num, short* parms );
00111 void rectangle( long num, short* parms );
00113 void roundRect( long num, short* parms );
00115 void arc( long num, short* parms );
00117 void chord( long num, short* parms );
00119 void pie( long num, short* parms );
00121 void setPolyFillMode( long num, short* parms );
00123 void setBkColor( long num, short* parms );
00125 void setBkMode( long num, short* parms );
00127 void setPixel( long num, short* parms );
00129 void setRop( long num, short* parms );
00131 void saveDC( long num, short* parms );
00133 void restoreDC( long num, short* parms );
00135 void intersectClipRect( long num, short* parms );
00137 void excludeClipRect( long num, short* parms );
00138
00139
00141 void setTextColor( long num, short* parms );
00143 void setTextAlign( long num, short* parms );
00145 void textOut( long num, short* parms );
00146 void extTextOut( long num, short* parms );
00147
00148
00150 void dibBitBlt( long num, short* parms );
00152 void dibStretchBlt( long num, short* parms );
00153 void stretchDib( long num, short* parms );
00155 void dibCreatePatternBrush( long num, short* parms );
00156
00157
00159 void selectObject( long num, short* parms );
00161 void deleteObject( long num, short* parms );
00163 void createEmptyObject( long num, short* parms );
00165 void createBrushIndirect( long num, short* parms );
00167 void createPenIndirect( long num, short* parms );
00169 void createFontIndirect( long num, short* parms );
00170
00171
00173 void noop( long , short* );
00175 void end( long , short* );
00177 int dpi( void ) const { return mDpi; }
00178
00179 protected:
00181 unsigned short calcCheckSum( WmfPlaceableHeader* );
00182
00185 virtual int findFunc( unsigned short aFunc ) const;
00186
00188 QPointArray* pointArray( short num, short* parms );
00189
00191 QColor color( short* parm );
00192
00194 unsigned int toDWord( short* parm );
00195
00197 void xyToAngle( int xStart, int yStart, int xEnd, int yEnd, int& angle, int& aLength );
00198
00200 void addHandle( WinObjHandle* );
00201 void deleteHandle( int );
00202
00204 Qt::RasterOp winToQtRaster( short parm ) const;
00205 Qt::RasterOp winToQtRaster( long parm ) const;
00206
00208 bool dibToBmp( QImage& bmp, const char* dib, long size);
00209
00210 protected:
00211 QPainter mPainter;
00212 bool mIsPlaceable, mIsEnhanced, mValid;
00213
00214
00215 bool mAbsoluteCoord;
00216 QWMatrix mInternalWorldMatrix;
00217 QRect mHeaderBoundingBox;
00218 QRect mBBox;
00219
00220
00221 QColor mTextColor;
00222 int mTextAlign, mRotation;
00223 bool mWinding;
00224
00225 WmfCmd* mFirstCmd;
00226 WinObjHandle** mObjHandleTab;
00227 QPointArray mPoints;
00228 int mDpi;
00229 };
00230
00231 #endif