Qwt User's Guide 6.1.0

- Main Page
- Related Pages
- Classes

All Classes Functions Variables Typedefs Enumerations Enumerator Pages
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
76 class QWT_EXPORT QwtGraphic: public QwtNullPaintDevice
77 {
78 public:
83 enum RenderHint
84 {
93 RenderPensUnscaled = 0x1
94 };
95
101 typedef QFlags<RenderHint> RenderHints;
102
103 QwtGraphic();
104 QwtGraphic( const QwtGraphic & );
105
106 virtual ~QwtGraphic();
107
108 QwtGraphic& operator=( const QwtGraphic & );
109
110 void reset();
111
112 bool isNull() const;
113 bool isEmpty() const;
114
115 void render( QPainter * ) const;
116
117 void render( QPainter *, const QSizeF &,
118 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
119
120 void render( QPainter *, const QRectF &,
121 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
122
123 void render( QPainter *, const QPointF &,
124 Qt::Alignment = Qt::AlignTop | Qt::AlignLeft ) const;
125
126 QPixmap toPixmap() const;
127 QPixmap toPixmap( const QSize &,
128 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
129
130 QImage toImage() const;
131 QImage toImage( const QSize &,
132 Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
133
134 QRectF scaledBoundingRect( double sx, double sy ) const;
135
136 QRectF boundingRect() const;
137 QRectF controlPointRect() const;
138
139 const QVector< QwtPainterCommand > &commands() const;
140 void setCommands( QVector< QwtPainterCommand > & );
141
142 void setDefaultSize( const QSizeF & );
143 QSizeF defaultSize() const;
144
145 void setRenderHint( RenderHint, bool on = true );
146 bool testRenderHint( RenderHint ) const;
147
148 protected:
149 virtual QSize sizeMetrics() const;
150
151 virtual void drawPath( const QPainterPath & );
152
153 virtual void drawPixmap( const QRectF &,
154 const QPixmap &, const QRectF & );
155
156 virtual void drawImage( const QRectF &,
157 const QImage &, const QRectF &, Qt::ImageConversionFlags );
158
159 virtual void updateState( const QPaintEngineState &state );
160
161 private:
162 void updateBoundingRect( const QRectF & );
163 void updateControlPointRect( const QRectF & );
164
165 class PathInfo;
166
167 class PrivateData;
168 PrivateData *d_data;
169 };
170
171 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::RenderHints )
172 Q_DECLARE_METATYPE( QwtGraphic )
173
174 #endif