Qwt User's Guide  6.1.6
qwt_painter_command.h
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 
20 class QPainterPath;
21 
31 class QWT_EXPORT QwtPainterCommand
32 {
33 public:
35  enum Type
36  {
38  Invalid = -1,
39 
42 
45 
48 
50  State
51  };
52 
54  struct PixmapData
55  {
56  QRectF rect;
57  QPixmap pixmap;
58  QRectF subRect;
59  };
60 
62  struct ImageData
63  {
64  QRectF rect;
65  QImage image;
66  QRectF subRect;
67  Qt::ImageConversionFlags flags;
68  };
69 
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 
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 
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 
126 private:
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 
143 {
144  return d_type;
145 }
146 
148 inline const QPainterPath *QwtPainterCommand::path() const
149 {
150  return d_path;
151 }
152 
154 inline const QwtPainterCommand::PixmapData *
156 {
157  return d_pixmapData;
158 }
159 
161 inline const QwtPainterCommand::ImageData *
163 {
164  return d_imageData;
165 }
166 
168 inline const QwtPainterCommand::StateData *
170 {
171  return d_stateData;
172 }
173 
174 #endif
QwtPainterCommand::stateData
StateData * stateData()
Definition: qwt_painter_command.cpp:234
QwtPainterCommand::Path
@ Path
Draw a QPainterPath.
Definition: qwt_painter_command.h:41
QwtPainterCommand
Definition: qwt_painter_command.h:32
QwtPainterCommand::type
Type type() const
Definition: qwt_painter_command.h:142
QwtPainterCommand::pixmapData
PixmapData * pixmapData()
Definition: qwt_painter_command.cpp:222
QwtPainterCommand::imageData
ImageData * imageData()
Definition: qwt_painter_command.cpp:228
QwtPainterCommand::Image
@ Image
Draw a QImage.
Definition: qwt_painter_command.h:47
QwtPainterCommand::Type
Type
Type of the paint command.
Definition: qwt_painter_command.h:36
QwtPainterCommand::Pixmap
@ Pixmap
Draw a QPixmap.
Definition: qwt_painter_command.h:44
QwtPainterCommand::path
QPainterPath * path()
Definition: qwt_painter_command.cpp:216