This is driving me nuts! I am trying to work with Bitmaps, creating a database and loading them in (to eventually use for scrolling.) I am using the following code to create a database but it doesn't work right.

@cid "JN00";
@name "SBuffer";
@dbname "SBuffer";
@bmp "1200,1,Pic.bmp,4,Pic.bmp";
library "PToolboxLib"
main(){
SetDepth(5);
graph_on();
clearg();
bitmapr(1200, 0, 0);
OpenBmpDb("test_bitmap");
SaveBmp(1000, 0, 0, 160, 160, -1, 0);
}
First of all, the function is returning 0 instead of 1000. Secondly, any BmpInfo command returns all zeros for width, height etc. But when I use the following code (in a seperate program) to read the bitmap database, it loads the image but it is shrunk to 1/4 size and shown twice along the top. It almost seems like a shrink funtion is being used or when the above code is run it is saving two smaller versions instead of one:

If SaveBmp fails it returns -1. If it doesn't fail it returns the resource index (which is not the same as resource id). If you got a zero back it means that you created a bitmap with at id zero (which means the first bitmap in the file). The second bitmap will have an index of 1 and so on. Each bitmap also has a unique resource id... so each bitmap has a resource index and id.

BmpInfo requires you to input the resource index as the first parameter, my guess is that you're plugging in the resource id instead?

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
But when I use the following code (in a seperate program) to read the bitmap database, it loads the image but it is shrunk to 1/4 size and shown twice along the top. It almost seems like a shrink funtion is being used or when the above code is run it is saving two smaller versions instead of one
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

This may be a palmOS 5 bug (or maybe a bug in my code... though I had no other reports of such). I would suggest trying this out on the palmOS emulator running a m505 or IIIc, does it work? I heard of cases where newer devices don't fully support 4 bit graphics mode. What does "puts(hex(SetDepth(-1)));" return on your device? This will return a code indicating what depths your device supports.

If you save less of the fullscreen (less than 160x160) does this change things?

Ah, that's the confusion. Thank you so much for the help (and all of the help you give everyone. You really go out of your way)

I assumed the ID and index were the same. I will experiment with this shortly. What I think is really weird is that the FastBmp statement worked at all when I used the resource id and not the index id...

As far as the shrinking thing, I think it may be a simulator bug. I currently have a ROM for a Treo 600 (my phone.) Can you tell me where I can get other ROMs (especially the m505 or IIIc)? I can't seem to find them on Palmsource, and PalmOne only has Treo ROMs with simulators attached. As soon as I can find a ROM I will test your suggestions.

<blockquote id="quote"><font size="1" face="Verdana, Arial, Helvetica" id="quote">quote:<hr height="1" noshade id="quote">
I assumed the ID and index were the same. I will experiment with this shortly. What I think is really weird is that the FastBmp statement worked at all when I used the resource id and not the index id...
<hr height="1" noshade id="quote"></font id="quote"></blockquote id="quote">

FastBmp actually works both ways. If the id number is <1000, it's treated as a resource index, if it's 1000 or higher, it's treated as a resource id.

To get to the emulator and roms, use the quick links selector box on left side of the palmsource.com developer's page. You'll probably have to register as a developer.