Details
-
Bug
-
Resolution: Out of scope
-
P2: Important
-
4.3.2, 4.5.3, 4.6.0
-
None
Description
I would have expected the red ellipse to completely cover the white ellipse.
This does not seem to be the case. One can see a little bit of the white ellipse.
#include <QtGui> int main(int argc, char *argv[]) { QApplication app(argc, argv); QImage im(500, 500, QImage::Format_ARGB32_Premultiplied); im.fill(QColor(Qt::blue).rgba()); QPainter p(&im); QPen pen1; pen1.setStyle(Qt::DashLine); pen1.setColor(Qt::white); pen1.setCapStyle(Qt::FlatCap); QPen pen2; pen2.setStyle(Qt::SolidLine); pen2.setColor(Qt::red); QPen *pens[] = { &pen1, &pen2, 0 }; for (int i=0; pens[i]; ++i) { pens[i]->setWidthF(150); p.setPen(*pens[i]); p.drawEllipse(100, 100, 300, 300); } QLabel lbl; lbl.setPixmap(QPixmap::fromImage(im)); lbl.show(); return app.exec(); }
Update: as a workaround for this you can use the QPainterPathStroker and setCurveThreshold with a low value (0.0001 or so).
Another workaround is to convert the ellipse to a polygon using QPainterPath::addEllipse and QPainterPath::toFillPolygon, and then draw the polygon instead. This avoids some of the inaccuracies in the curve stroker and should give overlapping outlines with different pen styles.
Attachments
Issue Links
- replaces
-
QTBUG-5587 QPainter::drawEllipse with thick pens
- Closed
- resulted in
-
QTBUG-199 Numerical instability in bezier part of paths
- Closed