karbon

vpainter.h

00001 /* This file is part of the KDE project
00002    Copyright (C) 2001, The Karbon Developers
00003    Copyright (C) 2002, The Karbon Developers
00004 
00005    This library is free software; you can redistribute it and/or
00006    modify it under the terms of the GNU Library General Public
00007    License as published by the Free Software Foundation; either
00008    version 2 of the License, or (at your option) any later version.
00009 
00010    This library is distributed in the hope that it will be useful,
00011    but WITHOUT ANY WARRANTY; without even the implied warranty of
00012    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00013    Library General Public License for more details.
00014 
00015    You should have received a copy of the GNU Library General Public License
00016    along with this library; see the file COPYING.LIB.  If not, write to
00017    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00018  * Boston, MA 02110-1301, USA.
00019 
00020 */
00021 
00022 #ifndef __VPAINTER_H__
00023 #define __VPAINTER_H__
00024 
00025 // painter abstraction
00026 
00027 #include <qnamespace.h>
00028 #include <KoRect.h>
00029 #include <vfillrule.h>
00030 
00031 class QWMatrix;
00032 class QPaintDevice;
00033 class QColor;
00034 class QPen;
00035 class QBrush;
00036 class QImage;
00037 
00038 class VStroke;
00039 class VFill;
00040 
00041 class KoPoint;
00042 class KoRect;
00043 
00044 class VPainter
00045 {
00046 public:
00047     VPainter( QPaintDevice *, unsigned int /*w*/ = 0, unsigned int /*h*/ = 0 ) {};
00048     virtual ~VPainter() {};
00049 
00050     //
00051     virtual void resize( unsigned int w, unsigned int h ) = 0;
00052     virtual void begin() = 0;
00053     virtual void end() = 0;
00054     virtual void blit( const KoRect & ) = 0;
00055     virtual void clear( const QColor & ) = 0;
00056     virtual void clear( const KoRect &, const QColor & ) = 0;
00057 
00058     // matrix manipulation
00059     virtual void setWorldMatrix( const QWMatrix & ) = 0;
00060     virtual const QWMatrix worldMatrix() = 0;
00061     virtual void setZoomFactor( double ) = 0;
00062     virtual double zoomFactor() { return 1.0; }
00063 
00064     // drawing
00065     virtual void moveTo( const KoPoint & ) = 0;
00066     virtual void lineTo( const KoPoint & ) = 0;
00067     virtual void curveTo( const KoPoint &, const KoPoint &, const KoPoint & ) = 0;
00068     virtual void newPath() = 0;
00069     virtual void strokePath() = 0;
00070     virtual void fillPath() = 0;
00071     virtual void setFillRule( VFillRule ) = 0;
00072     virtual void setClipPath() = 0;
00073     virtual void resetClipPath() = 0;
00074 
00075     // helper
00076     virtual void drawNode( const KoPoint& , int ) {}
00077     virtual void drawRect( const KoRect & ) {}
00078     virtual void drawRect( double, double, double, double ) {}
00079 
00080     // pen + brush
00081     virtual void setPen( const VStroke & ) = 0;
00082     // compatibility, use VPen/VBrush later ?
00083     virtual void setPen( const QColor & ) = 0;
00084     virtual void setPen( Qt::PenStyle style ) = 0;
00085     virtual void setBrush( const VFill & ) = 0;
00086     virtual void setBrush( const QColor & ) = 0;
00087     virtual void setBrush( Qt::BrushStyle style ) = 0;
00088 
00089     virtual void drawImage( const QImage &, const QWMatrix & ) {}
00090 
00091     // stack management
00092     virtual void save() = 0;
00093     virtual void restore() = 0;
00094 
00095     // we have to see how this fits in
00096     virtual void setRasterOp( Qt::RasterOp ) = 0;
00097 
00098     // access to device
00099     virtual QPaintDevice *device() = 0;
00100 };
00101 
00102 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys