QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
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
50class QWT_EXPORT QwtPainterCommand
51{
52public:
54 enum Type
55 {
57 Invalid = -1,
58
61
64
67
69 State
70 };
71
74 {
75 QRectF rect;
76 QPixmap pixmap;
77 QRectF subRect;
78 };
79
81 struct ImageData
82 {
83 QRectF rect;
84 QImage image;
85 QRectF subRect;
86 Qt::ImageConversionFlags flags;
87 };
88
90 struct StateData
91 {
92 QPaintEngine::DirtyFlags flags;
93
94 QPen pen;
95 QBrush brush;
96 QPointF brushOrigin;
97 QBrush backgroundBrush;
98 Qt::BGMode backgroundMode;
99 QFont font;
100 QTransform transform;
101
102 Qt::ClipOperation clipOperation;
103 QRegion clipRegion;
104 QPainterPath clipPath;
105 bool isClipEnabled;
106
107 QPainter::RenderHints renderHints;
108 QPainter::CompositionMode compositionMode;
109 qreal opacity;
110 };
111
115
116 explicit QwtPainterCommand(const QPainterPath&);
117
118 QwtPainterCommand(const QRectF& rect, const QPixmap&, const QRectF& subRect);
119
120 QwtPainterCommand(const QRectF& rect, const QImage&, const QRectF& subRect, Qt::ImageConversionFlags);
121
122 explicit QwtPainterCommand(const QPaintEngineState&);
123
125
126 QwtPainterCommand& operator=(const QwtPainterCommand&);
127 QwtPainterCommand& operator=(QwtPainterCommand&&) noexcept;
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
143private:
144 void copy(const QwtPainterCommand&);
145 void reset();
146
147 Type m_type;
148
149 union {
150 QPainterPath* m_path;
151 PixmapData* m_pixmapData;
152 ImageData* m_imageData;
153 StateData* m_stateData;
154 };
155};
156
159{
160 return m_type;
161}
162
164inline const QPainterPath* QwtPainterCommand::path() const
165{
166 return m_path;
167}
168
171{
172 return m_pixmapData;
173}
174
177{
178 return m_imageData;
179}
180
183{
184 return m_stateData;
185}
186
187#endif
Represents the attributes of a paint operation between QPainter and QPaintDevice
Definition qwt_painter_command.h:51
QPainterPath * path()
Definition qwt_painter_command.cpp:259
Type
Type of the paint command
Definition qwt_painter_command.h:55
@ Pixmap
Draw a QPixmap
Definition qwt_painter_command.h:63
@ Path
Draw a QPainterPath
Definition qwt_painter_command.h:60
@ Image
Draw a QImage
Definition qwt_painter_command.h:66
Type type() const
Definition qwt_painter_command.h:158
PixmapData * pixmapData()
Definition qwt_painter_command.cpp:265
ImageData * imageData()
Definition qwt_painter_command.cpp:271
StateData * stateData()
Definition qwt_painter_command.cpp:277
Attributes how to paint a QImage
Definition qwt_painter_command.h:82
Attributes how to paint a QPixmap
Definition qwt_painter_command.h:74
Attributes of a state change
Definition qwt_painter_command.h:91