"Sailesh Chaudhary" <[EMAIL PROTECTED]> wrote in message
news:83524@palm-dev-forum...
>
> can any body tell me what is the problem with this code.This is common
> signature++ application and i developing it using code warrior 8.0 for
> PalmOS 3.2.,so that i don't have old libraries.But when i run it is giving
> some memory falat exception.I have marked where it is giving
problem.Please
> help
>
> static BitmapPtr GetSignatureBitmap32( RectangleType* theBoundsPtr )
> {
> WinHandle theWindowHandle;
> Err theError;
> BitmapPtr theBitmapPtr = NULL;
> UInt16 theRowBytes, theHeight;
> //void *buffer;
>
> // First, free the previous bitmap if it exists
> if (gBitmapPtr)
> {
> MemPtrFree( gBitmapPtr );
> gBitmapPtr = NULL;
> }
>
> // Create an offscreen window to copy the bits bounded by the gadget
> into.
> // This will make converting the window into a bitmap a little
> easier for us
> // You could just copy the screen bits directly into the bitmap, but
> that
> // would require more pointer arithmetic and POSE complains when you
> read
> // directly from the screen.
> theWindowHandle = WinCreateOffscreenWindow( theBoundsPtr->extent.x,
>
> theBoundsPtr->extent.y, screenFormat, &theError );
>
> if (!theError)
> {
> // Now, copy the gadgets screen rectangle into the new
> window.  This will offset
> // the screen bits to (0, 0) in the offscreen window.
> WinCopyRectangle( NULL, theWindowHandle, theBoundsPtr, 0, 0,
> winPaint );
>
> // Now, this is the tricky part.  There is no API for
> getting the bits on the screen
> // into a bitmap, so this code is unsupported and will only
> work on Palm OS 2.x, 3.0,
> // 3.1, and 3.2 devices.  This is why we limit this sample
> to only those versions in
> // the RomVersionCompatible function.  This code will also
> only work on a device with
> // a screen depth of 1.
> // WARNING:  THIS CODE IS NOT SUPPORTED CODE AND MAY NOT
> WORK ON DEVICES
> // WHOSE OS VERSION IS OTHER THAN 2.X, 3.0, 3.1, OR 3.2
>
> // Cache a couple of important bits of information
> theRowBytes = theWindowHandle->bitmapP->rowBytes;
> theHeight = theWindowHandle->bitmapP->height;
>
> // Now, allocate our bitmap and set all the important bits
> of information.
> theBitmapPtr = (BitmapType*)MemPtrNew( sizeof(BitmapType) +
> (theRowBytes*theHeight) );
> if (theBitmapPtr)
> {
> MemSet( theBitmapPtr, sizeof(BitmapType) +
> (theRowBytes*theHeight), 0 );
>
> theBitmapPtr->width =
> theWindowHandle->bitmapP->width;
> theBitmapPtr->height =
> theWindowHandle->bitmapP->height;
> theBitmapPtr->rowBytes =
> theWindowHandle->bitmapP->rowBytes;
> theBitmapPtr->pixelSize =
> theWindowHandle->bitmapP->pixelSize;
> theBitmapPtr->nextDepthOffset = NULL;
>
> // CreateOffscreenWindow does not, by default,
> create a compressed window
> theBitmapPtr->flags.compressed =
> theWindowHandle->bitmapP->flags.compressed;
>
> // All bitmaps are version 1 bitmaps without a color
> table.
> theBitmapPtr->version = 1;
> theBitmapPtr->flags.hasColorTable = 0;
>
>
> //Problem in this Area below**************
>
>
> MemMove( (void*)((UInt32)(theBitmapPtr) +
> sizeof(BitmapType)),
>
> theWindowHandle->displayAddrV20, theRowBytes * theHeight );
>

replace UInt32 by UInt8*

>
>
>
>
> }
>
> // Delete the window that we created with
> WinCreateOffscreenWindow
> WinDeleteWindow( theWindowHandle, false );
> }
>
> // Finally, return our bitmap
> return theBitmapPtr;
> }
>
> thanks in advance
> shailesh
>
>



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

Reply via email to