05-30-2006 05:21 PM
05-31-2006 02:58 AM
05-31-2006 10:28 AM
The unsigned short g_buffer[1024][76] represents the image coming from the camera. The 16-bit (unsigned short) represents color per pixel.
Yes, I figured out yesterday that was the error in my NewBitmap() function. The Function Panel for NewBitmap indicated() the valid values as you stated. Yes I chose 16 due to my requirements. It seems like NewBitmap() will not work for my application?
I have since modified the code to use CanvasDrawPoint() and traversed each of the 786,432 points... As you can tell, it is dog slow, and won't work under 15-30Hz rate.
void displayImage(void)
{
int bitmapID, bytesPerRow, pixelDepth=32;
int width=1024, height=768, retVal, byteSize;
Rect destRect;
unsigned char *bits=0, mask[128];
int i,x,y;
// setup bit mapping
bytesPerRow=width*pixelDepth/8;
byteSize = width*height*pixelDepth/8;
bits = malloc(byteSize);
memset( bits, 0, byteSize );
// create new bitmap buffer
retVal = NewBitmap( bytesPerRow, pixelDepth, width, height, NULL,
bits, bits, &bitmapID );
// store graph to bitmap
//@@@ TO DO...
retVal = CanvasStartBatchDraw (g_panelHandle, PANEL_CANVAS );
for (y=0; y<768; ++y)
for (x=0; x<1024; ++x)
{
SetCtrlAttribute (g_panelHandle, PANEL_CANVAS,
ATTR_PEN_FILL_COLOR, g_image[x][y] );
SetCtrlAttribute (g_panelHandle, PANEL_CANVAS,
ATTR_PEN_WIDTH, 1 );
CanvasDrawPoint (g_panelHandle, PANEL_CANVAS,
MakePoint (x,y));
}
retVal = CanvasEndBatchDraw (g_panelHandle, PANEL_CANVAS);
//@@@ TO DO...
// display image
destRect.width = VAL_KEEP_SAME_SIZE;
destRect.height = VAL_KEEP_SAME_SIZE;
destRect.top = VAL_KEEP_SAME_SIZE;
destRect.left = VAL_KEEP_SAME_SIZE;
retVal = CanvasDrawBitmap( g_panelHandle, PANEL_CANVAS, bitmapID,
VAL_ENTIRE_OBJECT, destRect );
ProcessSystemEvents();
} // end displayImage
05-31-2006 10:52 AM
05-31-2006 11:03 AM
Its a color camera output. I can't answer why its not 24+ bits. Its just the spec for the camera that I got. I needed this application to see what it is displaying.
05-31-2006 11:14 AM
05-31-2006 11:21 AM
05-31-2006 03:50 PM
06-01-2006 12:45 PM