[英]QPainterPath stroke artifacts
I am putting together a QPainterPath
with text, then I'm drawing it, first with QPainter::strokePath
, then with QPainter::fillPath
. 我将
QPainterPath
和文本放在一起,然后绘制,首先是QPainter::strokePath
,然后是QPainter::fillPath
。 However, the stroke exhibits artefacts, as shown in the image. 但是,该笔画显示了伪影,如图中所示。 Anything I am doing wrong/how to prevent this?
我做错了/如何防止这种情况? Should I report it as a bug?
我应该将其报告为错误吗?
I've found out that instead of using strokePath
and fillPath
, the following code works without artefacts and is even faster to render: 我发现,以下代码不是使用
strokePath
和fillPath
,而是在没有伪影的情况下工作,并且渲染速度更快:
if(outlineEnabled) {
p.setBrush(Qt::NoBrush);
p.setPen(QPen(outlineColor, outlineWidth/scaleFactor, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
for(const auto &polygon : path.toSubpathPolygons())
p.drawPolygon(polygon, Qt::OddEvenFill);
}
p.setBrush(color);
p.setPen(Qt::NoPen);
for(const auto &polygon : path.toFillPolygons())
p.drawPolygon(polygon, Qt::OddEvenFill);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.