21QgsMaskPaintEngine::QgsMaskPaintEngine(
bool usePathStroker )
22 : QPaintEngine( QPaintEngine::AllFeatures )
23 , mUsePathStroker( usePathStroker )
27QPainterPath QgsMaskPaintEngine::maskPainterPath()
const
29 return mMaskPainterPath;
32void QgsMaskPaintEngine::drawPath(
const QPainterPath &path )
34 QPainterPath realPath = path;
35 if ( mUsePathStroker )
37 QPen pen = painter()->pen();
38 QPainterPathStroker stroker( pen );
39 QPainterPath strokedPath = stroker.createStroke( path );
40 realPath = strokedPath;
43 const QTransform transform = painter()->combinedTransform();
44 mMaskPainterPath.addPath( transform.map( realPath ) );
47void QgsMaskPaintEngine::drawPolygon(
const QPointF *points,
int numPoints, QPaintEngine::PolygonDrawMode mode )
52 polygon.reserve( numPoints );
53 for (
int i = 0; i < numPoints; ++i )
56 const QTransform transform = painter()->transform();
57 mMaskPainterPath.addPolygon( transform.map( polygon ) );
64 mPaintEngine = std::make_unique<QgsMaskPaintEngine>( usePathStroker );
69 return mPaintEngine.get();
79 val =
static_cast< int >( mPaintEngine->maskPainterPath().boundingRect().width() );
82 val =
static_cast< int >( mPaintEngine->maskPainterPath().boundingRect().height() );
104 case PdmDevicePixelRatio:
107 case PdmDevicePixelRatioScaled:
108 val =
static_cast< int >( 1 * QPaintDevice::devicePixelRatioFScale() );
112 qWarning(
"QPicture::metric: Invalid metric command" );
119 return mPaintEngine->maskPainterPath();
Q_DECL_DEPRECATED QgsMaskPaintDevice(bool usePathStroker=false)
Q_DECL_DEPRECATED QPainterPath maskPainterPath() const
Returns the mask painter path painted on this paint device.
int metric(PaintDeviceMetric metric) const override
QPaintEngine * paintEngine() const override
static int qtDefaultDpiY()
Returns the default Qt vertical DPI.
static int qtDefaultDpiX()
Returns the default Qt horizontal DPI.