source: ntrip/trunk/BNC/qwt/qwt_painter_command.h@ 10496

Last change on this file since 10496 was 9383, checked in by stoecker, 4 years ago

update to qwt verion 6.1.1 to fix build with newer Qt5

File size: 3.7 KB
Line 
1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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#ifndef QWT_PAINTER_COMMAND_H
11#define QWT_PAINTER_COMMAND_H
12
13#include "qwt_global.h"
14#include <qpaintengine.h>
15#include <qpixmap.h>
16#include <qimage.h>
17#include <qpolygon.h>
18#include <qpainterpath.h>
19
20class QPainterPath;
21
22/*!
23 QwtPainterCommand represents the attributes of a paint operation
24 how it is used between QPainter and QPaintDevice
25
26 It is used by QwtGraphic to record and replay paint operations
27
28 \sa QwtGraphic::commands()
29 */
30
31class QWT_EXPORT QwtPainterCommand
32{
33public:
34 //! Type of the paint command
35 enum Type
36 {
37 //! Invalid command
38 Invalid = -1,
39
40 //! Draw a QPainterPath
41 Path,
42
43 //! Draw a QPixmap
44 Pixmap,
45
46 //! Draw a QImage
47 Image,
48
49 //! QPainter state change
50 State
51 };
52
53 //! Attributes how to paint a QPixmap
54 struct PixmapData
55 {
56 QRectF rect;
57 QPixmap pixmap;
58 QRectF subRect;
59 };
60
61 //! Attributes how to paint a QImage
62 struct ImageData
63 {
64 QRectF rect;
65 QImage image;
66 QRectF subRect;
67 Qt::ImageConversionFlags flags;
68 };
69
70 //! Attributes of a state change
71 struct StateData
72 {
73 QPaintEngine::DirtyFlags flags;
74
75 QPen pen;
76 QBrush brush;
77 QPointF brushOrigin;
78 QBrush backgroundBrush;
79 Qt::BGMode backgroundMode;
80 QFont font;
81 QMatrix matrix;
82 QTransform transform;
83
84 Qt::ClipOperation clipOperation;
85 QRegion clipRegion;
86 QPainterPath clipPath;
87 bool isClipEnabled;
88
89 QPainter::RenderHints renderHints;
90 QPainter::CompositionMode compositionMode;
91 qreal opacity;
92 };
93
94 QwtPainterCommand();
95 QwtPainterCommand(const QwtPainterCommand &);
96
97 QwtPainterCommand( const QPainterPath & );
98
99 QwtPainterCommand( const QRectF &rect,
100 const QPixmap &, const QRectF& subRect );
101
102 QwtPainterCommand( const QRectF &rect,
103 const QImage &, const QRectF& subRect,
104 Qt::ImageConversionFlags );
105
106 QwtPainterCommand( const QPaintEngineState & );
107
108 ~QwtPainterCommand();
109
110 QwtPainterCommand &operator=(const QwtPainterCommand & );
111
112 Type type() const;
113
114 QPainterPath *path();
115 const QPainterPath *path() const;
116
117 PixmapData* pixmapData();
118 const PixmapData* pixmapData() const;
119
120 ImageData* imageData();
121 const ImageData* imageData() const;
122
123 StateData* stateData();
124 const StateData* stateData() const;
125
126private:
127 void copy( const QwtPainterCommand & );
128 void reset();
129
130 Type d_type;
131
132 union
133 {
134 QPainterPath *d_path;
135 PixmapData *d_pixmapData;
136 ImageData *d_imageData;
137 StateData *d_stateData;
138 };
139};
140
141//! \return Type of the command
142inline QwtPainterCommand::Type QwtPainterCommand::type() const
143{
144 return d_type;
145}
146
147//! \return Painter path to be painted
148inline const QPainterPath *QwtPainterCommand::path() const
149{
150 return d_path;
151}
152
153//! \return Attributes how to paint a QPixmap
154inline const QwtPainterCommand::PixmapData *
155QwtPainterCommand::pixmapData() const
156{
157 return d_pixmapData;
158}
159
160//! \return Attributes how to paint a QImage
161inline const QwtPainterCommand::ImageData *
162QwtPainterCommand::imageData() const
163{
164 return d_imageData;
165}
166
167//! \return Attributes of a state change
168inline const QwtPainterCommand::StateData *
169QwtPainterCommand::stateData() const
170{
171 return d_stateData;
172}
173
174#endif
Note: See TracBrowser for help on using the repository browser.