2
For general Scribus (>=1.3.2) copyright and licensing information please refer
3
to the COPYING file provided with the program. Following this notice may exist
4
a copyright and/or license notice that predates the release of Scribus 1.3.2
5
for which a new license (GPL+exception) is in place.
7
/* This file is part of the KDE project
8
Copyright (C) 2001, 2002, 2003 The Karbon Developers
10
This library is free software; you can redistribute it and/or
11
modify it under the terms of the GNU Library General Public
12
License as published by the Free Software Foundation; either
13
version 2 of the License, or (at your option) any later version.
15
This library is distributed in the hope that it will be useful,
16
but WITHOUT ANY WARRANTY; without even the implied warranty of
17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18
Library General Public License for more details.
20
You should have received a copy of the GNU Library General Public License
21
along with this library; see the file COPYING.LIB. If not, write to
22
the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23
Boston, MA 02111-1307, USA.
25
/* Adapted for Scribus 22.08.2003 by Franz Schmid */
26
/* Adapted for Scribus 15.01.2006 by Jean Ghali */
28
#ifndef __SCPAINTEREX_GDI_H__
29
#define __SCPAINTEREX_GDI_H__
35
#include <QGlobalStatic>
41
#include "scribusapi.h"
44
#include "fpointarray.h"
45
#include "vgradient.h"
47
#include "scpainterexbase.h"
55
// Typedef to use the GDI gradientFill function
56
typedef bool (STDAPICALLTYPE *gradientFillFunc) (HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG);
58
class SCRIBUS_API ScPainterEx_GDI : public ScPainterExBase
62
ScPainterEx_GDI(HDC hDC, QRect& rect, ScribusDoc* doc, bool gray );
63
virtual ~ScPainterEx_GDI();
65
virtual Capabilities capabilities() { return transparencies; }
67
virtual int supportedColorModes() { return (int) rgbMode; }
68
virtual ColorMode preferredColorMode() { return rgbMode; }
69
virtual ImageMode imageMode() { return rgbImages; }
74
virtual void clear( ScColorShade & );
76
// matrix manipulation
77
virtual void setWorldMatrix( const QMatrix & );
78
virtual const QMatrix worldMatrix();
79
virtual void translate( double, double );
80
virtual void rotate( double );
81
virtual void scale( double, double );
84
virtual void moveTo( const double &, const double & );
85
virtual void lineTo( const double &, const double & );
86
virtual void curveTo( FPoint p1, FPoint p2, FPoint p3 );
87
virtual void newPath();
88
virtual void fillTextPath();
89
virtual void strokeTextPath();
90
virtual void fillPath();
91
virtual void strokePath();
92
virtual void setFillRule( bool fillRule );
93
virtual bool fillRule() { return m_fillRule; }
94
virtual void setFillMode( int fill );
95
virtual int fillMode() { return m_fillMode; }
96
virtual void setGradient( VGradientEx::Type mode, FPoint orig, FPoint vec, FPoint foc = FPoint(0,0));
97
virtual void setPattern ( ScPattern* pattern, QMatrix& patternTransform );
98
virtual void setClipPath();
100
virtual void drawImage( ScImage *image, ScPainterExBase::ImageMode mode );
101
virtual void setupPolygon(FPointArray *points, bool closed = true);
102
virtual void drawPolygon();
103
virtual void drawPolyLine();
104
virtual void drawLine(FPoint start, FPoint end);
105
virtual void drawRect(double, double, double, double);
108
virtual ScColorShade pen();
109
virtual ScColorShade brush();
110
virtual void setPen( const ScColorShade & );
111
virtual void setPen( const ScColorShade &c, double w, Qt::PenStyle st, Qt::PenCapStyle ca, Qt::PenJoinStyle jo );
112
virtual void setPenOpacity( double op );
113
virtual void setLineWidth( double w);
114
virtual void setDash(const QList<double>& array, double ofs);
115
virtual void setBrush( const ScColorShade & );
116
virtual void setBrushOpacity( double op );
117
virtual void setOpacity( double op );
118
virtual void setFont( const QFont &f );
119
virtual QFont font();
123
virtual void restore();
125
virtual void setRasterOp( int op );
129
void drawVPath( int mode );
130
void drawGradient( VGradientEx& gradient );
131
void drawLinearGradient( VGradientEx& gradient, const QRect& rect );
132
void drawLinearGradient_GradientFill( VGradientEx& gradient, const QRect& rect );
133
void drawCircularGradient( VGradientEx& gradient, const QRect& rect );
134
void drawCircleStrip( int x, int y, int w, int h, int r, int g, int b, int a );
135
void drawRectangleStrip( int x, int y, int w, int h, int r, int g, int b, int a );
136
void getClipPathDimensions( QRect& r );
137
void transformPoint( const FPoint& in, FPoint& out );
138
void transformPoints( const FPoint* in, FPoint* out, uint length );
139
void loadMsImg32( void );
143
unsigned int m_width;
144
unsigned int m_height;
148
ScColorShade m_fillColor;
151
int m_fillMode; // 0 = none, 1 = solid, 2 = gradient
152
int m_gradientMode; // 1 = linear, 2 = radial
154
ScColorShade m_strokeColor;
155
double m_strokeTrans;
157
/* Grayscale conversion option */
158
bool m_convertToGray;
161
Qt::PenCapStyle m_lineEnd;
162
/* Line Join Style */
163
Qt::PenJoinStyle m_lineJoin;
165
QList<double> m_array;
167
/* Transformation Stack */
168
QStack<QMatrix> m_stack;
170
/* Some data to describe state of drawing */
172
bool m_drawingClosedPath;
173
/* Drawing surface dimensions */
176
/* Device resolutions */
182
/* Handle to a bitmap */
184
/* Handle to the msimg32.dll (contains the GradientFill function) */
186
/* Address of the GradientFill function */
187
gradientFillFunc m_gradientFill;
189
/* Color conversion function */
190
QColor transformColor( ScColorShade& colorShade, double trans );
191
void transformImage( QImage* image, uchar* data, int scan);