RGB interpreted as BGR
Posted: Tue Dec 27, 2011 9:25 am
Hi,
Lately, I've been working on my 24-bpp blitting code. Before setting a mode, I do certain checks on it to find whether it's usable or not. One of this includes checking whether the pixel format for the mode is acceptable or not. As of now, "acceptable" includes only 8:8:8 RGB for 24-bpp.
To verify this, I use the *MaskSize and *FieldPosition fields provided by VBE Function 01h.
Now comes the strange part.
On Bochs, QEMU (without "-std xyz"), QEMU (with "-std vga") and virtualbox, the reported 24-bpp modes are in the 8:8:8 RGB format, as desired.
On QEMU (without "-std xyz"), the colors come up exactly as expected. On every other emulator, the colors are a little messed up, as would happen if a 8:8:8 RGB input image is interpreted as 8:8:8 BGR. I've attached two screenshots, which describe the scenario.
(oh, and I'm pretty sure my input image is RGB)
Screenshot 1
QEMU (without "-std xyz")
Screenshot 2
Every other emulator
Unfortunately, both of my test beds don't support 24-bpp modes, so I've been unable to record the output on real machines. I'm pretty sure I'm doing something wrong - so guidance would be wanted.
Regards,
Shikhin
Lately, I've been working on my 24-bpp blitting code. Before setting a mode, I do certain checks on it to find whether it's usable or not. One of this includes checking whether the pixel format for the mode is acceptable or not. As of now, "acceptable" includes only 8:8:8 RGB for 24-bpp.
To verify this, I use the *MaskSize and *FieldPosition fields provided by VBE Function 01h.
Now comes the strange part.
On Bochs, QEMU (without "-std xyz"), QEMU (with "-std vga") and virtualbox, the reported 24-bpp modes are in the 8:8:8 RGB format, as desired.
On QEMU (without "-std xyz"), the colors come up exactly as expected. On every other emulator, the colors are a little messed up, as would happen if a 8:8:8 RGB input image is interpreted as 8:8:8 BGR. I've attached two screenshots, which describe the scenario.
(oh, and I'm pretty sure my input image is RGB)
Screenshot 1
QEMU (without "-std xyz")
Screenshot 2
Every other emulator
Unfortunately, both of my test beds don't support 24-bpp modes, so I've been unable to record the output on real machines. I'm pretty sure I'm doing something wrong - so guidance would be wanted.
Regards,
Shikhin