lib

kowmfwrite.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 _KOWMFWRITE_H_
19#define _KOWMFWRITE_H_
20
21#include <tqpen.h>
22#include <tqbrush.h>
23#include <tqcolor.h>
24#include <tqfont.h>
25#include <tqrect.h>
26#include <tqbuffer.h>
27#include <tqregion.h>
28#include <tqstring.h>
29#include <tqwmatrix.h>
30#include <tqimage.h>
31#include <tqptrlist.h>
32#include <tqpointarray.h>
33#include <koffice_export.h>
34class KoWmfWritePrivate;
35
49class KOWMF_EXPORT KoWmfWrite
50{
51public:
52 KoWmfWrite( const TQString& fileName );
53 virtual ~KoWmfWrite();
54
55
56 // -------------------------------------------------------------------------
57 // virtual Painter
58 // for a good documentation : check TQPainter documentation
62 bool begin();
66 bool end();
67 void save();
68 void restore();
69
75 void setDefaultDpi( int dpi );
76
77 // Drawing tools
78 void setFont( const TQFont& f );
79 // the width of the pen is in logical coordinate
80 void setPen( const TQPen& p );
81 void setBrush( const TQBrush& b );
82
83 // Drawing attributes/modes
84 void setBackgroundColor( const TQColor& r );
85 void setBackgroundMode( TQt::BGMode );
86 void setRasterOp( TQt::RasterOp );
87
88 // Change logical Coordinate
89 void setWindow( int left, int top , int width, int height );
90
91 // Clipping
92 // the 'CoordinateMode' parameter is ommitted : always CoordPainter in wmf
93 // not yet implemented
94 void setClipRegion( const TQRegion& r );
95 void clipping( bool enable );
96
97 // Graphics drawing functions
98 void moveTo( int left, int top );
99 void lineTo( int left, int top );
100 void drawRect( int left, int top, int width, int height );
101 void drawRoundRect( int left, int top, int width, int height, int = 25, int = 25 );
102 void drawEllipse( int left, int top, int width, int height );
103 void drawArc( int left, int top, int width, int height, int a, int alen );
104 void drawPie( int left, int top, int width, int height, int a, int alen );
105 void drawChord( int left, int top, int width, int height, int a, int alen );
106 void drawPolyline( const TQPointArray& pa );
107 void drawPolygon( const TQPointArray& pa, bool winding=false );
108 // drawPolyPolygon draw the XOR of a list of polygons
109 // listPa : list of polygons
110 void drawPolyPolygon( TQPtrList<TQPointArray>& listPa, bool winding=false );
111 void drawImage( int left, int top, const TQImage &, int sx = 0, int sy = 0, int sw = -1, int sh = -1 );
112
113 // Text drawing functions
114 // rotation = the degrees of rotation in counterclockwise
115 // not yet implemented
116 void drawText( int x, int y, int w, int h, int flags, const TQString &s, double rotation );
117
118private:
119 //-----------------------------------------------------------------------------
120 // Utilities and conversion TQt --> Wmf
121
123 void pointArray( const TQPointArray& pa );
124
126 TQ_UINT32 winColor( TQColor color );
127
129 void angleToxy( int& xStart, int& yStart, int& xEnd, int& yEnd, int a, int alen );
130
132 TQ_UINT16 qtRasterToWin16( TQt::RasterOp op ) const;
133 TQ_UINT32 qtRasterToWin32( TQt::RasterOp op ) const;
134
135
136private:
137 KoWmfWritePrivate *d;
138
139};
140
141#endif
142
KoWmfWrite allows to create a windows placeable meta file (WMF).
Definition kowmfwrite.h:50