Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Gradient Banding Problem (Qt 4.6, 18bit display)
QtWS25 Last Chance

Gradient Banding Problem (Qt 4.6, 18bit display)

Scheduled Pinned Locked Moved Mobile and Embedded
6 Posts 3 Posters 5.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Matthias
    wrote on last edited by
    #1

    Hi all,

    I evaluate "Qt Everywhere 4.6.3" for an application running on Windows Mobile 6.5 Pro (18bit color depth display).
    It seems Qt automatically switches color rendering to 16bit color depth as all gradients have banding-problems (lines).

    Are there any solutions for this? I use QPainter and QGradient and already tried to draw an overlay QPixmap with dithering noise at the end of the paint method with no effect. When drawing QPixmaps with both gradients and dithering-noise in it it works well. Is there a solution for either forcing Qt to use the 18bit available or to draw QGradients with a dithering mask / effect.

    Thanks in advance,
    Matthias

    1 Reply Last reply
    0
    • A Offline
      A Offline
      andre
      wrote on last edited by
      #2

      Is it an option to just put your gradients in images beforehand, and using those? That is usually faster than rendering them using QGradient. At least, that is the recommended way of working for Quick.

      1 Reply Last reply
      0
      • M Offline
        M Offline
        Matthias
        wrote on last edited by
        #3

        Thanks for your reply. Some controls are flexible in height and width. So it would be a lot more flexible to work with QGradient. I also tried to draw the gradient into a pixmap first, adding a tiled dither-bitmap to it and in the end draw this pixmap with the control painter. But this had no other effect than directly drawing gradient and mask one after another. The banding lines are still visible. It seems the 16bit conversion is done directly by QPainter. So what I need is either real 18bit drawing or the possibility to create 24bit pixmaps by code (gradient + overlay dithering bitmap).

        1 Reply Last reply
        0
        • A Offline
          A Offline
          andre
          wrote on last edited by
          #4

          What happens if you draw on a QImage first (in as many bits as you like), and use that?

          As for using a pixmap approach, perhaps you can leverage QSS for that (the style sheet system). It supports the border-image property, that you can use to use an image to style an object of unknown size. It will auto stretch in an appropriate way.

          1 Reply Last reply
          0
          • M Offline
            M Offline
            Matthias
            wrote on last edited by
            #5

            Thanks a lot for the hint with QImage. I get better results when drawing into a QImage first (ARGB_32 format) and afterwards drawing this image with the control painter. I'm currently experimenting with different composition modes for QPainter and different dithering masks to get the gradients as smooth as possible. Thanks for the help.

            1 Reply Last reply
            0
            • Z Offline
              Z Offline
              ZapB
              wrote on last edited by
              #6

              The reason is that QPixmap is directly tied to the underlying hardware capabilities. QImage is purely software. On the plus side, you can put your QImage generation into a worker thread so as not to block the main GUI thread with those expensive gradient calculations.

              Have fun!

              Nokia Certified Qt Specialist
              Interested in hearing about Qt related work

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved