I'm trying crop a signature capture so that I only save the image and not the 
white space around it. It seems to work if I set my simulator's color depth to 
2 colors (black and white).  The drawing becomes more garbled as I increase the 
color depth on the Sim.

Here is the code: 

theGadgetIdx = FrmGetObjectIndex(frmP, gadgetID); 
data = (SignatureGadgetData *)FrmGetGadgetData(frmP, theGadgetIdx); 

//This is a function I wrote to return the dimensions of the image 
if (!ExistsDrawingCanvasBitmap(data, minX, maxX, minY, maxY)) 
return 0; 

//Copy the drawing from the original bitmap to a new bitmap of the cropped size 
newBitmap = BmpCreate(maxX - minX + 1, maxY - minY + 1, 1, NULL, &err); 
newBitmapWin = WinCreateBitmapWindow(newBitmap, &err); 
//create rectangle to indicate where to copy from in the source bitmap 
rect = new RectangleType; 
rect->topLeft.x = minX; 
rect->topLeft.y = minY; 
rect->extent.x = maxX - minX + 1; 
rect->extent.y = maxY - minY + 1; 
WinCopyRectangle (data->bitmapWin, newBitmapWin, rect, 0, 0, winPaint); 

I'm guessing this might have something to do with color tables.  I've played 
around with that with no success but I was probably doing it wrong.
Thank you for any help!
-- 
For information on using the PalmSource Developer Forums, or to unsubscribe, 
please see http://www.palmos.com/dev/support/forums/

Reply via email to