Deepak.MA wrote:
I have a situation wherein i need to place my resources(bitmaps) in various folders/dirs in VFS. Am using a custom hardware, where the VFS has been internally configured for the Flash. In the above context, i understand that the bitmaps can be accessed by enumerating through teh volumes first, then through the relevant directory and obtain the file names that reside there.
A bitmap is just a sequence of bytes. It can be accessed in any way that you want to which lets you get the correct bytes. In a typical application, bitmaps are stored as records in a resource database. You use DmGetResource() to get a handle to the desired resource, then lock it, and then you have a pointer to the bitmap. If you have a resource database stored as a PRC file on a VFS filesystem, you can use VFSFileDBGetResource() to read that resource out of the PRC file and into a MemHandle in RAM, which you can then lock, giving you a pointer to the bitmap. If you have each bitmap in its own file, then you will have to do something a bit different, like opening the file, using VFSFileSize() to get its size, allocating some RAM, and then copying the bitmap into RAM by doing VFSFileRead() in a loop. (If you use RAM in the storage heap, you will want to use VFSFileReadData() instead of VFSFileRead().) From there, once again, you have a pointer, and you can do with it what you wish.
Additionally, i am curious to know as to how i can get the bitmaps into that location of the Flash.
That depends on how you want to write them. If you would like to write them as separate files, then just create the file and copy data into it with VFSFileWrite(). If you'd like to modify a PRC file that exists on the VFS filesystem and update one of its records, that is quite a bit harder, especially if the PRC file is large. I recommend avoiding that approach unless you have a good reason to do it. - Logan -- For information on using the PalmSource Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
