Hi,
I'm using the pnoJpeg library in some of my applications.
You put the jpeg data into pdb-files just like you would any other kind of
data. I know a lot of people are using "par" to generate pdbs, I've never used
it, but I assume it's able to do this for you.
I've written a desktop program that generates the pdbs. What it does is search
the current folder for any "*.jpg", read the data from these and place each in
a separate database record in the pdb. But really, how you organize the data is
up to you.
I'm using the following routine to display the jpegs from the database. Be
aware of the following global variables in this example: pdbsource is the
reference to an opened database file in internal ram. pdbsource_ptr is the same
reference if the file is located on an external memory card (my variable
"source" keeps track of this).
I've edited this from my routine for simplification, I haven't tested that this
sample actually works, but you get the idea.
void ShowJpg(UInt16 recordnumber)
{
Err err;
pnoJpeg2Ptr data;
MemHandle hImage;
DmOpenRef dbRef;
LocalID dbID;
UInt16 index = 0;
Coord width, height;
if (source==internalpdb)
hImage = DmQueryRecord(pdbsource, recordnumber);
else
VFSFileDBGetRecord(pdbsource_ptr, recordnumber, &hImage, NULL, NULL);
err = pnoJpeg2Create(jpegLibRef, &data);
pnoJpeg2LoadFromHandle(jpegLibRef, data, hImage);
//Use this for scaling if you like
//pnoJpegSetScaleFactor(jpegLibRef, &data, 2);
pnoJpeg2Read(jpegLibRef, data, &bmp);
pnoJpegBmp2DoubleDensity(jpegLibRef, &bmp);
BmpGetDimensions (bmp, &width, &height, NULL);
WinDrawBitmap(bmp, 0, 0);
BmpDelete(bmp);
err = pnoJpeg2Free(jpegLibRef, &data);
}
Hope this helps.
Regards,
Kristian
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/