Wild guess here: at greater color depth are you dealing with a bitmapV3
format?
JamesS
Davie Lau wrote:
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. It also works fine if the drawing is less than 39 pixels wide.
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/