lib Library API Documentation

qwmf.h

00001 /* Windows Meta File Loader
00002  *
00003  * Copyright ( C ) 1998 Stefan Taferner
00004  * Modified 2002 thierry lorthiois
00005  *
00006  * This program is free software; you can redistribute it and/or modify it
00007  * under the terms of the GNU General Public License as published by the
00008  * Free Software Foundation; either version 2 of the License, or ( at your
00009  * option ) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful, but
00012  * WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABLILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00014  * General Public License for more details. You should have received a copy
00015  * of the GNU General Public License along with this program; if not, write
00016  * to the Free Software Foundation, Inc, 59 Temple Place - Suite 330, Boston, MA  02111-1307,
00017  * USA.
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: // should be protected but cannot
00090     /* Metafile painter methods */
00091 
00093     void setWindowOrg( long num, short* parms );
00095     void setWindowExt( long num, short* parms );
00096 
00097     /****************** Drawing *******************/
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     /****************** Text *******************/
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     /****************** Bitmap *******************/
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     /****************** Object handle *******************/
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     /****************** misc *******************/
00173     void noop( long , short* );
00175     void end( long /*num*/, short* /*parms*/ );
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     // coordinate system
00215     bool   mAbsoluteCoord;
00216     QWMatrix  mInternalWorldMatrix;   // memorisation of WMF matrix transformation
00217     QRect mHeaderBoundingBox;
00218     QRect mBBox;
00219 
00220     // information shared between Metafile Functions
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 /*qwmf_h*/
KDE Logo
This file is part of the documentation for lib Library Version 1.3.5.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Fri Mar 11 11:47:45 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003