Jump to content
Sign in to follow this  

Windows Mobile RGB565 format problem

Recommended 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.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this