I am trying to rotate a bitmap certain angles. The rotation algorithm is easy. I try to create a bitmap dynamically to save the rotated bitmap and paint to screen. However, use BmpGetBits to get the bitmap data and directly move the pixels, emulator says "just wrote to memory location 0xxxxxx, which is in the storage heap. ...."

I use the following code. It error in the "dstBmpData[x]=srcBmpData[x1];" .

resH = DmGetResource(bitmapRsc, resID);
taxiBitsP = (BitmapPtr)MemHandleLock(resH);
srcBmpData=BmpGetBits (taxiBitsP);

bitmap= BmpCreate(WIDTH, HEIGHT,8 , NULL, &bmperror);
dstBmpData=BmpGetBits (bitmap);

// rotation
dstBmpData[x]=srcBmpData[x1];
.....

WinPaintBitmap(bitmap, x, y);
BmpDelete(bitmap);
WinPaintBitmap(taxiBitsP, 50, 0);

MemHandleUnlock(resH);
DmReleaseResource(resH);

How can I write a bitmap data directly except using the WinGetPixel and WinDrawPixel?

Thanks !!


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

Reply via email to