karbon

vpainter.h
1/* This file is part of the KDE project
2 Copyright (C) 2001, The Karbon Developers
3 Copyright (C) 2002, The Karbon Developers
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
19
20*/
21
22#ifndef __VPAINTER_H__
23#define __VPAINTER_H__
24
25// painter abstraction
26
27#include <tqnamespace.h>
28#include <KoRect.h>
29#include <vfillrule.h>
30
31class TQWMatrix;
32class TQPaintDevice;
33class TQColor;
34class TQPen;
35class TQBrush;
36class TQImage;
37
38class VStroke;
39class VFill;
40
41class KoPoint;
42class KoRect;
43
44class VPainter
45{
46public:
47 VPainter( TQPaintDevice *, unsigned int /*w*/ = 0, unsigned int /*h*/ = 0 ) {};
48 virtual ~VPainter() {};
49
50 //
51 virtual void resize( unsigned int w, unsigned int h ) = 0;
52 virtual void begin() = 0;
53 virtual void end() = 0;
54 virtual void blit( const KoRect & ) = 0;
55 virtual void clear( const TQColor & ) = 0;
56 virtual void clear( const KoRect &, const TQColor & ) = 0;
57
58 // matrix manipulation
59 virtual void setWorldMatrix( const TQWMatrix & ) = 0;
60 virtual const TQWMatrix worldMatrix() = 0;
61 virtual void setZoomFactor( double ) = 0;
62 virtual double zoomFactor() { return 1.0; }
63
64 // drawing
65 virtual void moveTo( const KoPoint & ) = 0;
66 virtual void lineTo( const KoPoint & ) = 0;
67 virtual void curveTo( const KoPoint &, const KoPoint &, const KoPoint & ) = 0;
68 virtual void newPath() = 0;
69 virtual void strokePath() = 0;
70 virtual void fillPath() = 0;
71 virtual void setFillRule( VFillRule ) = 0;
72 virtual void setClipPath() = 0;
73 virtual void resetClipPath() = 0;
74
75 // helper
76 virtual void drawNode( const KoPoint& , int ) {}
77 virtual void drawRect( const KoRect & ) {}
78 virtual void drawRect( double, double, double, double ) {}
79
80 // pen + brush
81 virtual void setPen( const VStroke & ) = 0;
82 // compatibility, use VPen/VBrush later ?
83 virtual void setPen( const TQColor & ) = 0;
84 virtual void setPen( TQt::PenStyle style ) = 0;
85 virtual void setBrush( const VFill & ) = 0;
86 virtual void setBrush( const TQColor & ) = 0;
87 virtual void setBrush( TQt::BrushStyle style ) = 0;
88
89 virtual void drawImage( const TQImage &, const TQWMatrix & ) {}
90
91 // stack management
92 virtual void save() = 0;
93 virtual void restore() = 0;
94
95 // we have to see how this fits in
96 virtual void setRasterOp( TQt::RasterOp ) = 0;
97
98 // access to device
99 virtual TQPaintDevice *device() = 0;
100};
101
102#endif
Manages the fill of shapes.
Definition vfill.h:45
Manages stroke properties.
Definition vstroke.h:49