Hello,
Ok, what I am basically trying to do is grab a tAIB resource from a prc
on an expansion card, slightly modify it, then save it to an application
database. The code works, but the simulator crashes when it attempts to
draw the bitmap. I'm not sure why. Is it because I am only saving a
single bitmap instead of a family? Is the structure of a tAIB just a
BitmapType directly followed by the bits? I gave the code if you need to
see exactly what I am doing. Thanks to anyone who helps.

//Grab the icon
VFSFileDBGetResource(file, 'tAIB', 1000, &R2);
SrcB = (BitmapType*)MemHandleLock(R2);

//Create Window of same dimensions
BmpGetDimensions(SrcB, &width, &height, NULL);
DstW = WinCreateOffscreenWindow(width, height, nativeFormat, &err);

//Draw icon to new window
OldDW = WinSetDrawWindow(DstW);
WinDrawBitmap(SrcB, 0, 0);

//Icon resource no longer needed
MemHandleUnlock(R2);
MemHandleFree(R2);

//Add to the window. (this function draws a bitmap from my app's
resources)
DrawBitmap(1000, 0, 14);

//Get the sizes and create the new resource
DstB = WinGetBitmap(DstW);
BmpGetSizes(DstB, &datS, &hdS);
R = DmNewResource(OR, 'tAIB', 1000, datS+hdS);

//Write the BitmapType, followed by the bits
c = (char*)MemHandleLock(R);
DmWrite(c, 0, DstB, hdS);
DmWrite(c, hdS, BmpGetBits(DstB), datS);

//Cleanup
MemHandleUnlock(R);
DmReleaseResource(R);
WinSetDrawWindow(OldDW);
WinDeleteWindow(DstW, false);



Thanks,
Jonathan King



-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to