Scribus Developer Documentation - API
logo-pen

Scribus Developer Documentation - API

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 <QColor>
00032 #include <QFont>
00033 #include <QGlobalStatic>
00034 #include <QList>
00035 #include <QMatrix>
00036 #include <QPixmap>
00037 #include <QStack>
00038 
00039 #include "scribusapi.h"
00040 #include "scconfig.h"
00041 #include "fpoint.h"
00042 #include "fpointarray.h"
00043 #include "vgradientex.h"
00044 #include "sccolorshade.h"
00045 #include "scimage.h"
00046 
00047 class ScPattern;
00048 
00049 class SCRIBUS_API ScPainterExBase
00050 {
00051 protected:
00052     int m_capabilities;
00053     ScPainterExBase(void);
00054 public:
00055 
00056     virtual ~ScPainterExBase() {};
00057     enum FillMode { None, Solid, Gradient, Pattern };
00058     enum ColorMode { rgbMode = 1, cmykMode = 2 };
00059     enum ImageMode { cmykImages, rgbImages, rgbProofImages, rawImages };
00060     enum Capabilities{ basic = 0, transparencies = 1, patterns = 2 };
00061 
00062     virtual Capabilities capabilities() { return basic; }
00063     virtual bool hasCapability(Capabilities cap) { return ((m_capabilities & (int) cap) != 0); }
00064 
00065     virtual int supportedColorModes() = 0;
00066     virtual ColorMode preferredColorMode() = 0;
00067     virtual ImageMode imageMode() = 0;
00068     
00069     virtual void begin() = 0;
00070     virtual void end() = 0;
00071     virtual void clear() = 0;
00072     virtual void clear( ScColorShade& ) = 0;
00073 
00074     // matrix manipulation
00075     virtual void setWorldMatrix( const QMatrix & ) = 0;
00076     virtual const QMatrix worldMatrix() = 0;
00077     virtual void translate( double, double ) = 0;
00078     virtual void rotate( double ) = 0;
00079     virtual void scale( double, double ) = 0;
00080 
00081     // drawing
00082     virtual void moveTo( const double &, const double & ) = 0;
00083     virtual void lineTo( const double &, const double & ) = 0;
00084     virtual void curveTo( FPoint p1, FPoint p2, FPoint p3 ) = 0;
00085     virtual void newPath() = 0;
00086     virtual void fillTextPath() = 0;
00087     virtual void strokeTextPath() = 0;
00088     virtual void fillPath() = 0;
00089     virtual void strokePath() = 0;
00090     virtual void setFillRule( bool fillRule ) = 0;
00091     virtual bool fillRule()  = 0;
00092     virtual void setFillMode( int fill ) = 0;
00093     virtual int  fillMode() = 0;
00094     virtual void setGradient( VGradientEx::Type mode, FPoint orig, FPoint vec, FPoint foc = FPoint(0,0) ) = 0;
00095     virtual void setPattern ( ScPattern* pattern, QMatrix& patternTransform ) = 0;
00096     virtual void setClipPath() = 0;
00097 
00098     virtual void drawImage( ScImage *image, ScPainterExBase::ImageMode mode ) = 0;
00099     virtual void setupPolygon(FPointArray *points, bool closed = true) = 0;
00100     virtual void setupTextPolygon(FPointArray *points) = 0;
00101     virtual void drawPolygon() = 0;
00102     virtual void drawPolyLine() = 0;
00103     virtual void drawLine(FPoint start, FPoint end) = 0;
00104     virtual void drawRect(double, double, double, double) = 0;
00105 
00106     // pen + brush
00107     virtual ScColorShade pen() = 0;
00108     virtual ScColorShade brush() = 0;
00109     virtual void setPen( const ScColorShade &c ) = 0;
00110     virtual void setPen( const ScColorShade &c, double w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo ) = 0;
00111     virtual void setPenOpacity( double op ) = 0;
00112     virtual void setLineWidth( double w) = 0;
00113     virtual void setDash(const QList<double>& array, double ofs) = 0;
00114     virtual void setBrush( const ScColorShade & ) = 0;
00115     virtual void setBrushOpacity( double op ) = 0;
00116     virtual void setOpacity( double op ) = 0;
00117     virtual void setFont( const QFont &f ) = 0;
00118     virtual QFont font() = 0;
00119 
00120     // stack management
00121     virtual void save() = 0;
00122     virtual void restore() = 0;
00123 
00124     virtual void setRasterOp( int op ) = 0;
00125 
00126     VGradientEx m_fillGradient;
00127     VGradientEx m_strokeGradient;
00128     ScPattern*  m_pattern;
00129     QMatrix    m_patternTransform;
00130 };
00131 
00132 #endif
Created with personalized Doxygen. This is documentation for GPL software Scribus - Open Source Desktop Publishing.