qwt_graphic.h
Go to the documentation of this file.
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_GRAPHIC_H
11 #define QWT_GRAPHIC_H
12 
13 #include "qwt_global.h"
14 #include "qwt_null_paintdevice.h"
15 
16 #include <qmetatype.h>
17 
18 class QwtPainterCommand;
19 class QPixmap;
20 class QImage;
21 
76 {
77 public:
83  {
96  RenderPensUnscaled = 0x1
97  };
98 
104  typedef QFlags< RenderHint > RenderHints;
105 
111  {
113  VectorData = 1 << 0,
114 
116  RasterData = 1 << 1,
117 
119  Transformation = 1 << 2
120  };
121 
126  typedef QFlags< CommandType > CommandTypes;
127 
128  QwtGraphic();
129  QwtGraphic( const QwtGraphic & );
130 
131  virtual ~QwtGraphic();
132 
133  QwtGraphic& operator=( const QwtGraphic & );
134 
135  void reset();
136 
137  bool isNull() const;
138  bool isEmpty() const;
139 
140  CommandTypes commandTypes() const;
141 
142  void render( QPainter * ) const;
143 
144  void render( QPainter *, const QSizeF &,
145  Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
146 
147  void render( QPainter *, const QPointF &,
148  Qt::Alignment = Qt::AlignTop | Qt::AlignLeft ) const;
149 
150  void render( QPainter *, const QRectF &,
151  Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
152 
153  QPixmap toPixmap( qreal devicePixelRatio = 0.0 ) const;
154 
155  QPixmap toPixmap( const QSize &,
156  Qt::AspectRatioMode = Qt::IgnoreAspectRatio,
157  qreal devicePixelRatio = 0.0 ) const;
158 
159  QImage toImage( qreal devicePixelRatio = 0.0 ) const;
160 
161  QImage toImage( const QSize &,
162  Qt::AspectRatioMode = Qt::IgnoreAspectRatio,
163  qreal devicePixelRatio = 0.0 ) const;
164 
165  QRectF scaledBoundingRect( qreal sx, qreal sy ) const;
166 
167  QRectF boundingRect() const;
168  QRectF controlPointRect() const;
169 
170  const QVector< QwtPainterCommand > &commands() const;
171  void setCommands( const QVector< QwtPainterCommand > & );
172 
173  void setDefaultSize( const QSizeF & );
174  QSizeF defaultSize() const;
175 
176  qreal heightForWidth( qreal width ) const;
177  qreal widthForHeight( qreal height ) const;
178 
179  void setRenderHint( RenderHint, bool on = true );
180  bool testRenderHint( RenderHint ) const;
181 
182  RenderHints renderHints() const;
183 
184 protected:
185  virtual QSize sizeMetrics() const QWT_OVERRIDE;
186 
187  virtual void drawPath( const QPainterPath & ) QWT_OVERRIDE;
188 
189  virtual void drawPixmap( const QRectF &,
190  const QPixmap &, const QRectF & ) QWT_OVERRIDE;
191 
192  virtual void drawImage( const QRectF &, const QImage &,
193  const QRectF &, Qt::ImageConversionFlags ) QWT_OVERRIDE;
194 
195  virtual void updateState( const QPaintEngineState & ) QWT_OVERRIDE;
196 
197 private:
198  void renderGraphic( QPainter *, QTransform * ) const;
199 
200  void updateBoundingRect( const QRectF & );
201  void updateControlPointRect( const QRectF & );
202 
203  class PathInfo;
204 
205  class PrivateData;
206  PrivateData *d_data;
207 };
208 
209 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::RenderHints )
210 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::CommandTypes )
211 Q_DECLARE_METATYPE( QwtGraphic )
212 
213 #endif
#define QWT_EXPORT
Definition: qwt_global.h:38
A null paint device doing nothing.
QFlags< CommandType > CommandTypes
Definition: qwt_graphic.h:126
static List * commands
Definition: MQTTAsync.c:304
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
virtual QSize sizeMetrics() const =0
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QFlags< RenderHint > RenderHints
Render hints.
Definition: qwt_graphic.h:104


plotjuggler
Author(s): Davide Faconti
autogenerated on Sun Dec 6 2020 03:48:10