At 09:56 AM 8/24/2004, you wrote:
>BmpCreate does work. However, on Palm OS 5, you can't directly >access the
>data structures used by the OS. Instead, you should use the SDK and glue
>library calls (BmpGlue.h and Bitmap.h) to handle accessing this >data.

So basically the value returned by OS 5 is a handle, not a pointer? I can see that a whole range of data can be retrieved from a bitmap, but how can I get direct write access to pixel oriented data. Is there a LockSurface type construct (like in MS Direct X)? Even a BmpSetBits from a local buffer would do!

If you create an offscreen bitmap, you can directly access its bits after calling BmpGetBits. However, you can't directly access the screen bitmap in a portable way -- you need to double buffer, using the offscreen bitmap and calling WinCopyRectangle. You might want to use WinCreateBitmapWindow or WinCreateOffscreenB


Of course, you can hack around this if you can verify the action of specific hardware. Some of the game toolkits already contain these hacks, but will use safe code paths on unverified devices.

The API reference says that direct access to bitmaps is only disallowed for bitmaps created by Palm OS - does this mean there is an alternative method of defining a bitmap - e.g. by allocating enough space for the header and the data? If so, would that bitmap draw correctly i I call WinPaintBitmap?

Sure, you can make your own bitmap structures. The code in the BmpRsrc sample from the PalmSource KB (http://kb.palmsource.com/) illustrates this technique.


-- Ben Combee, DTS technical lead, PalmSource, Inc.
   "Combee on Palm OS" weblog: http://palmos.combee.net/
   Palm OS Dev Fourm Archives: http://news.palmos.com/read/all_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