Erico Franco wrote:
In my case, my application is only for palmos 5 devices, so
BmpGlueSetTransparentValue() would not be applied.
Also I will only use 16-bit images.
The point is that how to pass the 16-bit transparentColor to it?
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);
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.)
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
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/