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

Last change on this file since 9121 was 8127, checked in by stoecker, 8 years ago

update qwt and qwtpolar, many QT5 fixes (unfinished)

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