0

I want to convert a QImage of format RGB888 to ARGB32 & fetch pixel data as unsigned int*.

I can do the following to convert to ARGB32

QImage new = old.convertToFormat(QImage::Format_ARGB32);

However, are the pixels stored signed or unsigned?

EDIT:

I need a pointer unsigned int* data, such that,

an unsigned int (32 bits) holds a pixel in ARGB format, which from left to right is as follows:

  • the first 8 bits are for the alpha channel (and are ignored)
  • the next 8 bits are for the red channel
  • the next 8 bits are for the green channel
  • the last 8 bits are for the blue channel

How do I do this?

P.C.
  • 651
  • 13
  • 30
  • As Dan Milburn had said: look at how QRgb is defined and there is your answer. Never mind that the question of signedness simply doesn't apply to a type that's used as a bunch of bits. It's unsigned by definition. You never use the entire 32 bit value for anything other than moving the data around. The fact that some numerical interpretation for those *entire* 32 bits exists is immaterial. – Kuba hasn't forgotten Monica Oct 15 '13 at 20:54

1 Answers1

0

Pixels are stored as QRgb, which is a typedef for unsigned int.

Dan Milburn
  • 5,600
  • 1
  • 25
  • 18
  • Can you please see the edit I just made & elaborate a bit more on your answer? Thank you! – P.C. Oct 15 '13 at 17:08