OdeeanRDeathshead
07-02-2006, 02:07 PM
I have been trying to read in a 16 bit bitmap but I am having a hard time getting the clours correct.
The code that determines position and reading the data are good. I think this because I do get a picture that looks correct, but the colours are wrong.
here is the code to put the colours in....
ushort q=0;
memcpy(&q,((ushort*)(readBuffer+(Lindex*ReadBytesPerPixcel ) )),ReadBytesPerPixcel);
ushort rr=(( (q )& 0x001f )<<3);
ushort gg=(( (q>>5 )& 0x003f )<<2);
ushort bb=(( (q>>11)& 0x001f )<<3);
ushort qQ= ( (rr>>3)<<11) | ((gg>>2)<<5) | ((bb>>3));
*((ushort*)(tempBuffer+(Tindex*bytesPerPixcel)))=q Q;
the readbytesperpixcel and bytesperpixcel are both 2 (ie 16 bits) int this instance. The bitmap is also a 16 bit bitmap that opens in pie properly.
The device is a 565 display.
The code that determines position and reading the data are good. I think this because I do get a picture that looks correct, but the colours are wrong.
here is the code to put the colours in....
ushort q=0;
memcpy(&q,((ushort*)(readBuffer+(Lindex*ReadBytesPerPixcel ) )),ReadBytesPerPixcel);
ushort rr=(( (q )& 0x001f )<<3);
ushort gg=(( (q>>5 )& 0x003f )<<2);
ushort bb=(( (q>>11)& 0x001f )<<3);
ushort qQ= ( (rr>>3)<<11) | ((gg>>2)<<5) | ((bb>>3));
*((ushort*)(tempBuffer+(Tindex*bytesPerPixcel)))=q Q;
the readbytesperpixcel and bytesperpixcel are both 2 (ie 16 bits) int this instance. The bitmap is also a 16 bit bitmap that opens in pie properly.
The device is a 565 display.