3rdparty
qwt
src
qwt_painter_command.cpp
Go to the documentation of this file.
1
/******************************************************************************
2
* Qwt Widget Library
3
* Copyright (C) 1997 Josef Wilgen
4
* Copyright (C) 2002 Uwe Rathmann
5
*
6
* This library is free software; you can redistribute it and/or
7
* modify it under the terms of the Qwt License, Version 1.0
8
*****************************************************************************/
9
10
#include "
qwt_painter_command.h
"
11
13
QwtPainterCommand::QwtPainterCommand
()
14
: m_type( Invalid )
15
{
16
}
17
19
QwtPainterCommand::QwtPainterCommand
(
const
QPainterPath& path )
20
: m_type( Path )
21
{
22
m_path
=
new
QPainterPath(
path
);
23
}
24
34
QwtPainterCommand::QwtPainterCommand
(
const
QRectF& rect,
35
const
QPixmap& pixmap,
const
QRectF& subRect )
36
: m_type( Pixmap )
37
{
38
m_pixmapData
=
new
PixmapData
();
39
m_pixmapData
->
rect
= rect;
40
m_pixmapData
->
pixmap
= pixmap;
41
m_pixmapData
->
subRect
= subRect;
42
}
43
54
QwtPainterCommand::QwtPainterCommand
(
const
QRectF& rect,
55
const
QImage& image,
const
QRectF& subRect,
56
Qt::ImageConversionFlags flags )
57
: m_type( Image )
58
{
59
m_imageData
=
new
ImageData
();
60
m_imageData
->
rect
= rect;
61
m_imageData
->
image
= image;
62
m_imageData
->
subRect
= subRect;
63
m_imageData
->
flags
= flags;
64
}
65
70
QwtPainterCommand::QwtPainterCommand
(
const
QPaintEngineState&
state
)
71
: m_type( State )
72
{
73
m_stateData
=
new
StateData
();
74
75
m_stateData
->
flags
=
state
.state();
76
77
if
(
m_stateData
->
flags
& QPaintEngine::DirtyPen )
78
m_stateData
->
pen
=
state
.pen();
79
80
if
(
m_stateData
->
flags
& QPaintEngine::DirtyBrush )
81
m_stateData
->
brush
=
state
.brush();
82
83
if
(
m_stateData
->
flags
& QPaintEngine::DirtyBrushOrigin )
84
m_stateData
->
brushOrigin
=
state
.brushOrigin();
85
86
if
(
m_stateData
->
flags
& QPaintEngine::DirtyFont )
87
m_stateData
->
font
=
state
.font();
88
89
if
(
m_stateData
->
flags
& QPaintEngine::DirtyBackground )
90
{
91
m_stateData
->
backgroundMode
=
state
.backgroundMode();
92
m_stateData
->
backgroundBrush
=
state
.backgroundBrush();
93
}
94
95
if
(
m_stateData
->
flags
& QPaintEngine::DirtyTransform )
96
m_stateData
->
transform
=
state
.transform();
97
98
if
(
m_stateData
->
flags
& QPaintEngine::DirtyClipEnabled )
99
m_stateData
->
isClipEnabled
=
state
.isClipEnabled();
100
101
if
(
m_stateData
->
flags
& QPaintEngine::DirtyClipRegion )
102
{
103
m_stateData
->
clipRegion
=
state
.clipRegion();
104
m_stateData
->
clipOperation
=
state
.clipOperation();
105
}
106
107
if
(
m_stateData
->
flags
& QPaintEngine::DirtyClipPath )
108
{
109
m_stateData
->
clipPath
=
state
.clipPath();
110
m_stateData
->
clipOperation
=
state
.clipOperation();
111
}
112
113
if
(
m_stateData
->
flags
& QPaintEngine::DirtyHints )
114
m_stateData
->
renderHints
=
state
.renderHints();
115
116
if
(
m_stateData
->
flags
& QPaintEngine::DirtyCompositionMode )
117
m_stateData
->
compositionMode
=
state
.compositionMode();
118
119
if
(
m_stateData
->
flags
& QPaintEngine::DirtyOpacity )
120
m_stateData
->
opacity
=
state
.opacity();
121
}
122
128
QwtPainterCommand::QwtPainterCommand
(
const
QwtPainterCommand
& other )
129
{
130
copy
( other );
131
}
132
134
QwtPainterCommand::~QwtPainterCommand
()
135
{
136
reset
();
137
}
138
145
QwtPainterCommand
&
QwtPainterCommand::operator=
(
const
QwtPainterCommand
& other )
146
{
147
reset
();
148
copy
( other );
149
150
return
*
this
;
151
}
152
153
void
QwtPainterCommand::copy
(
const
QwtPainterCommand
& other )
154
{
155
m_type
= other.
m_type
;
156
157
switch
( other.
m_type
)
158
{
159
case
Path
:
160
{
161
m_path
=
new
QPainterPath( *other.
m_path
);
162
break
;
163
}
164
case
Pixmap
:
165
{
166
m_pixmapData
=
new
PixmapData
( *other.
m_pixmapData
);
167
break
;
168
}
169
case
Image
:
170
{
171
m_imageData
=
new
ImageData
( *other.
m_imageData
);
172
break
;
173
}
174
case
State
:
175
{
176
m_stateData
=
new
StateData
( *other.
m_stateData
);
177
break
;
178
}
179
default
:
180
break
;
181
}
182
}
183
184
void
QwtPainterCommand::reset
()
185
{
186
switch
(
m_type
)
187
{
188
case
Path
:
189
{
190
delete
m_path
;
191
break
;
192
}
193
case
Pixmap
:
194
{
195
delete
m_pixmapData
;
196
break
;
197
}
198
case
Image
:
199
{
200
delete
m_imageData
;
201
break
;
202
}
203
case
State
:
204
{
205
delete
m_stateData
;
206
break
;
207
}
208
default
:
209
break
;
210
}
211
212
m_type
=
Invalid
;
213
}
214
216
QPainterPath*
QwtPainterCommand::path
()
217
{
218
return
m_path
;
219
}
220
222
QwtPainterCommand::PixmapData
*
QwtPainterCommand::pixmapData
()
223
{
224
return
m_pixmapData
;
225
}
226
228
QwtPainterCommand::ImageData
*
QwtPainterCommand::imageData
()
229
{
230
return
m_imageData
;
231
}
232
234
QwtPainterCommand::StateData
*
QwtPainterCommand::stateData
()
235
{
236
return
m_stateData
;
237
}
QwtPainterCommand::PixmapData
Attributes how to paint a QPixmap.
Definition:
qwt_painter_command.h:55
QwtPainterCommand::StateData::clipOperation
Qt::ClipOperation clipOperation
Definition:
qwt_painter_command.h:84
QwtPainterCommand::QwtPainterCommand
QwtPainterCommand()
Construct an invalid command.
Definition:
qwt_painter_command.cpp:13
QwtPainterCommand::StateData::opacity
qreal opacity
Definition:
qwt_painter_command.h:91
QwtPainterCommand::StateData::backgroundBrush
QBrush backgroundBrush
Definition:
qwt_painter_command.h:79
QwtPainterCommand::StateData::compositionMode
QPainter::CompositionMode compositionMode
Definition:
qwt_painter_command.h:90
detail::state
state
Definition:
core.h:2305
QwtPainterCommand::StateData::brushOrigin
QPointF brushOrigin
Definition:
qwt_painter_command.h:78
QwtPainterCommand::ImageData::rect
QRectF rect
Definition:
qwt_painter_command.h:65
QwtPainterCommand::m_type
Type m_type
Definition:
qwt_painter_command.h:130
QwtPainterCommand
Definition:
qwt_painter_command.h:32
QwtPainterCommand::m_pixmapData
PixmapData * m_pixmapData
Definition:
qwt_painter_command.h:135
QwtPainterCommand::reset
void reset()
Definition:
qwt_painter_command.cpp:184
QwtPainterCommand::PixmapData::subRect
QRectF subRect
Definition:
qwt_painter_command.h:59
QwtPainterCommand::StateData::brush
QBrush brush
Definition:
qwt_painter_command.h:77
QwtPainterCommand::ImageData
Attributes how to paint a QImage.
Definition:
qwt_painter_command.h:63
QwtPainterCommand::Pixmap
@ Pixmap
Draw a QPixmap.
Definition:
qwt_painter_command.h:45
QwtPainterCommand::path
QPainterPath * path()
Definition:
qwt_painter_command.cpp:216
QwtPainterCommand::StateData::pen
QPen pen
Definition:
qwt_painter_command.h:76
QwtPainterCommand::ImageData::flags
Qt::ImageConversionFlags flags
Definition:
qwt_painter_command.h:68
QwtPainterCommand::StateData::backgroundMode
Qt::BGMode backgroundMode
Definition:
qwt_painter_command.h:80
QwtPainterCommand::StateData::flags
QPaintEngine::DirtyFlags flags
Definition:
qwt_painter_command.h:74
QwtPainterCommand::Path
@ Path
Draw a QPainterPath.
Definition:
qwt_painter_command.h:42
QwtPainterCommand::~QwtPainterCommand
~QwtPainterCommand()
Destructor.
Definition:
qwt_painter_command.cpp:134
QwtPainterCommand::m_imageData
ImageData * m_imageData
Definition:
qwt_painter_command.h:136
QwtPainterCommand::State
@ State
QPainter state change.
Definition:
qwt_painter_command.h:51
QwtPainterCommand::Invalid
@ Invalid
Invalid command.
Definition:
qwt_painter_command.h:39
QwtPainterCommand::m_stateData
StateData * m_stateData
Definition:
qwt_painter_command.h:137
QwtPainterCommand::pixmapData
PixmapData * pixmapData()
Definition:
qwt_painter_command.cpp:222
QwtPainterCommand::StateData::isClipEnabled
bool isClipEnabled
Definition:
qwt_painter_command.h:87
qwt_painter_command.h
QwtPainterCommand::Image
@ Image
Draw a QImage.
Definition:
qwt_painter_command.h:48
QwtPainterCommand::StateData::clipRegion
QRegion clipRegion
Definition:
qwt_painter_command.h:85
QwtPainterCommand::StateData::clipPath
QPainterPath clipPath
Definition:
qwt_painter_command.h:86
QwtPainterCommand::ImageData::subRect
QRectF subRect
Definition:
qwt_painter_command.h:67
QwtPainterCommand::StateData::transform
QTransform transform
Definition:
qwt_painter_command.h:82
QwtPainterCommand::m_path
QPainterPath * m_path
Definition:
qwt_painter_command.h:134
QwtPainterCommand::PixmapData::rect
QRectF rect
Definition:
qwt_painter_command.h:57
QwtPainterCommand::stateData
StateData * stateData()
Definition:
qwt_painter_command.cpp:234
QwtPainterCommand::ImageData::image
QImage image
Definition:
qwt_painter_command.h:66
QwtPainterCommand::StateData::renderHints
QPainter::RenderHints renderHints
Definition:
qwt_painter_command.h:89
QwtPainterCommand::PixmapData::pixmap
QPixmap pixmap
Definition:
qwt_painter_command.h:58
QwtPainterCommand::StateData
Attributes of a state change.
Definition:
qwt_painter_command.h:72
QwtPainterCommand::copy
void copy(const QwtPainterCommand &)
Definition:
qwt_painter_command.cpp:153
QwtPainterCommand::operator=
QwtPainterCommand & operator=(const QwtPainterCommand &)
Definition:
qwt_painter_command.cpp:145
QwtPainterCommand::imageData
ImageData * imageData()
Definition:
qwt_painter_command.cpp:228
QwtPainterCommand::StateData::font
QFont font
Definition:
qwt_painter_command.h:81
plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45