日期:2014-05-17 浏览次数:21202 次
采集图片
OK32API.okCaptureTo(this.m_handle, OK32Targets.Buffer, 0, 1);
OK32API.okGetCaptureStatus(this.m_handle, 1);
//取得图片信息
short width; //
short height; //
int stride;//
OK32API.okGetTargetInfo(this.m_handle, OK32Targets.Buffer, 0, out width, out height, out stride);
//读取图片数据
IntPtr pData = Marshal.AllocHGlobal(stride * height);
OK32API.okReadRect(this.m_handle, OK32Targets.Buffer, 0, pData);
bmp = new Bitmap(width, height, stride, PixelFormat.Format24bppRgb, pData );
bmp.RotateFlip(RotateFlipType.Rotate180FlipNone);
Marshal.FreeHGlobal(pData);