6#include "QskGraphicPaintEngine.h"
9#include <qpainterpath.h>
13 if ( !engine->isActive() )
16 return static_cast< QskGraphic*
>( engine->paintDevice() );
19QskGraphicPaintEngine::QskGraphicPaintEngine()
20 : QPaintEngine( QPaintEngine::AllFeatures )
24QskGraphicPaintEngine::~QskGraphicPaintEngine()
28bool QskGraphicPaintEngine::begin( QPaintDevice* )
34bool QskGraphicPaintEngine::end()
40QPaintEngine::Type QskGraphicPaintEngine::type()
const
42 return QPaintEngine::User;
45void QskGraphicPaintEngine::updateState(
const QPaintEngineState& state )
47 if (
auto graphic = qskGraphic(
this ) )
48 graphic->updateState( state );
51void QskGraphicPaintEngine::drawPath(
const QPainterPath& path )
53 if (
auto graphic = qskGraphic(
this ) )
54 graphic->drawPath( path );
57void QskGraphicPaintEngine::drawPolygon(
58 const QPointF* points,
int pointCount, PolygonDrawMode mode )
60 if (
auto graphic = qskGraphic(
this ) )
66 path.moveTo( points[ 0 ] );
67 for (
int i = 1; i < pointCount; i++ )
68 path.lineTo( points[ i ] );
70 if ( mode != PolylineMode )
74 graphic->drawPath( path );
78void QskGraphicPaintEngine::drawPolygon(
79 const QPoint* points,
int pointCount, PolygonDrawMode mode )
81 if (
auto graphic = qskGraphic(
this ) )
87 path.moveTo( points[ 0 ] );
88 for (
int i = 1; i < pointCount; i++ )
89 path.lineTo( points[ i ] );
91 if ( mode != PolylineMode )
95 graphic->drawPath( path );
99void QskGraphicPaintEngine::drawPixmap(
100 const QRectF& rect,
const QPixmap& pixmap,
const QRectF& subRect )
102 if (
auto graphic = qskGraphic(
this ) )
103 graphic->drawPixmap( rect, pixmap, subRect );
106void QskGraphicPaintEngine::drawImage(
107 const QRectF& rect,
const QImage& image,
108 const QRectF& subRect, Qt::ImageConversionFlags flags )
110 if (
auto graphic = qskGraphic(
this ) )
111 graphic->drawImage( rect, image, subRect, flags );
114void QskGraphicPaintEngine::drawTextItem(
115 const QPointF& position,
const QTextItem& textItem )
118 QPaintEngine::drawTextItem( position, textItem );
A paint device for scalable graphics.