QWT 7.0.1
Loading...
Searching...
No Matches
qwt_painter_command.h
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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PAINTER_COMMAND_H
28#define QWT_PAINTER_COMMAND_H
29
30#include "qwt_global.h"
31
32#include <qpaintengine.h>
33#include <qpixmap.h>
34#include <qimage.h>
35#include <qpolygon.h>
36#include <qpainterpath.h>
37
38class QPainterPath;
39
49class QWT_EXPORT QwtPainterCommand
50{
51 public:
53 enum Type
54 {
56 Invalid = -1,
57
60
63
66
68 State
69 };
70
73 {
74 QRectF rect;
75 QPixmap pixmap;
76 QRectF subRect;
77 };
78
80 struct ImageData
81 {
82 QRectF rect;
83 QImage image;
84 QRectF subRect;
85 Qt::ImageConversionFlags flags;
86 };
87
89 struct StateData
90 {
91 QPaintEngine::DirtyFlags flags;
92
93 QPen pen;
94 QBrush brush;
95 QPointF brushOrigin;
96 QBrush backgroundBrush;
97 Qt::BGMode backgroundMode;
98 QFont font;
99 QTransform transform;
100
101 Qt::ClipOperation clipOperation;
102 QRegion clipRegion;
103 QPainterPath clipPath;
104 bool isClipEnabled;
105
106 QPainter::RenderHints renderHints;
107 QPainter::CompositionMode compositionMode;
108 qreal opacity;
109 };
110
113
114 explicit QwtPainterCommand( const QPainterPath& );
115
116 QwtPainterCommand( const QRectF& rect,
117 const QPixmap&, const QRectF& subRect );
118
119 QwtPainterCommand( const QRectF& rect,
120 const QImage&, const QRectF& subRect,
121 Qt::ImageConversionFlags );
122
123 explicit QwtPainterCommand( const QPaintEngineState& );
124
126
127 QwtPainterCommand& operator=(const QwtPainterCommand& );
128
129 Type type() const;
130
131 QPainterPath* path();
132 const QPainterPath* path() const;
133
134 PixmapData* pixmapData();
135 const PixmapData* pixmapData() const;
136
137 ImageData* imageData();
138 const ImageData* imageData() const;
139
140 StateData* stateData();
141 const StateData* stateData() const;
142
143 private:
144 void copy( const QwtPainterCommand& );
145 void reset();
146
147 Type m_type;
148
149 union
150 {
151 QPainterPath* m_path;
152 PixmapData* m_pixmapData;
153 ImageData* m_imageData;
154 StateData* m_stateData;
155 };
156};
157
160{
161 return m_type;
162}
163
165inline const QPainterPath* QwtPainterCommand::path() const
166{
167 return m_path;
168}
169
173{
174 return m_pixmapData;
175}
176
180{
181 return m_imageData;
182}
183
187{
188 return m_stateData;
189}
190
191#endif
QwtPainterCommand represents the attributes of a paint operation how it is used between QPainter and ...
Definition qwt_painter_command.h:50
QPainterPath * path()
Definition qwt_painter_command.cpp:233
Type
Type of the paint command.
Definition qwt_painter_command.h:54
@ Pixmap
Draw a QPixmap.
Definition qwt_painter_command.h:62
@ Path
Draw a QPainterPath.
Definition qwt_painter_command.h:59
@ Image
Draw a QImage.
Definition qwt_painter_command.h:65
Type type() const
Definition qwt_painter_command.h:159
PixmapData * pixmapData()
Definition qwt_painter_command.cpp:239
ImageData * imageData()
Definition qwt_painter_command.cpp:245
StateData * stateData()
Definition qwt_painter_command.cpp:251
Attributes how to paint a QImage.
Definition qwt_painter_command.h:81
Attributes how to paint a QPixmap.
Definition qwt_painter_command.h:73
Attributes of a state change.
Definition qwt_painter_command.h:90