Qwt User's Guide: qwt_graphic.h Source File

Qwt User's Guide 6.1.3

- Main Page
- Classes

qwt_graphic.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_GRAPHIC_H
11 #define QWT_GRAPHIC_H
12
13 #include "qwt_global.h"
14 #include "qwt_null_paintdevice.h"
15 #include <qmetatype.h>
16 #include <qimage.h>
17 #include <qpixmap.h>
18
19 class QwtPainterCommand;
20
74 class QWT_EXPORT QwtGraphic: public QwtNullPaintDevice
75 {
76 public:
81 enum RenderHint
82 {
95 RenderPensUnscaled = 0x1
96 };
97
103 typedef QFlags<RenderHint> RenderHints;
104
105 QwtGraphic();
106 QwtGraphic( const QwtGraphic & );
107
108 virtual ~QwtGraphic();
109
110 QwtGraphic& operator=( const QwtGraphic & );
111
112 void reset();
113
114 bool isNull() const;
115 bool isEmpty() const;
116
117 void render( QPainter * ) const;
118
119 void render( QPainter *, const QSizeF &,
120 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
121
122 void render( QPainter *, const QRectF &,
123 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
124
125 void render( QPainter *, const QPointF &,
126 Qt::Alignment = Qt::AlignTop | Qt::AlignLeft ) const;
127
128 QPixmap toPixmap() const;
129 QPixmap toPixmap( const QSize &,
130 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
131
132 QImage toImage() const;
133 QImage toImage( const QSize &,
134 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
135
136 QRectF scaledBoundingRect( double sx, double sy ) const;
137
138 QRectF boundingRect() const;
139 QRectF controlPointRect() const;
140
141 const QVector< QwtPainterCommand > &commands() const;
142 void setCommands( QVector< QwtPainterCommand > & );
143
144 void setDefaultSize( const QSizeF & );
145 QSizeF defaultSize() const;
146
147 void setRenderHint( RenderHint, bool on = true );
148 bool testRenderHint( RenderHint ) const;
149
150 protected:
151 virtual QSize sizeMetrics() const;
152
153 virtual void drawPath( const QPainterPath & );
154
155 virtual void drawPixmap( const QRectF &,
156 const QPixmap &, const QRectF & );
157
158 virtual void drawImage( const QRectF &,
159 const QImage &, const QRectF &, Qt::ImageConversionFlags );
160
161 virtual void updateState( const QPaintEngineState &state );
162
163 private:
164 void updateBoundingRect( const QRectF & );
165 void updateControlPointRect( const QRectF & );
166
167 class PathInfo;
168
169 class PrivateData;
170 PrivateData *d_data;
171 };
172
173 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::RenderHints )
174 Q_DECLARE_METATYPE( QwtGraphic )
175
176 #endif
QwtNullPaintDevice::sizeMetrics
virtual QSize sizeMetrics() const =0
QwtNullPaintDevice::updateState
virtual void updateState(const QPaintEngineState &state)
See QPaintEngine::updateState()
Definition: qwt_null_paintdevice.cpp:589
QwtNullPaintDevice
A null paint device doing nothing.
Definition: qwt_null_paintdevice.h:31
QwtGraphic::RenderHint
RenderHint
Definition: qwt_graphic.h:81
QwtNullPaintDevice::drawPath
virtual void drawPath(const QPainterPath &)
See QPaintEngine::drawPath()
Definition: qwt_null_paintdevice.cpp:509
QwtGraphic::RenderHints
QFlags< RenderHint > RenderHints
Render hints.
Definition: qwt_graphic.h:103
QwtNullPaintDevice::drawImage
virtual void drawImage(const QRectF &, const QImage &, const QRectF &, Qt::ImageConversionFlags)
See QPaintEngine::drawImage()
Definition: qwt_null_paintdevice.cpp:578
QwtPainterCommand
Definition: qwt_painter_command.h:30
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:74
QwtNullPaintDevice::drawPixmap
virtual void drawPixmap(const QRectF &, const QPixmap &, const QRectF &)
See QPaintEngine::drawPixmap()
Definition: qwt_null_paintdevice.cpp:551