karbon
vkopainter.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __VKOPAINTER_H__
00021 #define __VKOPAINTER_H__
00022
00023
00024
00025 #include "vpainter.h"
00026 #include <qwmatrix.h>
00027 #include <qptrlist.h>
00028 #include <koffice_export.h>
00029 class QPainter;
00030 struct _ArtVpath;
00031 struct _ArtBpath;
00032 struct _ArtSVP;
00033 struct _ArtGradientStop;
00034 class VGradient;
00035 class VPattern;
00036 class KoRect;
00037
00038 class KARBONBASE_EXPORT VKoPainter : public VPainter
00039 {
00040 public:
00041 VKoPainter( QPaintDevice *target, unsigned int w = 0, unsigned int h = 0, bool = true );
00042 VKoPainter( unsigned char *buffer, unsigned int w = 0, unsigned int h = 0, bool = true );
00043 virtual ~VKoPainter();
00044
00045 virtual void resize( unsigned int w, unsigned int h );
00046 virtual void begin();
00047 virtual void end();
00048 virtual void blit( const KoRect & );
00049 void clear();
00050 virtual void clear( const QColor & );
00051 virtual void clear( const KoRect &, const QColor & );
00052
00053
00054 virtual void setWorldMatrix( const QWMatrix & );
00055 virtual const QWMatrix worldMatrix() { return m_matrix; }
00056 virtual void setZoomFactor( double );
00057 virtual double zoomFactor() { return m_zoomFactor; }
00058
00059
00060 virtual void moveTo( const KoPoint & );
00061 virtual void lineTo( const KoPoint & );
00062 virtual void curveTo( const KoPoint &, const KoPoint &, const KoPoint & );
00063 virtual void newPath();
00064 virtual void fillPath();
00065 virtual void setFillRule( VFillRule );
00066 virtual void strokePath();
00067 virtual void setClipPath();
00068 virtual void resetClipPath();
00069
00070
00071 virtual void drawNode( const KoPoint& p, int width );
00072 virtual void drawRect( const KoRect & );
00073 virtual void drawRect( double, double, double, double );
00074
00075
00076 virtual void setPen( const VStroke & );
00077 virtual void setPen( const QColor & );
00078 virtual void setPen( Qt::PenStyle style );
00079 virtual void setBrush( const VFill & );
00080 virtual void setBrush( const QColor & );
00081 virtual void setBrush( Qt::BrushStyle style );
00082
00083 virtual void drawImage( const QImage &, const QWMatrix & );
00084
00085
00086 virtual void save();
00087 virtual void restore();
00088
00089
00090 virtual void setRasterOp( Qt::RasterOp );
00091
00092 virtual QPaintDevice *device() { return m_target; }
00093 unsigned char *buffer() { return m_buffer; }
00094
00095 private:
00096 void drawVPath( struct _ArtVpath * );
00097 void applyGradient( _ArtSVP *, bool );
00098 void applyPattern( _ArtSVP *, bool );
00099 _ArtGradientStop *buildStopArray( VGradient &gradient, int & );
00100 void clampToViewport( const _ArtSVP &, int &, int &, int &, int & );
00101 void clampToViewport( int &, int &, int &, int & );
00102 void ensureSpace( unsigned int );
00103
00104 private:
00105 struct _ArtBpath *m_path;
00106 unsigned int m_index;
00107 unsigned int m_alloccount;
00108 unsigned char *m_buffer;
00109 QPaintDevice *m_target;
00110 unsigned int m_width;
00111 unsigned int m_height;
00112 QWMatrix m_matrix;
00113 VStroke *m_stroke;
00114 VFill *m_fill;
00115 VFillRule m_fillRule;
00116 double m_zoomFactor;
00117 QPtrList<_ArtSVP> m_clipPaths;
00118
00119 bool m_bDrawNodes;
00120
00121 GC gc;
00122 };
00123
00124 #endif
|