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

QPainter::drawText() seems to antialias wrong when solid color is used to paint.

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Reported
    • Priority: P2: Important
    • Resolution: Unresolved
    • Affects Version/s: 5.12.3
    • Fix Version/s: None
    • Component/s: GUI: Painting
    • Labels:
      None
    • Platform/s:
      Windows

      Description

      When painting with QPainter::drawText(), it seems that the colors are off if drawing with a color without any alpha while antialiasing (the parts of the drawn text which should be alpha blended seem wrong).

      I'm attaching a sample program (using PySide2 as it's easier to prototype in Python to show the issue, but should be straightforward to port to C++).

      The sample program creates 2 images, one with an alpha of 254 and another with a solid color (alpha=255)... and saves them to c:/temp, so, may need to be adjusted depending on the platform.

      By zooming the image, it's possible to note that the areas where the alpha-blending should be done with the solid color the colors are weird (they seem to be close to pink/purple vs doing the proper alpha-blending as is the case when an alpha of 254 is used – I'm attaching the results I get on my machine).

       

       

        Attachments

        1. alpha254.png
          alpha254.png
          0.9 kB
        2. alpha255.png
          alpha255.png
          1.0 kB
        3. draw_text_wrong_alpha_blend.py
          1 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

            • Assignee:
              vgt Eirik Aavitsland
              Reporter:
              fabioz Fabio Zadrozny
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:

                Gerrit Reviews

                There are no open Gerrit changes