I want to Show Pictures on my Palm Device. I place the .gif file in .prc File
as a resource. I Created the .prc file with par utility which is available from
the Link: http://www.djw.org/product/palm/par/#download
Using this utility I have created a .prc file on the DOS (Command) prompt.
The Command is : C:> par c gifs.prc gifs 1000 djwS pic1.gif.
Providing gifs as TYPE of the dbFile and 1000 as cid of dbFile.
Now having this file , I have written the following Code to Show this on PDA
but the Function DmGetResource is not working.
If you think that using some other Function I can get the result please tell me
the function and give a example of it.
The Code is as Following
void MainFormResourceTest() {
Int32 size;
void *data = NULL;
FileHand fh;
Err err;
BitmapPtr bmpP;
LocalID id;
DmOpenRef NAME;
id=NULL;
NAME=NULL;
id = DmFindDatabase(0,"gifs");
NAME=DmOpenDatabase(0,id,dmModeReadWrite);
hires = HiResOn();
if (1) {// test GIF scaling
MemHandle mh;
====> mh = DmGetResource(1000,'gifs');
if (mh) {
GIF_HANDLE gifHandle;
GIF_INFO gifInfo;
gifHandle = gif_Open(MemHandleLock(mh));
err = gif_GetInfo(gifHandle,&gifInfo);
if (err == errNone) {
bmpP = gif_GetBitmap(gifHandle,0,&gifInfo,&err);
if (bmpP) {
drawBitmap(bmpP,false);
}
}
gif_Close(gifHandle);
MemHandleUnlock(mh);
DmReleaseResource(mh);
if (bmpP) {
FillScreen(bmpP);
BmpDelete(bmpP);
}
}
}
if (1) {// test GIF animation on start
MemHandle mh;
mh = DmGetResource('gifs',1000);
if (mh) {
gif_Animate(MemHandleLock(mh),0,15,gifProgress,NULL);
MemHandleUnlock(mh);
DmReleaseResource(mh);
}
// return;
}
if (1) {// test jpeg scaling
MemHandle mh;
mh = DmGetResource('jpeg',1000);
data = MemHandleLock(mh);
bmpP = jpeg(data,progressF,initF,errorF);
MemHandleUnlock(mh);
DmReleaseResource(mh);
if (bmpP) {
FillScreen(bmpP);
err = jpegFreeBitmap((void*)bmpP);
if (err)
FrmCustomAlert(DebugAlert,"Failed to deallocate created bitmap"," "," ");
}
return;
}
// test JPEG on start
fh = FileOpen(0,"Lake.jpg",NULL,NULL,fileModeReadOnly,&err);
if (err == errNone) {
FileTell(fh,&size,&err);
data = MemLargePtrNew(size);
if (data) {
FileRead(fh,data,size,1,&err);
bmpP = jpeg(data,progressF,initF,errorF);
MemPtrFree(data);
}
FileClose(fh);
} else {
MemHandle mh;
mh = DmGetResource('jpeg',1001);
data = MemHandleLock(mh);
bmpP = jpeg(data,progressF,initF,errorF);
MemHandleUnlock(mh);
DmReleaseResource(mh);
}
drawBitmap(bmpP,true);
}
Please tell me where I am wrong which makes it not working properly.
--
For information on using the Palm Developer Forums, or to unsubscribe, please
see http://www.palmos.com/dev/support/forums/