Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-65172

Incorrect resutl of PenJoinStyle::RoundJoin

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P2: Important
    • None
    • 5.9.3
    • GUI: Painting
    • None

    Description

      The RoundJoin flag works incorrectly according to cairo library and SVG spec.

      The problem is that RoundJoin should not join closed segments.

      This also affects SVG rendering.

       

      Example: 

      #include <QApplication>
      #include <QPainter>
      
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
      
          QImage img(128, 128, QImage::Format_ARGB32_Premultiplied);
          img.fill(Qt::transparent);
      
          QPainterPath path;
          path.moveTo(100, 20);
          path.lineTo(100, 80);
          path.lineTo(20, 50);
          path.lineTo(100, 20); // back to start without ClosePath
      
          QPen pen(QColor("#39D"), 15);
          pen.setJoinStyle(Qt::RoundJoin);
      
          QPainter p;
          p.begin(&img);
          p.setRenderHint(QPainter::Antialiasing);
          p.setPen(pen);
          p.drawPath(path);
          p.end();
      
          img.save("test.png");
      
          return 0;
      }
      

       

      Attachments

        1. actual.png
          actual.png
          0.8 kB
        2. expected.png
          expected.png
          0.7 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            qt.team.graphics.and.multimedia Qt Graphics Team
            razrfalcon Evgeniy
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes