Hello,
In one of our apps, we allow the capture of signatures via a b&w
image field. When color first came out on the Palm IIIc, my quick fix to get things
to continue working was to make sure the form that allows the
signature capture was always in black and white mode, and if not,
switch to it automatically. That has worked fine in the past, and
even to this day. However, I've never felt comfortable with that
solution, as suddenly your device is now in B&W mode whenever you're
entering a signature.
So I have decided to use WinCreateBitmapWindow to create an offscreen bitmap at mono
depth,
and use WinCopyRectangle to move data between the color screen and
the mono bitmap. I can then use BmpGetBits to access the b&w bits
and save/load them to my database record. This is almost working fine,
though each time I try to do the WinCopyRectangle, I get a message
on the emulator saying "App x has just read directly from memory
manager data structures". Pressing continue is successful, and I
can continue onward just fine, and the bitmap is loaded and saved
correctly. Obviously I must be doing something wrong, but can't
figure out what. So here is some example source that exhibits this
behavior:
WinHandle winM;
WinHandle theWindowHandle, olddraw;
unsigned short theError;
RectangleType torect;
unsigned long romVersion;
BitmapType *bmp, *bmpcreate;
MemPtr bmpptr;
unsigned char *colortable;
RGBColorType bwcolors[2];
UInt16 numentries = 2;
// Initialize the colortable array
bwcolors[0].index = 0;
bwcolors[0].r = 255;
bwcolors[0].g = 255;
bwcolors[0].b = 255;
bwcolors[1].index = 1;
bwcolors[1].r = 0;
bwcolors[1].g = 0;
bwcolors[1].b = 0;
colortable = (unsigned char *) MemPtrNew(sizeof(UInt16) + (sizeof(RGBColorType)*2));
MemMove(&colortable[0], &numentries, sizeof(UInt16));
MemMove(&colortable[2], &bwcolors[0], sizeof(RGBColorType));
MemMove(&colortable[2+sizeof(RGBColorType)], &bwcolors[1], sizeof(RGBColorType));
bmpcreate = BmpCreate(160, 100, 1, (ColorTableType *) colortable, &theError);
if (!theError) {
theWindowHandle = WinCreateBitmapWindow(bmpcreate, &theError);
if (!theError) {
bmp = WinGetBitmap(theWindowHandle);
bmpptr = BmpGetBits(bmp);
// For simplicity sake, I'm just setting the whole thing to 0, clear, for
example.
MemSet((char *) bmpptr, IMAGE_SPACE, 0);
torect.topLeft.x = 0;
torect.topLeft.y = 0;
torect.extent.x = 160;
torect.extent.y = 100;
// I get the error right here!
WinCopyRectangle(theWindowHandle, WinGetDrawWindow(), &torect, 0, 14,
winPaint );
// Delete the window that we created with WinCreateOffscreenWindow
WinDeleteWindow( theWindowHandle, false );
}
BmpDelete (bmpcreate);
}
MemPtrFree(colortable);
I get the error at the WinCopyRectangle, and am using the m505 Rom
and emulator 3.4. Any assistance would be greatly appreciated!
--
Thanks,
Dave Haupert
DDH Software, Inc
[EMAIL PROTECTED] http://www.ddhsoftware.com
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/