qwt_graphic.h
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
* Qwt Widget Library
* Copyright (C) 1997 Josef Wilgen
* Copyright (C) 2002 Uwe Rathmann
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the Qwt License, Version 1.0
*****************************************************************************/
#ifndef QWT_GRAPHIC_H
#define QWT_GRAPHIC_H
#include "qwt_global.h"
#include "qwt_null_paintdevice.h"
#include <qmetatype.h>
#include <qimage.h>
#include <qpixmap.h>
class QwtPainterCommand;
class QWT_EXPORT QwtGraphic: public QwtNullPaintDevice
{
public:
enum RenderHint
{
RenderPensUnscaled = 0x1
};
typedef QFlags<RenderHint> RenderHints;
QwtGraphic();
QwtGraphic( const QwtGraphic & );
virtual ~QwtGraphic();
QwtGraphic& operator=( const QwtGraphic & );
void reset();
bool isNull() const;
bool isEmpty() const;
void render( QPainter * ) const;
void render( QPainter *, const QSizeF &,
Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
void render( QPainter *, const QRectF &,
Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
void render( QPainter *, const QPointF &,
Qt::Alignment = Qt::AlignTop | Qt::AlignLeft ) const;
QPixmap toPixmap() const;
QPixmap toPixmap( const QSize &,
Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
QImage toImage() const;
QImage toImage( const QSize &,
Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
QRectF scaledBoundingRect( double sx, double sy ) const;
QRectF boundingRect() const;
QRectF controlPointRect() const;
const QVector< QwtPainterCommand > &commands() const;
void setCommands( QVector< QwtPainterCommand > & );
void setDefaultSize( const QSizeF & );
QSizeF defaultSize() const;
void setRenderHint( RenderHint, bool on = true );
bool testRenderHint( RenderHint ) const;
protected:
virtual QSize sizeMetrics() const;
virtual void drawPath( const QPainterPath & );
virtual void drawPixmap( const QRectF &,
const QPixmap &, const QRectF & );
virtual void drawImage( const QRectF &,
const QImage &, const QRectF &, Qt::ImageConversionFlags );
virtual void updateState( const QPaintEngineState &state );
private:
void updateBoundingRect( const QRectF & );
void updateControlPointRect( const QRectF & );
class PathInfo;
class PrivateData;
PrivateData *d_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::RenderHints )
Q_DECLARE_METATYPE( QwtGraphic )
#endif
QwtNullPaintDevice::sizeMetrics
virtual QSize sizeMetrics() const =0
QwtNullPaintDevice::updateState
virtual void updateState(const QPaintEngineState &)
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