BmpGetBits?
Well, I'm still trying to figure out if I have to parse the bits or the
bytes.
So far I came up with this function that of course doesn't work properly:
static void makeBmpDarker(BitmapPtr bitmap, float alpha)
{
// alpha from 0 to 1
UInt32 dataSize;
UInt32 headerSize;
UInt32 bytesSize;
unsigned char *bitmapData;
int pixel,i;
UInt8 depth;
depth = BmpGetBitDepth(bitmap);
BmpGetSizes (bitmap, &dataSize, &headerSize);
bytesSize = BmpBitsSize(bitmap);
bitmapData = BmpGetBits(bitmap);
for(i=0; i<bytesSize; i++){
pixel = bitmapData[i];
pixel = (int) (pixel * alpha);
bitmapData[i] = pixel;
}
}
Basically I found out that the depth is 8 bit, despite of course the
image was 4, and debugging it, basically the pixel is always 255, when
instead there should be some 0.
Can anyone see macro errors here?
Any suggestion will be very helpful.
Thanks, chr
--
___________________________________________________________________
{ Christian Giordano's site and blog @ http://nuthinking.com }
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/