If the 16-bit color needs to be in the same format as the pixels in the 16-bit bitmap, then you need to pack the r, g, and b values into a 16-bit integer. Something along these lines:UInt16 Make16BitRGBValue (UInt16 r, UInt16 g, UInt16 b) { return (r & 0x1f << 11 | g & 0x3f << 5 | b & 0x1f); } UInt16 brightwhite = Make16BitRGBValue (31, 63, 31); UInt16 brightred = Make16BitRGBValue (31, 0, 0); UInt16 black = Make16BitRGBValue (0, 0, 0);
Yes, this works!! great job! thanks Logan!
By the way, I'm not positive that it does need to be exactly the same format as the pixel data within the bitmap; I'm merely explaining what format that would be if so. (But it would explain why things with non-zero values don't work correctly -- you've got RGB values spread out over the whole 32-bit word when you need them all packed into a 16-bit word.)
the format is different but I can retrieve the values from bmp resource and use it for my jpeg resources. Now everything is easy that you gave me the right directions.
One other approach to all this is to go have a look at the BitmapRsrc stuff that is available in the palmsource.com (I think) knowledgebase. It has example source code for functions that create bitmaps and do all kinds of manipulations on bitmaps it creates. By looking at the source code, you can gain insight into how the bitmaps work and what they are expecting. (Not all valid Palm bitmaps are compatible with its code, since it is apparently meant as a method of creating bitmaps in a known format, but the stuff you can learn from it is still valuable.)
- Logan
I'll take a look there. thanks for your help! Erico Franco -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
