>At 10:18 AM 5/14/2004, you wrote:
>>Does anyone know if it is possible to call BmpCreate to create a bitmap,
and
>>then set the owner of that bitmap to 0 so that the entire bitmap does not
>>get freed by the system when you exit your app?  Simply setting the owner
of
>>the return value (the BitmapPtr) does not appear to be enough, since I
>>assume that there is memory allocated for the actual bitmap data somewhere
>>else.
>>
>>I tried calling BmpGetBits and setting the owner of that pointer to 0, but
>>that results in an "invalid chunk" error.
>
>Chris, I'd use the code in the BitmapRsrc example to create your bitmap
>using your own structures, with your own heap allocation calls.  Then you
>should be able to set the owner without any problems.  Of course, setting
>the owner to keep chunks around won't work in Palm OS Cobalt, since each
>process has its own heap.
>
>http://kb.palmsource.com/cgi-bin/palmsource.cfg/php/enduser/std_adp.php?p_f
aqid=341
>
>
>-- Ben Combee, DTS technical lead, PalmSource, Inc.
>    Read "Combee on Palm OS" at http://palmos.combee.net/

Following up on this thread:  I tried incorporating code from the BitmapRsrc
sample, and it appears that the BmpRsrcType assumes that it is running in
68k code.  If this code is running from within an ARMlet, it seems that some
of the structure alignment and byte ordering needs to change.

The strange thing, though, is that when I try endian-swapping the height,
width, and rowbytes (as well as other members), the simulator simply crashes
when trying to paint the resulting bitmap;  however, if I don't endian-swap
those fields, then it paints a bitmap of the correct dimensions, but the
data is garbage.  Maybe my assumptions aren't correct somewhere?  Do these
fields not need to be endian-swapped?  (It's a little hard to keep track of
what should be where when you're running little endian, going through big
endian API entry points, the stubs of which use a shadow struct, referencing
a little-endian memory representation... my head is spinning!)

-- Chris




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

Reply via email to