Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Graphics scene add point for generate image is not working as expected



  • Expected image
    2153cb33-6d54-4fdf-bd66-ad14464db44d.jpeg

    Generating image
    Screenshot from 2019-12-30 11-06-50.png
    Code

    QColor color(QColor(r,g,b));
    double rad =10;
    scene->addLine(x y,x+rad, y),QPen(color,100,Qt::SolidLine, Qt::FlatCap,Qt::RoundJoin));

    How to smoothen edges?


  • The two images do not seem to present the same data (e.g. the orange and dark blue areas are completely absent).

    You are adding short horizontal line segments 10 units long and 100 units wide, not points. These will overlay each other and probably not be helping.

    If the data is a point grid then you should draw square "pixels" of the correct size for each point. If the data grid is coarser than the desired result image then you may need to interpolate between adjacent data points to synthesise a smooth pixel grid.

    Are you sure that a QImage is not a better target for this point data?


Log in to reply