F:/KPlato/koffice/libs/kwmf/kowmfwrite.h

Aller à la documentation de ce fichier.
00001 /* This file is part of the KDE libraries
00002    Copyright (c) 2003 thierry lorthiois (lorthioist@wanadoo.fr)
00003 
00004    This library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Library General Public
00006    License version 2 as published by the Free Software Foundation.
00007 
00008    This library is distributed in the hope that it will be useful,
00009    but WITHOUT ANY WARRANTY; without even the implied warranty of
00010    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011    Library General Public License for more details.
00012 
00013    You should have received a copy of the GNU Library General Public License
00014    along with this library; see the file COPYING.LIB.  If not, write to
00015    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00016  * Boston, MA 02110-1301, USA.
00017 */
00018 #ifndef _KOWMFWRITE_H_
00019 #define _KOWMFWRITE_H_
00020 
00021 #include <QPen>
00022 #include <QBrush>
00023 #include <QColor>
00024 #include <QFont>
00025 #include <QRect>
00026 #include <QBuffer>
00027 #include <qregion.h>
00028 #include <QString>
00029 #include <QMatrix>
00030 #include <QImage>
00031 #include <q3ptrlist.h>
00032 #include <q3pointarray.h>
00033 #include <koffice_export.h>
00034 #include <QPainter>
00035 class KoWmfWritePrivate;
00036 
00050 class KOWMF_EXPORT KoWmfWrite
00051 {
00052 public:
00053     KoWmfWrite( const QString& fileName );
00054     virtual ~KoWmfWrite();
00055 
00056 
00057     // -------------------------------------------------------------------------
00058     // virtual Painter
00059     // for a good documentation : check QPainter documentation
00063     bool  begin();
00067     bool  end();
00068     void  save();
00069     void  restore();
00070 
00076     void setDefaultDpi( int dpi );
00077 
00078     // Drawing tools
00079     void  setFont( const QFont& f );
00080     // the width of the pen is in logical coordinate
00081     void  setPen( const QPen& p );
00082     void  setBrush( const QBrush& b );
00083 
00084     // Drawing attributes/modes
00085     void  setBackgroundColor( const QColor& r );
00086     void  setBackgroundMode( Qt::BGMode );
00087     void  setCompositionMode( QPainter::CompositionMode );
00088 
00089     // Change logical Coordinate
00090     void  setWindow( int left, int top , int width, int height );
00091 
00092     // Clipping
00093     // the 'CoordinateMode' parameter is ommitted : always CoordPainter in wmf
00094     // not yet implemented
00095     void  setClipRegion( const QRegion& r );
00096     void  clipping( bool enable );
00097 
00098     // Graphics drawing functions
00099     void  moveTo( int left, int top );
00100     void  lineTo( int left, int top );
00101     void  drawRect( int left, int top, int width, int height );
00102     void  drawRoundRect( int left, int top, int width, int height, int = 25, int = 25 );
00103     void  drawEllipse( int left, int top, int width, int height );
00104     void  drawArc( int left, int top, int width, int height, int a, int alen );
00105     void  drawPie( int left, int top, int width, int height, int a, int alen );
00106     void  drawChord( int left, int top, int width, int height, int a, int alen );
00107     void  drawPolyline( const QPolygon& pa );
00108     void  drawPolygon( const QPolygon& pa, bool winding=false );
00109     // drawPolyPolygon draw the XOR of a list of polygons
00110     // listPa : list of polygons
00111     void  drawPolyPolygon( Q3PtrList<QPolygon>& listPa, bool winding=false );
00112     void  drawImage( int left, int top, const QImage &, int sx = 0, int sy = 0, int sw = -1, int sh = -1 );
00113 
00114     // Text drawing functions
00115     // rotation = the degrees of rotation in counterclockwise
00116     // not yet implemented
00117     void  drawText( int x, int y, int w, int h, int flags, const QString &s, double rotation );
00118 
00119 private:
00120     //-----------------------------------------------------------------------------
00121     // Utilities and conversion Qt --> Wmf
00122 
00124     void pointArray( const QPolygon& pa );
00125 
00127     quint32 winColor( QColor color );
00128 
00130     void angleToxy( int& xStart, int& yStart, int& xEnd, int& yEnd, int a, int alen );
00131 
00133     quint16 qtRasterToWin16( QPainter::CompositionMode op ) const;
00134     quint32 qtRasterToWin32( QPainter::CompositionMode op ) const;
00135 
00136 
00137 private:
00138     KoWmfWritePrivate *d;
00139 
00140 };
00141 
00142 #endif
00143 

Généré le Wed Nov 22 23:41:13 2006 pour KPlato par  doxygen 1.5.1-p1