qwt_graphic.h
Go to the documentation of this file.
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 
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 
99  Q_DECLARE_FLAGS( RenderHints, RenderHint )
100 
101 
106  {
108  VectorData = 1 << 0,
109 
111  RasterData = 1 << 1,
112 
114  Transformation = 1 << 2
115  };
116 
117  Q_DECLARE_FLAGS( CommandTypes, CommandType )
118 
119  QwtGraphic();
120  QwtGraphic( const QwtGraphic& );
121 
122  virtual ~QwtGraphic();
123 
124  QwtGraphic& operator=( const QwtGraphic& );
125 
126  void reset();
127 
128  bool isNull() const;
129  bool isEmpty() const;
130 
131  CommandTypes commandTypes() const;
132 
133  void render( QPainter* ) const;
134 
135  void render( QPainter*, const QSizeF&,
136  Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
137 
138  void render( QPainter*, const QPointF&,
139  Qt::Alignment = Qt::AlignTop | Qt::AlignLeft ) const;
140 
141  void render( QPainter*, const QRectF&,
142  Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
143 
144  QPixmap toPixmap( qreal devicePixelRatio = 0.0 ) const;
145 
146  QPixmap toPixmap( const QSize&,
147  Qt::AspectRatioMode = Qt::IgnoreAspectRatio,
148  qreal devicePixelRatio = 0.0 ) const;
149 
150  QImage toImage( qreal devicePixelRatio = 0.0 ) const;
151 
152  QImage toImage( const QSize&,
153  Qt::AspectRatioMode = Qt::IgnoreAspectRatio,
154  qreal devicePixelRatio = 0.0 ) const;
155 
156  QRectF scaledBoundingRect( qreal sx, qreal sy ) const;
157 
158  QRectF boundingRect() const;
159  QRectF controlPointRect() const;
160 
161  const QVector< QwtPainterCommand >& commands() const;
162  void setCommands( const QVector< QwtPainterCommand >& );
163 
164  void setDefaultSize( const QSizeF& );
165  QSizeF defaultSize() const;
166 
167  qreal heightForWidth( qreal width ) const;
168  qreal widthForHeight( qreal height ) const;
169 
170  void setRenderHint( RenderHint, bool on = true );
171  bool testRenderHint( RenderHint ) const;
172 
173  RenderHints renderHints() const;
174 
175  protected:
176  virtual QSize sizeMetrics() const QWT_OVERRIDE;
177 
178  virtual void drawPath( const QPainterPath& ) QWT_OVERRIDE;
179 
180  virtual void drawPixmap( const QRectF&,
181  const QPixmap&, const QRectF& ) QWT_OVERRIDE;
182 
183  virtual void drawImage( const QRectF&, const QImage&,
184  const QRectF&, Qt::ImageConversionFlags ) QWT_OVERRIDE;
185 
186  virtual void updateState( const QPaintEngineState& ) QWT_OVERRIDE;
187 
188  private:
189  void renderGraphic( QPainter*, QTransform* ) const;
190 
191  void updateBoundingRect( const QRectF& );
192  void updateControlPointRect( const QRectF& );
193 
194  class PathInfo;
195 
196  class PrivateData;
197  PrivateData* m_data;
198 };
199 
200 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::RenderHints )
201 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::CommandTypes )
202 Q_DECLARE_METATYPE( QwtGraphic )
203 
204 #endif
QwtGraphic::PrivateData
Definition: qwt_graphic.cpp:329
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
QwtPainterCommand
Definition: qwt_painter_command.h:32
QVector< QwtPainterCommand >
qwt_global.h
QwtGraphic::RenderHint
RenderHint
Definition: qwt_graphic.h:82
QwtGraphic::CommandType
CommandType
Definition: qwt_graphic.h:105
QwtNullPaintDevice
A null paint device doing nothing.
Definition: qwt_null_paintdevice.h:32
QwtNullPaintDevice::sizeMetrics
virtual QSize sizeMetrics() const =0
qwt_null_paintdevice.h
backward::Color::reset
@ reset
Definition: backward.hpp:3678
QWT_OVERRIDE
#define QWT_OVERRIDE
Definition: qwt_global.h:53
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:45