~ubuntu-branches/ubuntu/trusty/scribus-ng/trusty

« back to all changes in this revision

Viewing changes to scribus/scpainterex_gdi.h

  • Committer: Package Import Robot
  • Author(s): Oleksandr Moskalenko
  • Date: 2012-02-15 15:57:12 UTC
  • mfrom: (4.2.10 sid)
  • Revision ID: package-import@ubuntu.com-20120215155712-biimoc8o875jht80
Tags: 1.4.0.dfsg+r17300-1
* Prepare a dummy transitional package to converge on the 1.4.0 release.
* debian/NEWS: update the news.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
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.
6
 
*/
7
 
/* This file is part of the KDE project
8
 
   Copyright (C) 2001, 2002, 2003 The Karbon Developers
9
 
 
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.
14
 
 
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.
19
 
 
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.
24
 
*/
25
 
/* Adapted for Scribus 22.08.2003 by Franz Schmid */
26
 
/* Adapted for Scribus 15.01.2006 by Jean Ghali */
27
 
 
28
 
#ifndef __SCPAINTEREX_GDI_H__
29
 
#define __SCPAINTEREX_GDI_H__
30
 
 
31
 
// libart wrapper
32
 
 
33
 
#include <QColor>
34
 
#include <QFont>
35
 
#include <QGlobalStatic>
36
 
#include <QList>
37
 
#include <QMatrix>
38
 
#include <QPixmap>
39
 
#include <QStack>
40
 
 
41
 
#include "scribusapi.h"
42
 
#include "scconfig.h"
43
 
#include "fpoint.h"
44
 
#include "fpointarray.h"
45
 
#include "vgradient.h"
46
 
 
47
 
#include "scpainterexbase.h"
48
 
 
49
 
#include <valarray>
50
 
#include <windows.h>
51
 
 
52
 
class QPainter;
53
 
class ScribusDoc;
54
 
 
55
 
// Typedef to use the GDI gradientFill function
56
 
typedef bool (STDAPICALLTYPE *gradientFillFunc) (HDC, PTRIVERTEX, ULONG, PVOID, ULONG, ULONG);  
57
 
 
58
 
class SCRIBUS_API ScPainterEx_GDI : public ScPainterExBase
59
 
{
60
 
public:
61
 
 
62
 
        ScPainterEx_GDI(HDC hDC, QRect& rect, ScribusDoc* doc, bool gray );
63
 
        virtual ~ScPainterEx_GDI();
64
 
 
65
 
        virtual Capabilities capabilities() { return transparencies; }
66
 
 
67
 
        virtual int supportedColorModes() { return (int) rgbMode; }
68
 
        virtual ColorMode preferredColorMode() { return rgbMode; }
69
 
        virtual ImageMode imageMode() { return rgbImages; }
70
 
 
71
 
        virtual void begin();
72
 
        virtual void end();
73
 
        virtual void clear();
74
 
        virtual void clear( ScColorShade & );
75
 
 
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 );
82
 
 
83
 
        // drawing
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();
99
 
 
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);
106
 
 
107
 
        // pen + brush
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();
120
 
 
121
 
        // stack management
122
 
        virtual void save();
123
 
        virtual void restore();
124
 
 
125
 
        virtual void setRasterOp( int op );
126
 
 
127
 
private:
128
 
 
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 );
140
 
 
141
 
        ScribusDoc* m_doc;
142
 
 
143
 
        unsigned int m_width;
144
 
        unsigned int m_height;
145
 
        QMatrix m_matrix;
146
 
        QFont m_font;
147
 
/* Filling */
148
 
        ScColorShade m_fillColor;
149
 
        double m_fillTrans;
150
 
        bool   m_fillRule;
151
 
        int    m_fillMode;                      // 0 = none, 1 = solid, 2 = gradient
152
 
        int    m_gradientMode;          // 1 = linear, 2 = radial
153
 
/* Stroking */
154
 
        ScColorShade m_strokeColor;
155
 
        double m_strokeTrans;
156
 
        double m_lineWidth;
157
 
/* Grayscale conversion option */
158
 
        bool   m_convertToGray;
159
 
 
160
 
/* Line End Style */
161
 
        Qt::PenCapStyle m_lineEnd;
162
 
/* Line Join Style */
163
 
        Qt::PenJoinStyle m_lineJoin;
164
 
/* The Dash Array */
165
 
        QList<double> m_array;
166
 
        double m_offset;
167
 
/* Transformation Stack */
168
 
        QStack<QMatrix> m_stack;
169
 
 
170
 
/* Some data to describe state of drawing */    
171
 
        bool m_pathIsClosed;
172
 
        bool m_drawingClosedPath;
173
 
/* Drawing surface dimensions */
174
 
        double m_deviceDimX;
175
 
        double m_deviceDimY;
176
 
/* Device resolutions */
177
 
        double m_deviceResX;
178
 
        double m_deviceResY;
179
 
 
180
 
/* Device context */
181
 
        HDC m_dc;
182
 
/* Handle to a bitmap */
183
 
        HBITMAP m_hBmp;
184
 
/* Handle to the msimg32.dll (contains the GradientFill function) */
185
 
        HMODULE m_hMsImg32;
186
 
/* Address of the GradientFill function */
187
 
        gradientFillFunc m_gradientFill;
188
 
 
189
 
/* Color conversion function */
190
 
        QColor transformColor( ScColorShade& colorShade, double trans );
191
 
        void   transformImage( QImage* image, uchar* data, int scan);
192
 
};
193
 
 
194
 
#endif