I have a program which sends images over the network. I manually create pixels (using QRgb
class) and I insert them into QDataStream
. It is quite easy when there are 16 or 32 bits per pixel (I can insert quint16
or quint32
), but in RGB888 (24 bits per pixel) I have to use three quint8
variables. But I'm not sure the order of bytes when QDataStream
has:
// output is QDataStream object
output.setByteOrder(QDataStream::BigEndian);
Should I insert in that order to correctly read this stream later?
// red, green and blue are quints8
output << blue;
output << green;
output << red;
EDIT: I know that setting BigEndian
doesn't matter when I use only quint8
but I want to put colors in such order, as in the case when Qt makes byte resorting (quint32
and setByteOrder
).