Back to index

scribus-ng  1.3.4.dfsg+svn20071115
scpainterexbase.h
Go to the documentation of this file.
00001 /*
00002 For general Scribus (>=1.3.2) copyright and licensing information please refer
00003 to the COPYING file provided with the program. Following this notice may exist
00004 a copyright and/or license notice that predates the release of Scribus 1.3.2
00005 for which a new license (GPL+exception) is in place.
00006 */
00007 /* This file is part of the KDE project
00008    Copyright (C) 2001, 2002, 2003 The Karbon Developers
00009 
00010    This library is free software; you can redistribute it and/or
00011    modify it under the terms of the GNU Library General Public
00012    License as published by the Free Software Foundation; either
00013    version 2 of the License, or (at your option) any later version.
00014 
00015    This library is distributed in the hope that it will be useful,
00016    but WITHOUT ANY WARRANTY; without even the implied warranty of
00017    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018    Library General Public License for more details.
00019 
00020    You should have received a copy of the GNU Library General Public License
00021    along with this library; see the file COPYING.LIB.  If not, write to
00022    the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00023    Boston, MA 02111-1307, USA.
00024 */
00025 /* Adapted for Scribus 22.08.2003 by Franz Schmid */
00026 /* Adapted for Scribus 15.01.2006 by Jean Ghali */
00027 
00028 #ifndef __SCPAINTEREXBASE_H__
00029 #define __SCPAINTEREXBASE_H__
00030 
00031 #include <qglobal.h>
00032 #include <qwmatrix.h>
00033 #include <qvaluelist.h>
00034 #include <qvaluestack.h>
00035 #include <qcolor.h>
00036 #include <qfont.h>
00037 #include <qpixmap.h>
00038 #include "scribusapi.h"
00039 #include "scconfig.h"
00040 #include "fpoint.h"
00041 #include "fpointarray.h"
00042 #include "vgradientex.h"
00043 #include "sccolorshade.h"
00044 #include "scimage.h"
00045 
00046 class SCRIBUS_API ScPainterExBase
00047 {
00048 protected:
00049        int m_capabilities;
00050        ScPainterExBase(void);
00051 public:
00052 
00053        virtual ~ScPainterExBase() {};
00054        enum FillMode { None, Solid, Gradient, Pattern };
00055        enum ColorMode { rgbMode = 1, cmykMode = 2 };
00056        enum ImageMode { cmykImages, rgbImages, rgbProofImages, rawImages };
00057        enum Capabilities{ basic = 0, transparencies = 1, patterns = 2 };
00058 
00059        virtual Capabilities capabilities() { return basic; }
00060        virtual bool hasCapability(Capabilities cap) { return ((m_capabilities & (int) cap) != 0); }
00061 
00062        virtual int supportedColorModes() = 0;
00063        virtual ColorMode preferredColorMode() = 0;
00064        virtual ImageMode imageMode() = 0;
00065        
00066        virtual void begin() = 0;
00067        virtual void end() = 0;
00068        virtual void clear() = 0;
00069        virtual void clear( ScColorShade& ) = 0;
00070 
00071        // matrix manipulation
00072        virtual void setWorldMatrix( const QWMatrix & ) = 0;
00073        virtual const QWMatrix worldMatrix() = 0;
00074        virtual void translate( double, double ) = 0;
00075        virtual void rotate( double ) = 0;
00076        virtual void scale( double, double ) = 0;
00077 
00078        // drawing
00079        virtual void moveTo( const double &, const double & ) = 0;
00080        virtual void lineTo( const double &, const double & ) = 0;
00081        virtual void curveTo( FPoint p1, FPoint p2, FPoint p3 ) = 0;
00082        virtual void newPath() = 0;
00083        virtual void fillTextPath() = 0;
00084        virtual void strokeTextPath() = 0;
00085        virtual void fillPath() = 0;
00086        virtual void strokePath() = 0;
00087        virtual void setFillRule( bool fillRule ) = 0;
00088        virtual bool fillRule()  = 0;
00089        virtual void setFillMode( int fill ) = 0;
00090        virtual int  fillMode() = 0;
00091        virtual void setGradient( VGradientEx::Type mode, FPoint orig, FPoint vec, FPoint foc = FPoint(0,0) ) = 0;
00092        virtual void setPattern ( ScPattern* pattern, QWMatrix& patternTransform ) = 0;
00093        virtual void setClipPath() = 0;
00094 
00095        virtual void drawImage( ScImage *image, ScPainterExBase::ImageMode mode ) = 0;
00096        virtual void setupPolygon(FPointArray *points, bool closed = true) = 0;
00097        virtual void setupTextPolygon(FPointArray *points) = 0;
00098        virtual void drawPolygon() = 0;
00099        virtual void drawPolyLine() = 0;
00100        virtual void drawLine(FPoint start, FPoint end) = 0;
00101        virtual void drawRect(double, double, double, double) = 0;
00102 
00103        // pen + brush
00104        virtual ScColorShade pen() = 0;
00105        virtual ScColorShade brush() = 0;
00106        virtual void setPen( const ScColorShade &c ) = 0;
00107        virtual void setPen( const ScColorShade &c, double w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo ) = 0;
00108        virtual void setPenOpacity( double op ) = 0;
00109        virtual void setLineWidth( double w) = 0;
00110        virtual void setDash(const QValueList<double>& array, double ofs) = 0;
00111        virtual void setBrush( const ScColorShade & ) = 0;
00112        virtual void setBrushOpacity( double op ) = 0;
00113        virtual void setOpacity( double op ) = 0;
00114        virtual void setFont( const QFont &f ) = 0;
00115        virtual QFont font() = 0;
00116 
00117        // stack management
00118        virtual void save() = 0;
00119        virtual void restore() = 0;
00120 
00121        virtual void setRasterOp( int op ) = 0;
00122 
00123        VGradientEx m_fillGradient;
00124        VGradientEx m_strokeGradient;
00125        ScPattern*  m_pattern;
00126        QWMatrix    m_patternTransform;
00127 };
00128 
00129 #endif