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. QPainter Color Shift (red/blue swapped) on mobile devices
Forum Updated to NodeBB v4.3 + New Features

QPainter Color Shift (red/blue swapped) on mobile devices

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
4 Posts 3 Posters 900 Views 2 Watching
  • 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.
  • JS_caigosJ Offline
    JS_caigosJ Offline
    JS_caigos
    wrote on last edited by
    #1

    I'm drawing an png image using Qt 5.6 (commercial), Qt Creator (for the mobile program), Visual Studio 2013 (for the windows program): basically I'm using QPainter and QImage for rendering
    Here are some lines of my code:
    QImage img(w, h, QImage::Format_ARGB32_Premultiplied);
    img.fill(Qt::transparent);
    QPainter qpainter(img);
    qpainter.setRenderHint(QPainter::Antialiasing, true);

    This works fine for rendering an image on Windows. When rendering the image on a mobile devices (in my case a Samsung Galaxy Tablet) the colors are shiftet. To be precise red and blue are swaped. I copied this image from the tablet to windows and the image has still shifted colors. Thus it seems to be a problem in the rendering process.

    Using an image with alpha channel is important. I can't switch to a format whithout alpha.
    I tried some other alpha channel formats, e.g. Format_ARGB32. But the color problem still occurs.

    I changed the program such that it swaps red/blue and the picture rendered on the tablet looks fine (of course now rendering on windows results in wrong colors). But this is not a good solution, since I dont now if this behavior is on every tablet the same.

    Is there something known about this color shifts on mobile devices? Do you have any suggestions?

    Thanks a lot,

    Jörg

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mvuori
      wrote on last edited by
      #2

      The colour formats should work just fine on Android. One possibility with is always a bug in some seemingly unrelated function, so I would remove and change parameters on every function used, starting with setRenderHint.

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #3

        Hi and welcome to devnet,

        Which version of Android are you using ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • JS_caigosJ Offline
          JS_caigosJ Offline
          JS_caigos
          wrote on last edited by
          #4

          We use a Samsung SMT710 with Android Version 5.0.2 Patch 20151101

          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