Hey
I am begginer in QT and I would like to transform bitmap file to byte array (RGB332 format).
Any ideas how to do this?
Regards
Printable View
Hey
I am begginer in QT and I would like to transform bitmap file to byte array (RGB332 format).
Any ideas how to do this?
Regards
As far as I know Qt doesn't support RGB332 natively so you'd need to do the transformation yourself and then store values into QByteArray using its API.
Thx for the reply.
At the moment I have problem with getting RGB values.
Code:
... ... for (int j = 0; j < 640; j++ ){ buffer[j] = (tempColor.red() & 0xE0>> 16) | (tempColor.green() & 0xE0 >> 8) | tempColor.blue() & (0xC0 >> 6); }
This should read and store to buffer one row of image. Image is opened correctly but data in buffer is not correct. For example for one color bitmap it gives almost random values (smth like 8 pixels blue then 12 black then 11 yellow etc). Diffrent images gives different results. I also tried different formats with no effect.
What am I doing wrong?
There is error in above code, should be:
but it dosen't change much.Code:
buffer[j] = (tempColor.red() & 0xE0) | (tempColor.green() & 0xE0 >> 3) | tempColor.blue() & (0xC0 >> 6);
Why I can't edit my posts after some time?
buffer has type unsigned char* so I think I am writing 8 bits to 8 bits?
Anyway, here is result displayed on crt monitor and oryginal file(had to convert it to jpeg to upload here):
Attachment 7272
Attachment 7271
Any clues?
Solved. Problem was somewhere else...