Thomas Okken wrote: > Is it possible to create a resource database, and put bitmap resources > in it, all on the Palm itself (without using a PC-based tool)? > I'm not sure where to look in the PalmOS API documentation; I can fin > and use all the calls that are needed to load bitmap resources FROM > a resource database, and use WinDrawBitmap() to render them on the > screen, but I haven't figured out how to CREATE such resources on the > Palm itself.
Go to the developer knowledge base ( http://kb.palmsource.com/ ) and search for the string "bitmaprsrc". This should give you an article called "OS 5 High Density Overview", and attached to that article is a file attachment with some code that can be used to create bitmaps in a known format whose pixels can be read and written directly. (Which is I think what you want unless you already have ready-made bitmaps and are just trying to compile a set of them or something.) I don't believe that these BitmapRsrc functions (described above) will let you create a compressed bitmap, so that might be an issue. Constructor and all the desktop tools do let you do that. (You could probably call BmpCompress() on a bitmap once you have created it, but there is no guarantee that I know of that the result will be portable to other (older) devices.) Once you have some bitmaps, you can use Data Manager calls to create a resource file itself, and write resources into it. DmCreateDatabase() with the resDB flag set to true will create a resource database, DmNewResource() will create a new resource within a database, and DmWrite() will let you you write into the resource. One other piece remains, and that is creating bitmap families. Just bitmaps by themselves may or may not be sufficient, depending on what you're trying to do. If you're trying to create a universal resource database that will work on high- or low-density Palms, you probably need bitmap families. I'm not sure, but if you read the Bitmap Families section in the Programmer's Companion, there probably is sufficient information in there to determine how to tweak the nextDepthOffset members of bitmaps created with the bitmaprsrc code. > Is this even possible? And how would one deal with large images - 320x320 > at 16 bpp is 200 kilobytes (uncompressed); I suspect such images have to > be broken into smaller pieces because of the Data Manager's 64k-per-resource > limit? It'd probably help to distinguish between bitmaps and resources. You can have a bitmap that's bigger than 64K, if you have the memory to store it. I believe the bitmaprsrc code can even create large bitmaps like this. What you can't do is put that into a resource. If you need to do have some bitmap that is too big to fit into a resource, there are some options: (1) Turn on compression and hope that makes it fit. (Could work well for bitmaps with large areas of solid color.) (2) Create the bitmap, then split the sequence of bytes up and put it into multiple resources, then reconstruct before you draw (ugghh, not easy). (3) Create several smaller bitmaps, then draw them in tiles. Hope that helps. - Logan -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
