Solved Problem with visualisation (straight lines look like broken lines)
-
Hello, i try to draw some lines and some polygons, all fine, but straight lines look like broken lines. I don't know, it's visualisation problem or something else, I will be glad to hear advice.
For drawing i use qwt components
class CurveSingle: public QwtPlotCurve ... cm = new CurveSingle(); cm->setRenderHint(QwtPlotCurve::RenderAntialiased, true); ...
Draw series
QBrush brush; QPen p; p.setJoinStyle(Qt::RoundJoin); p.setCapStyle(Qt::RoundCap); brush.setStyle(Qt::SolidPattern); QPainterPath path; path.addPolygon(poly); painter->drawPolygon(poly); painter->fillPath(path, brush);
Example of lines
-
the problem you present is called aliasing. Antialiasing is the solution and QT has methods that "hint" how to deal with it. The process involves blending border pixels so that the edges fade into the background without looking so sharp.
See http://www.java2s.com/Code/Cpp/Qt/SetrenderhinttoQPainterAntialiasing.htm
-
the problem you present is called aliasing. Antialiasing is the solution and QT has methods that "hint" how to deal with it. The process involves blending border pixels so that the edges fade into the background without looking so sharp.
See http://www.java2s.com/Code/Cpp/Qt/SetrenderhinttoQPainterAntialiasing.htm
-
@Kent-Dorfman ty, looks better, but a bit aliasing still present. Maybe exist some parameters like "degree of antialiasing"?
-
@zloi_templar some GPUs can also do a good job of antialiasing in opengl with the right settings but since you're using QPainter that's not really a direct option. Experimentation is a required part of becoming a subject matter expert.