|
|
|
@ -88,6 +88,7 @@ namespace DevicesService.Devices
|
|
|
|
|
string filename = string.Empty; |
|
|
|
|
if (m_vDevice.Count == 0) |
|
|
|
|
{ |
|
|
|
|
Console.WriteLine("初始化扫描仪"); |
|
|
|
|
DevChangeCallBack = new ELOAM_DEVCHANGECALLBACK(DEVCHANGECALLBACK); |
|
|
|
|
EloamDll.EloamGlobal_InitDevs(DevChangeCallBack, IntPtr.Zero); |
|
|
|
|
EloamDll.EloamGlobal_VideoCapInit(); |
|
|
|
@ -100,8 +101,7 @@ namespace DevicesService.Devices
|
|
|
|
|
hDev, resIdx, modeIdx, null, (IntPtr)0, null, (IntPtr)0, 0, 2); |
|
|
|
|
|
|
|
|
|
//开始拍照 |
|
|
|
|
HELOAMIMAGE hImg = EloamDll.EloamVideo_CreateImage( |
|
|
|
|
m_hVideo, 0, m_hView); |
|
|
|
|
HELOAMIMAGE hImg = EloamDll.EloamVideo_CreateImage(m_hVideo, 0, m_hView); |
|
|
|
|
if (IntPtr.Zero != hImg) |
|
|
|
|
{ |
|
|
|
|
DateTime dateTime = DateTime.Now; |
|
|
|
@ -111,13 +111,33 @@ namespace DevicesService.Devices
|
|
|
|
|
FileExt.MakeSureDirExist(dirpath); |
|
|
|
|
var filepath = Path.Combine(dirpath, time); |
|
|
|
|
filename = dirpath + "\\" + time + ".jpg"; |
|
|
|
|
if (1 == EloamDll.EloamImage_Save(hImg, filename, 0)) |
|
|
|
|
//新增 |
|
|
|
|
LONG width = EloamDll.EloamImage_GetWidth(hImg); |
|
|
|
|
LONG height = EloamDll.EloamImage_GetHeight(hImg); |
|
|
|
|
HELOAMIMAGE hSaveImg = EloamDll.EloamGlobal_CreateImage(width, height, EloamDll.EloamImage_GetChannels(hImg)); |
|
|
|
|
if (null == hSaveImg) |
|
|
|
|
{ //释放 |
|
|
|
|
EloamDll.EloamImage_Release(hSaveImg); |
|
|
|
|
EloamDll.EloamImage_Release(hImg); |
|
|
|
|
openCamera2(); |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|
{ |
|
|
|
|
EloamDll.EloamImage_Copy(hSaveImg, hImg); |
|
|
|
|
//保存图片 |
|
|
|
|
if (1 == EloamDll.EloamImage_Save(hSaveImg, filename, 0)) |
|
|
|
|
{ |
|
|
|
|
EloamDll.EloamView_PlayCaptureEffect(m_hView); |
|
|
|
|
} |
|
|
|
|
//释放 |
|
|
|
|
EloamDll.EloamImage_Release(hSaveImg); |
|
|
|
|
EloamDll.EloamImage_Release(hImg); |
|
|
|
|
//旋转图片 |
|
|
|
|
//filename = ImgToBase64String(filename); |
|
|
|
|
//为获取图片重新破获 |
|
|
|
|
if (!File.Exists(filename)) |
|
|
|
|
{ |
|
|
|
|
openCamera2(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return filename; |
|
|
|
|
} |
|
|
|
|