karbon

vqpainter.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 #ifndef __VQPAINTER_H__
00022 #define __VQPAINTER_H__
00023 
00024 // qpainter wrapper
00025 
00026 #include "vpainter.h"
00027 #include "qpointarray.h"
00028 
00029 class QPainter;
00030 
00031 class VQPainter : public VPainter
00032 {
00033 public:
00034     VQPainter( QPaintDevice *target, unsigned int w = 0, unsigned int h = 0 );
00035     virtual ~VQPainter();
00036 
00037     //
00038     virtual void resize( unsigned int w, unsigned int h );
00039     virtual void begin();
00040     virtual void end();
00041     virtual void blit( const KoRect & );
00042     virtual void clear( const QColor & );
00043     virtual void clear( const KoRect &, const QColor & ) {}
00044 
00045     // matrix manipulation
00046     virtual void setWorldMatrix( const QWMatrix & );
00047     virtual const QWMatrix worldMatrix();
00048     virtual void setZoomFactor( double );
00049     virtual double zoomFactor() { return m_zoomFactor; }
00050 
00051     // drawing
00052     virtual void moveTo( const KoPoint & );
00053     virtual void lineTo( const KoPoint & );
00054     virtual void curveTo( const KoPoint &, const KoPoint &, const KoPoint & );
00055     virtual void newPath();
00056     virtual void strokePath();
00057     virtual void fillPath();
00058     virtual void setFillRule( VFillRule ) {}
00059     virtual void setClipPath() {}
00060     virtual void resetClipPath() {}
00061 
00062     // pen + brush
00063     virtual void setPen( const VStroke & );
00064     virtual void setPen( const QColor & );
00065     virtual void setPen( Qt::PenStyle style );
00066     virtual void setBrush( const VFill & );
00067     virtual void setBrush( const QColor & );
00068     virtual void setBrush( Qt::BrushStyle style );
00069 
00070     virtual void drawImage( const QImage &, const QWMatrix & );
00071 
00072     // stack management
00073     virtual void save();
00074     virtual void restore();
00075 
00076     // helper
00077     virtual void drawNode( const KoPoint& , int );
00078     virtual void drawRect( const KoRect & );
00079 
00080     //
00081     virtual void setRasterOp( Qt::RasterOp );
00082 
00083     virtual QPaintDevice *device() { return m_target; }
00084 
00085 private:
00086     double m_zoomFactor;
00087     unsigned int m_index;
00088     QPointArray m_pa;
00089     QPainter *m_painter;
00090     QPaintDevice *m_target;
00091     unsigned int m_width;
00092     unsigned int m_height;
00093 };
00094 
00095 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys