Hi Ben ,
I tried using the WinCreateBitmapWindow. Please go through
the following code segment..It still fails to load in device.
MemHandle bitmapHnd;
BitmapPtr bitmapPtr;
WinHandle Wh2;
Coord widthP = NULL;
Coord heightP = NULL;
Err err;
bitmapHnd = DmGetResource (bitmapRsc,Logo);
if (bitmapHnd)
{
bitmapPtr = (BitmapPtr)MemHandleLock (bitmapHnd);
//BmpGetDimensions(bitmapPtr,&widthP,&heightP,NULL);
//WinHandle tempW;
//tempW = WinCreateOffscreenWindow(22, 25,screenFormat ,
&err);// screenFormat
//tempW = WinCreateOffscreenWindow(22, 25,screenFormat , &err);
//WinHandle Wh =
WinCreateOffscreenWindow(widthP,heightP,screenFormat,&err);
// bitmapPtr2 = (BitmapPtr)MemHandleLock (Wh);
WinHandle Wh = WinCreateBitmapWindow(bitmapPtr,&err);
//Wh = WinCreateOffscreenWindow(22, 25,screenFormat , &err);//
screenFormat
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);
Wh2 = WinSetDrawWindow(Wh);
WinSetDrawWindow(Wh2);
//Wh2 = WinGetDrawWindow();
RectangleType bounds;
WinGetBounds(Wh, &bounds);
WinCopyRectangle(Wh, Wh2, &bounds,100, 10, winOverlay );// winPaint
WinDeleteWindow(Wh, false);
//WinDrawBitmap (bitmapPtr, 35, 35);
MemHandleUnlock (bitmapHnd);
DmReleaseResource (bitmapHnd);
Ben Combee wrote:
> 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]
> <mailto:[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/
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/