lib

kowmfpaint.h
1/* This file is part of the KDE libraries
2 * Copyright (c) 2003 thierry lorthiois (lorthioist@wanadoo.fr)
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License version 2 as published by the Free Software Foundation.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Library General Public License for more details.
12 *
13 * You should have received a copy of the GNU Library General Public License
14 * along with this library; see the file COPYING.LIB. If not, write to
15 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
16 * Boston, MA 02110-1301, USA.
17*/
18#ifndef _KOWMFPAINT_H_
19#define _KOWMFPAINT_H_
20
21#include <tqpainter.h>
22
23#include "kowmfread.h"
24#include <../kofficecore/koffice_export.h>
41
42class KOWMF_EXPORT KoWmfPaint : public KoWmfRead
43{
44public:
45 KoWmfPaint();
46 ~KoWmfPaint() { }
47
54 bool play( TQPaintDevice& target, bool relativeCoord=false );
55
56
57private:
58 // -------------------------------------------------------------------------
59 // A virtual TQPainter
60 bool begin();
61 bool end();
62 void save();
63 void restore();
64
65 // Drawing tools
66 void setFont( const TQFont& font );
67 // the pen : the width of the pen is in logical coordinate
68 void setPen( const TQPen& pen );
69 const TQPen& pen() const;
70 void setBrush( const TQBrush& brush );
71
72 // Drawing attributes/modes
73 void setBackgroundColor( const TQColor& c );
74 void setBackgroundMode( TQt::BGMode mode );
75 void setRasterOp( TQt::RasterOp op );
76
83 void setWindowOrg( int left, int top );
84 void setWindowExt( int width, int height );
85
86 // Clipping
87 // the 'CoordinateMode' is ommitted : always CoordPainter in wmf
88 // setClipRegion() is often used with save() and restore() => implement all or none
89 void setClipRegion( const TQRegion &rec );
90 TQRegion clipRegion();
91
92 // Graphics drawing functions
93 void moveTo( int x, int y );
94 void lineTo( int x, int y );
95 void drawRect( int x, int y, int w, int h );
96 void drawRoundRect( int x, int y, int w, int h, int = 25, int = 25 );
97 void drawEllipse( int x, int y, int w, int h );
98 void drawArc( int x, int y, int w, int h, int a, int alen );
99 void drawPie( int x, int y, int w, int h, int a, int alen );
100 void drawChord( int x, int y, int w, int h, int a, int alen );
101 void drawPolyline( const TQPointArray& pa );
102 void drawPolygon( const TQPointArray& pa, bool winding=false );
107 void drawPolyPolygon( TQPtrList<TQPointArray>& listPa, bool winding=false );
108 void drawImage( int x, int y, const TQImage &, int sx = 0, int sy = 0, int sw = -1, int sh = -1 );
109
110 // Text drawing functions
111 // rotation = the degrees of rotation in counterclockwise
112 // not yet implemented in KWinMetaFile
113 void drawText( int x, int y, int w, int h, int flags, const TQString &s, double rotation );
114
115 // matrix transformation : only used in some bitmap manipulation
116 void setWorldMatrix( const TQWMatrix &, bool combine=false );
117
118private:
119 TQPainter mPainter;
120 TQPaintDevice *mTarget;
121 bool mRelativeCoord;
122 // memorisation of WMF matrix transformation (in relative coordinate)
123 TQWMatrix mInternalWorldMatrix;
124
125};
126
127#endif
virtual bool play()
play the WMF file => call virtuals functions
Definition kowmfread.cpp:57