24 QgsMaskPaintEngine::QgsMaskPaintEngine(
bool usePathStroker )
25 : QPaintEngine( QPaintEngine::AllFeatures )
26 , mUsePathStroker( usePathStroker )
30 QPainterPath QgsMaskPaintEngine::maskPainterPath()
const
32 return mMaskPainterPath;
35 void QgsMaskPaintEngine::drawPath(
const QPainterPath &path )
37 if ( mUsePathStroker )
39 QPen pen = painter()->pen();
40 QPainterPathStroker stroker( pen );
41 QPainterPath strokedPath = stroker.createStroke( path );
42 strokedPath = painter()->combinedTransform().map( strokedPath );
43 mMaskPainterPath.addPath( strokedPath );
47 mMaskPainterPath.addPath( path );
51 void QgsMaskPaintEngine::drawPolygon(
const QPointF *points,
int numPoints, QPaintEngine::PolygonDrawMode mode )
56 polygon.reserve( numPoints );
57 for (
int i = 0; i < numPoints; ++i )
59 mMaskPainterPath.addPolygon( polygon );
66 mPaintEngine = std::make_unique<QgsMaskPaintEngine>( usePathStroker );
71 return mPaintEngine.get();
78 QRectF brect = mPaintEngine->maskPainterPath().boundingRect();
107 case PdmDevicePixelRatio:
110 case PdmDevicePixelRatioScaled:
111 val = 1 * QPaintDevice::devicePixelRatioFScale();
115 qWarning(
"QPicture::metric: Invalid metric command" );
122 return mPaintEngine->maskPainterPath();