I am still having a problem with the
MemMove( (Ptr)((UInt32)(theBitmapPtr) + sizeof(BitmapType)),
DeviceWindowGetPointer(theWindowHandle),
(theRowBytes * theHeight));
DeviceWindowGetPointer() looks liek this
void * DeviceWindowGetPointer(WinHandle win)
{
void *result = NULL;
result = (void *)win->displayAddrV20;
return result;
}
here's teh GetSignatureBitMap function, i don;'t see what i could be doing
wrong.
static BitmapPtr GetSignatureBitmap( RectangleType* theBoundsPtr )
{
WinHandle theWindowHandle;
UInt16 theError;
BitmapPtr theBitmapPtr = NULL;
UInt16 theRowBytes, theHeight;
// 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. //BOAZ
UPDATE
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 = 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; ;//= NULL;
// CreateOffscreenWindow does not, by default,
create a compressed window
theBitmapPtr->flags.compressed =
theWindowHandle->bitmapP->compressionType;
// All bitmaps are version 1 bitmaps without a color
table.
theBitmapPtr->version = 1;
theBitmapPtr->flags.hasColorTable = 0;
// Move the offscreen bits into our bitmap. The
baseAddr field
// contains the bit array of our bitmap for 1-bit,
uncompressed bitmaps.
MemMove( (Ptr)((UInt32)(theBitmapPtr) +
sizeof(BitmapType)), //BitmapType
DeviceWindowGetPointer(theWindowHandle), (theRowBytes *
theHeight));//gDeviceP->baseAddr //->displayAddrV20
//MemMove( ((void *)(theBitmapPtr)) +
sizeof(BitmapType),DeviceWindowGetPointer(theWindowHandle),theRowBytes *
theHeight);
}
// Delete the window that we created with
WinCreateOffscreenWindow
WinDeleteWindow( theWindowHandle, false );
}
// Finally, return our bitmap
return theBitmapPtr;
}
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/