Hi, I want to read a bitmapV3 from resource, modify it, and save it back to database resource, but the saved resource is not bitmap version 3 and density of 144, it showed bitmap version 0 and density of 72... I have done it with the same code for bitmap version 2 (with offscreen creation of genericFormat) and it works. Below is my code, please help!!!
// open file DmGetNextDatabaseByTypeCreator(true, &ldssInfo, sysFileTApplication, 'ABCD', true, &lintCard, &llidDB); ldorDB = DmOpenDatabase(lintCard, llidDB, dmModeReadWrite); // read bitmapV3 into memory, modify it and display it on screen lmhdBitmap = DmGet1Resource('Tbmp', 2008); if(lmhdBitmap != NULL) { lbmpBitmap = (BitmapPtr) MemHandleLock(lmhdBitmap); lwhdWindow = WinCreateOffscreenWindow(22, 22, nativeFormat, &lerrRV); lwhdCurrent = WinGetDisplayWindow(); WinSetDrawWindow(lwhdWindow); WinDrawBitmap(lbmpBitmap, 0, 0); WinDrawLine(0, 0, 12, 12); lrtpFrame.topLeft.x = 0; lrtpFrame.topLeft.y = 0; lrtpFrame.extent.x = 22; lrtpFrame.extent.y = 22; WinCopyRectangle(lwhdWindow, lwhdCurrent, &lrtpFrame, 30, 20, winPaint); // display as bitmapV3 on screen successful WinSetDrawWindow(lwhdCurrent); MemHandleUnlock(lmhdBitmap); DmReleaseResource(lmhdBitmap); } // remove bitmapV3 resource lintRec = DmFindResource(ldorDB, 'Tbmp', 2008, NULL); DmRemoveResource(ldorDB, lintRec); lintDensity = BmpGetDensity(lbmpWindow); // return 144 lintVersion = BmpGetVersion(lbmpWindow); // return 3 // get bitmap size BmpGetSizes(lbmpWindow, &lintData, &lintHeader); lintTotal = BmpSize(lbmpWindow); // write bitmap to a new resource lmhdWindow = DmNewResource(ldorDB, 'Tbmp', 2008, BmpSize(lbmpWindow)); lptrWrite = MemHandleLock(lmhdWindow); DmWrite(lptrWrite, 0, lbmpWindow, lintHeader); DmWrite(lptrWrite, lintHeader, BmpGetBits(lbmpWindow), lintData); MemHandleUnlock(lmhdWindow); DmReleaseResource(lmhdWindow); // close file DmCloseDatabase(ldorDB); // free offscreen window created WinDeleteWindow(lwhdWindow, false); -- Season -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/