HGScanner demo修改

This commit is contained in:
luoliangyi 2022-10-12 13:37:03 +08:00
parent d056352880
commit 65b2470793
3 changed files with 8 additions and 8 deletions

View File

@ -26,7 +26,7 @@ namespace WindowsFormsApp1
if (UIntPtr.Zero != image) if (UIntPtr.Zero != image)
{ {
HGScannerLib.HGLibSaveImageParam saveParam; HGScannerLib.HGLibSaveImageParam saveParam;
saveParam.size = 20; saveParam.size = (UInt32)Marshal.SizeOf(typeof(HGScannerLib.HGLibSaveImageParam));
saveParam.jpegQuality = 80; saveParam.jpegQuality = 80;
saveParam.tiffCompression = 4; saveParam.tiffCompression = 4;
saveParam.tiffJpegQuality = 80; saveParam.tiffJpegQuality = 80;
@ -176,7 +176,7 @@ namespace WindowsFormsApp1
++m_scanCount; ++m_scanCount;
HGScannerLib.HGLibSaveImageParam saveParam; HGScannerLib.HGLibSaveImageParam saveParam;
saveParam.size = 20; saveParam.size = (UInt32)Marshal.SizeOf(typeof(HGScannerLib.HGLibSaveImageParam));
saveParam.jpegQuality = 80; saveParam.jpegQuality = 80;
saveParam.tiffCompression = 4; saveParam.tiffCompression = 4;
saveParam.tiffJpegQuality = 80; saveParam.tiffJpegQuality = 80;

View File

@ -13,7 +13,7 @@
<Deterministic>true</Deterministic> <Deterministic>true</Deterministic>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>x86</PlatformTarget> <PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols> <DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType> <DebugType>full</DebugType>
<Optimize>false</Optimize> <Optimize>false</Optimize>

View File

@ -87,7 +87,7 @@ HGLib_SaveImage = Objdll.HGLib_SaveImage
HGLib_SaveImage.argtypes = [ctypes.c_void_p, ctypes.c_char_p, POINTER(HGLibSaveImageParam)] HGLib_SaveImage.argtypes = [ctypes.c_void_p, ctypes.c_char_p, POINTER(HGLibSaveImageParam)]
HGLib_SaveImage.restype = ctypes.c_int HGLib_SaveImage.restype = ctypes.c_int
ImageParam = HGLibSaveImageParam() ImageParam = HGLibSaveImageParam()
ImageParam.size = 20 ImageParam.size = sizeof(ImageParam)
ImageParam.jpegQuality = 80 ImageParam.jpegQuality = 80
ImageParam.tiffCompression = 4 ImageParam.tiffCompression = 4
ImageParam.tiffJpegQuality = 80 ImageParam.tiffJpegQuality = 80
@ -181,10 +181,10 @@ imgindex=0
def HGLibDeviceScanImageFunc(device: c_void_p, image: c_void_p, param: c_void_p): def HGLibDeviceScanImageFunc(device: c_void_p, image: c_void_p, param: c_void_p):
global imgindex global imgindex
ImageParam = HGLibSaveImageParam() ImageParam = HGLibSaveImageParam()
ImageParam.size = 20 ImageParam.size = sizeof(ImageParam)
ImageParam.jpegQuality = 100 ImageParam.jpegQuality = 80
ImageParam.tiffCompression = 0 ImageParam.tiffCompression = 4
ImageParam.tiffJpegQuality = 0 ImageParam.tiffJpegQuality = 80
ImageParam.ocr = 0 ImageParam.ocr = 0
print("image call back!!") print("image call back!!")
imgindex+=1 imgindex+=1