Jump to content


Photo

Windows Mobile RGB565 format problem

- - - - -

  • Please log in to reply
No replies to this topic

#1
Haddes

Haddes

    Newbie

  • Members
  • Pip
  • 1 posts
Hello there, to all developers.

I have this very weird problem for which i couldn't find any answer.It goes like this:
I'm developing a graphical app for pocket pc devices using DirectDraw Api with vs8(.net 2005) and windows mobile 6 SDK. Since i don't have double buffer native support, i simply use 2 LPDIRECTDRAWSURFACE objects, one as a primebuffer and one as a backbuffer.
As a test, i fill the backbuffer surface with a color and display it.This works fine.
Then i create a compatible bitmap using CreateDIBSection and read the color bytes from (void**)lpByte i receive into a new bitmap and blit it to the background. Basically i am copying the background and then bliting it back.

The problem: i get wrong data. When I initially fill the background, i use a WORD value (since color is displayed using RGB16 16 bits format) for example 65 535 which means 16 bits with value 1 each. So i get a white background.So far, so good.

When i read the values from that lpByte pointer of type LPBYTE, i get bytes with values of 255 and 127 which means every second byte looses it's most important bit, so when i create the WORD value by reading every 2 bytes, i get a value of 32 767 so, when i display the bitmap, i get a yellowish color.
It actually gets worse if i do this with textures.

  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users