"The pixel is represented by a 24-bit value, with the most significant bit unused, A in bits 15-22, R in bits 10-14, G in bits 5-9 and B in bits 0-4..."
Looking into Qt source code, it appears the alpha byte actually comes first aligned to a whole byte, and the unused bit is just beyond red (yeah, this format is rather inconsistent with Qt's other names 😑).
Bit stream layout
byte |[ 0 ] [ 1 ] [ 2 ]|
bit |0 1 2 3 4 5 6 7|0 1 2 3 4|5 6 7 0 1|2 3 4 5 6|7|
|[ alpha ]|[ blue ]|[ green ]|[ red ]|0|
Motivation
I'm working on a generic pixel format viewer, supporting formats declaratively rather than hard-coded code (and so your project has been quite useful ☺ - thanks). e.g.
Qt_QImage_Format_ARGB8555_Premultiplied:{
alphaPremulUnorm8
blueUnorm5
greenUnorm5
redUnorm5
unused1
notes:{
"The image is stored using a premultiplied 24-bit ARGB format (8,5,5,5,_)."
"The documentation and actual code mismatch, as the alpha byte actually comes first, despite what the format name would imply."
}
}
From https://afrantzis.com/pixel-format-guide/qt.html:
Looking into Qt source code, it appears the alpha byte actually comes first aligned to a whole byte, and the unused bit is just beyond red (yeah, this format is rather inconsistent with Qt's other names 😑).
Bit stream layout
Motivation
I'm working on a generic pixel format viewer, supporting formats declaratively rather than hard-coded code (and so your project has been quite useful ☺ - thanks). e.g.
References
https://github.com/openwebos/qt/blob/master/src/gui/painting/qdrawhelper_p.h#L1121
https://github.com/openwebos/qt/blob/master/src/gui/image/qimage.cpp#L5018
This applies to qargb8565 too:
https://github.com/openwebos/qt/blob/master/src/gui/painting/qdrawhelper_p.h#L822
Want me to create a PR?