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

QPainter stroking on transparent QImage then blit to QOpenGLWidget shows halo artifacts on stroke



    • Type: Bug
    • Status: Reported
    • Priority: P3: Somewhat important
    • Resolution: Unresolved
    • Affects Version/s: 5.13.1
    • Fix Version/s: None
    • Component/s: GUI: OpenGL
    • Labels:
    • Environment:
      MacBook Pro (15-inch, 2018)
      Radeon Pro 560X 4 GB
      Intel UHD Graphics 630 1536 MB
    • Platform/s:
      macOS, Windows


      referring to this article, i see someone else has also run into this, but did not get a satisfactory answer.

      I am implementing what on macOS Carbon is known as a "transparency layer", that is, you begin a transparency context (basically create a transparent QImage the size of the canvas you're drawing on), do your drawing (with transparency), finish your context, then blit the contents of that context as a whole with a specified transparency (this is to achieve "fade away" via animation) (done by first iterating over all pixels and multiplying the alpha channel by the desired transparency, then blitting)

      When i use QWidget, my stroked paths (text) look creamy smooth along the edges, as if everything is in fact being handled as straight alpha: see screen shot QWidget.

      However, if i switch to using QOpenGLWidget, my stroked paths appear to have a crusty border, as if they were drawn with premul-over-black alpha: see screen shot QOpenGLWidget

      No other code changes except swapping QOpenGLWidget for QWidget.

      I feel sure this is a bug. Note if i attempt to manually unmultiply, things look much worse, so i don't think it's PRECISELY a premul thing. (and i know my manual unmultiply works because unit tests)

      (Ignore for now the fact that it's white-on-white, i know that, i'm NOT drawing the black text behind the stroke to more clearly illustrate the halo around the strokes)


        1. QOpenGLWidget.png
          53 kB
        2. QWidget.png
          50 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.



            lagocs Laszlo Agocs
            davecotter David M. Cotter
            0 Vote for this issue
            2 Start watching this issue



                Gerrit Reviews

                There are no open Gerrit changes