Hi all,

I have been working on the issue in handling the transparency of the bmp images in device for a long time. Someone please guide us in resolving this issue. I have created an offscreen window to cut a small portion of the bmp and display in the active window at the specified location. The bmp looses its transperancy when using CreateBitmapWindow. But in my application i need to use Off screen window to cut out a small portion and need to display it at a specified location.

When i tried with CreateBitmapWndow , i passed awindow handle to this CreateBitmapWindow and passed it to another window handle and used WinCopyRectangle to draw the image. By doing so i get the necessary transperancy.

Why this is not happening in offscreen window..

void test()
{
UInt16 error;
Coord bitmapWidth, bitmapHeight;
UInt16 bitmapRowBytes;
UInt32 transparentValueP2 ;

//Get a pointer to the bitmap
MemHandle bitmapHnd = DmGetResource(bitmapRsc,1006);

ErrFatalDisplayIf(!bitmapHnd, "Could Not Get Bitmap Resource");
BitmapType* bitmapP = (BitmapType*) MemHandleLock(bitmapHnd);
//BmpGlueGetDimensions (bitmapP, &bitmapWidth, &bitmapHeight,&bitmapRowBytes);

WinHandle tempW;

tempW = WinCreateOffscreenWindow(31,8, screenFormat, &error);
//tempW = WinCreateBitmapWindow(bitmapP, &error);

WinHandle screenH = WinSetDrawWindow(tempW);

//WinDrawBitmap(bitmapP, 0, -24);

WinDrawBitmap(bitmapP, 0, -24);

WinSetDrawWindow(screenH);

MemHandleUnlock(bitmapHnd);
DmReleaseResource(bitmapHnd);

//BmpGlueSetTransparentValue( NULL,transparentValueP2);
//BmpSetTransparentValue (bitmapP,&transparentColor2);

RectangleType bounds;

//if you do not already have it, get the handle to the screen
//WinHandle screenH = WinGetDrawWindow();

WinGetBounds(tempW, &bounds);


//given that drawToX, and drawToY are the top left coords of
//where you want to draw to...
//Also, you can substitute other copy modes for winPaint
WinCopyRectangle(tempW, screenH, &bounds,65, 144, winOverlay);

WinDeleteWindow(tempW, false);
SysTaskDelay(10);

}




--
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to