In this code, you're modifying the header of the bitmap. However, the
bitmap is stored in a resource which is in read-only memory on the storage
heap, so the attempt to change it's header fails and causes the device
reset. You'll need to copy the bitmap resource to the dynamic heap before
modifying it.
On 1/3/07, Anoop <[EMAIL PROTECTED]> wrote:
>
> Hi all,
> Am trying to show a bmp image in a form . I need to set
> transperency to the image to remove the unwanted image data from the
> original image. ie; a pink border from the bmp. Please go through the
> following code segment. The image displays without the pink image in
> emulator. But in device on application selection, device reboots. The
> issue mainly arises at BmpSetTransparentValue. How to deal with this
> issue. Am using Life Drive and the IDE i have chosen is codewarrior for
> palm.
>
> void drawVisionLogo()
> {
> MemHandle bitmapHnd;
> BitmapPtr bitmapPtr;
> bitmapHnd = DmGetResource (bitmapRsc,Logo);
> if (bitmapHnd)
> {
> bitmapPtr = (BitmapPtr)MemHandleLock (bitmapHnd);
>
> RGBColorType transparentColor;
> transparentColor.index=0; // if you change the (0,0,0)
> transparentColor.r = 0x0; // value, the function
> transparentColor.b = 0x0; // will not work!
> transparentColor.g = 0x0; // why?
> // BmpGlueSetTransparentValue((BitmapType*)bitmapPtr,*(UInt32
> *)&transparentColor);
> BmpSetTransparentValue((BitmapType*)bitmapPtr,*(UInt32
> *)&transparentColor);
>
> WinDrawBitmap (bitmapPtr, 35, 35);
> MemHandleUnlock (bitmapHnd);
> DmReleaseResource (bitmapHnd);
>
> }
> }
>
>
>
> --
> For information on using the PalmSource Developer Forums, or to
> unsubscribe, please see http://www.palmos.com/dev/support/forums/
>
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/