Why do you draw the bitmap in an offscreen window first? I know that this
method makes custom drawing faster, but just for a bitmap wouldn't it be
better to draw it directly to the screen?
What are the benefits of this method?

Sebas.

-----Mensaje original-----
De: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] nombre de Bill
Treloar
Enviado el: lunes, 26 de mayo de 2003 22:13
Para: Palm Developer Forum
Asunto: Need help with 16 bit high res display on the Tungsten


I have not been able to display a bitmap at high resolution 16 bit color.
This code works great with the simulator the displayed bitmap looks good,
but the display on my Tungsten T is pixeled.  I must be missing something
crucial.  Any suggestions or hints?

Boolean CopyBitmap (int iResourceID, int x, int y)
{

 // given that there is a global declared
 // as WinHandle global_bitmapWinH;
 UInt16 error;
 Coord bitmapWidth, bitmapHeight;
 UInt16 bitmapRowBytes;

 //set coordinate system
 WinSetCoordinateSystem (kCoordinatesDouble);
 //Get a pointer to the bitmap
 MemHandle bitmapH = DmGetResource(bitmapRsc, iResourceID);

 ErrFatalDisplayIf(!bitmapH, "Could Not Get Bitmap Resource");
 BitmapType* bitmapP = (BitmapType*) MemHandleLock(bitmapH);
 BitmapTypeV3* bitmapPV3 = BmpCreateBitmapV3(bitmapP, kDensityDouble,
BmpGetBits(bitmapP), NULL);
 BmpGlueGetDimensions (bitmapP, &bitmapWidth, &bitmapHeight,
&bitmapRowBytes);

 //create an offscreen window for the bitmap
 global_bitmapWinH = WinCreateOffscreenWindow(bitmapWidth, bitmapHeight,
nativeFormat, &error);
 ErrFatalDisplayIf(error, "Could Not Create Offscreen Window");

 //draw the bitmap to the offscreen window
 //note that the offscreen window created has the same
 //depth as the screen and WinDrawBitmap will draw the
 //correct bitmap member from the family

 WinHandle screenH = WinSetDrawWindow(global_bitmapWinH);
 WinDrawBitmap(bitmapP, 0, 0);

 //return the draw window to the screen
 WinSetDrawWindow(screenH);

 //you no longer need the bitmapP
 MemHandleUnlock(bitmapH);
 DmReleaseResource(bitmapH);

 RectangleType bounds;

 WinGetBounds(global_bitmapWinH, &bounds);

 //given that drawToX, and drawToY are the top left coords of
 //where you want to draw to...
 WinCopyRectangle(global_bitmapWinH, screenH, &bounds, x, y, winPaint);

 WinDeleteWindow(global_bitmapWinH, false);

 return error;
}



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


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

Reply via email to