Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QImage, ARGB and RGBA, alpha channel is never first in raw bits
Qt 6.11 is out! See what's new in the release blog

QImage, ARGB and RGBA, alpha channel is never first in raw bits

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 2.3k 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.
  • T Offline
    T Offline
    theonlylawislove
    wrote on last edited by
    #1

    I have an image that I am setting it's pixels to QColor(200, 201, 203, 155) (R:200,G:201,B:203,A:155).

    When using Format_RGBA8888, the raw bits are ordered in RGBA, which is expected.

    However, when using Format_ARGB32, the raw bits are ordered in BGRA, which is seemingly incorrect. I expected ARGB.

    What format should I used to get the alpha channel represented as the first byte of each pixel (32bit)?

    1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #2

      The result you are having is just dictated by the endianness of your system. You can see it in https://code.woboq.org/qt5/qtbase/src/gui/image/qimage.cpp.html#2374

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      1 Reply Last reply
      2

      • Login

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