Loading...
Searching...
No Matches
qwt_graphic.h
/******************************************************************************
* 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>
class QwtPainterCommand;
class QPixmap;
class QImage;
class QWT_EXPORT QwtGraphic : public QwtNullPaintDevice
{
public:
enum RenderHint
{
RenderPensUnscaled = 0x1
};
Q_DECLARE_FLAGS( RenderHints, RenderHint )
enum CommandType
{
VectorData = 1 << 0,
RasterData = 1 << 1,
Transformation = 1 << 2
};
Q_DECLARE_FLAGS( CommandTypes, CommandType )
QwtGraphic();
QwtGraphic( const QwtGraphic& );
virtual ~QwtGraphic();
QwtGraphic& operator=( const QwtGraphic& );
void reset();
bool isNull() const;
bool isEmpty() const;
CommandTypes commandTypes() const;
void render( QPainter* ) const;
void render( QPainter*, const QSizeF&,
Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
void render( QPainter*, const QPointF&,
Qt::Alignment = Qt::AlignTop | Qt::AlignLeft ) const;
void render( QPainter*, const QRectF&,
Qt::AspectRatioMode = Qt::IgnoreAspectRatio ) const;
QPixmap toPixmap( qreal devicePixelRatio = 0.0 ) const;
QPixmap toPixmap( const QSize&,
Qt::AspectRatioMode = Qt::IgnoreAspectRatio,
qreal devicePixelRatio = 0.0 ) const;
QImage toImage( qreal devicePixelRatio = 0.0 ) const;
QImage toImage( const QSize&,
Qt::AspectRatioMode = Qt::IgnoreAspectRatio,
qreal devicePixelRatio = 0.0 ) const;
QRectF scaledBoundingRect( qreal sx, qreal sy ) const;
QRectF boundingRect() const;
QRectF controlPointRect() const;
const QVector< QwtPainterCommand >& commands() const;
void setCommands( const QVector< QwtPainterCommand >& );
void setDefaultSize( const QSizeF& );
QSizeF defaultSize() const;
qreal heightForWidth( qreal width ) const;
qreal widthForHeight( qreal height ) const;
void setRenderHint( RenderHint, bool on = true );
bool testRenderHint( RenderHint ) const;
RenderHints renderHints() const;
protected:
virtual QSize sizeMetrics() const QWT_OVERRIDE;
virtual void drawPath( const QPainterPath& ) QWT_OVERRIDE;
virtual void drawPixmap( const QRectF&,
const QPixmap&, const QRectF& ) QWT_OVERRIDE;
virtual void drawImage( const QRectF&, const QImage&,
const QRectF&, Qt::ImageConversionFlags ) QWT_OVERRIDE;
virtual void updateState( const QPaintEngineState& ) QWT_OVERRIDE;
private:
void renderGraphic( QPainter*, QTransform* ) const;
void updateBoundingRect( const QRectF& );
void updateControlPointRect( const QRectF& );
class PathInfo;
class PrivateData;
PrivateData* m_data;
};
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::RenderHints )
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtGraphic::CommandTypes )
Q_DECLARE_METATYPE( QwtGraphic )
#endif
QVector< QwtPainterCommand >
QwtGraphic
A paint device for scalable graphics.
Definition qwt_graphic.h:76
QwtGraphic::RenderHint
RenderHint
Definition qwt_graphic.h:83
QwtGraphic::RenderHints
QFlags< RenderHint > RenderHints
Definition qwt_graphic.h:99
QwtGraphic::CommandTypes
QFlags< CommandType > CommandTypes
Definition qwt_graphic.h:117
QwtGraphic::CommandType
CommandType
Definition qwt_graphic.h:106
QwtNullPaintDevice
A null paint device doing nothing.
Definition qwt_null_paintdevice.h:33
QwtNullPaintDevice::sizeMetrics
virtual QSize sizeMetrics() const =0
QwtPainterCommand
Definition qwt_painter_command.h:33