24QgsMaskPaintEngine::QgsMaskPaintEngine(
bool usePathStroker )
25 : QPaintEngine( QPaintEngine::AllFeatures )
26 , mUsePathStroker( usePathStroker )
30QPainterPath QgsMaskPaintEngine::maskPainterPath()
const
32 return mMaskPainterPath;
35void QgsMaskPaintEngine::drawPath(
const QPainterPath &path )
37 QPainterPath realPath = path;
38 if ( mUsePathStroker )
40 QPen pen = painter()->pen();
41 QPainterPathStroker stroker( pen );
42 QPainterPath strokedPath = stroker.createStroke( path );
43 realPath = strokedPath;
46 const QTransform transform = painter()->combinedTransform();
47 mMaskPainterPath.addPath( transform.map( realPath ) );
50void QgsMaskPaintEngine::drawPolygon(
const QPointF *points,
int numPoints, QPaintEngine::PolygonDrawMode mode )
55 polygon.reserve( numPoints );
56 for (
int i = 0; i < numPoints; ++i )
59 const QTransform transform = painter()->transform();
60 mMaskPainterPath.addPolygon( transform.map( polygon ) );
67 mPaintEngine = std::make_unique<QgsMaskPaintEngine>( usePathStroker );
72 return mPaintEngine.get();
79 QRectF brect = mPaintEngine->maskPainterPath().boundingRect();
108 case PdmDevicePixelRatio:
111 case PdmDevicePixelRatioScaled:
112 val = 1 * QPaintDevice::devicePixelRatioFScale();
116 qWarning(
"QPicture::metric: Invalid metric command" );
123 return mPaintEngine->maskPainterPath();
QgsMaskPaintDevice(bool usePathStroker=false)
QPainterPath maskPainterPath() const
Returns the mask painter path painted on this paint device.
int metric(PaintDeviceMetric metric) const override
QPaintEngine * paintEngine() const override
Q_GUI_EXPORT int qt_defaultDpiX()
Q_GUI_EXPORT int qt_defaultDpiX()
Q_GUI_EXPORT int qt_defaultDpiY()