parent
e0af02073c
commit
fda0ad0afe
|
@ -6,3 +6,4 @@
|
|||
/third_party
|
||||
/build
|
||||
/build-qt
|
||||
/test
|
|
@ -23,7 +23,7 @@ protected:
|
|||
HGTwainDSM m_dsm;
|
||||
HGTwainDS m_ds;
|
||||
|
||||
static void DSEventCallback(HGTwainDS ds, HGUInt event, HGPointer param);
|
||||
static void HGAPI DSEventCallback(HGTwainDS ds, HGUInt event, HGPointer param);
|
||||
|
||||
// 实现
|
||||
protected:
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
#include "HGDef.h"
|
||||
#include "HGBaseErr.h"
|
||||
|
||||
typedef void (*HGCrashFunc)(HGPointer crashAddr, HGPointer param);
|
||||
typedef void (HGAPI *HGCrashFunc)(HGPointer crashAddr, HGPointer param);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGBase_RegisterCrashFunc(HGCrashFunc func, HGPointer param);
|
||||
|
||||
|
|
|
@ -110,6 +110,9 @@ typedef HGUInt HGResult;
|
|||
|
||||
#define HG_DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGInt left;
|
||||
|
@ -138,4 +141,6 @@ typedef struct
|
|||
HGFloat y;
|
||||
}HGPointF;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
#endif /* __HGDEF_H__ */
|
||||
|
|
|
@ -2,13 +2,13 @@
|
|||
#include "HGInc.h"
|
||||
|
||||
#if !defined(HG_CMP_MSC)
|
||||
typedef struct
|
||||
struct event_t
|
||||
{
|
||||
HGBool state;
|
||||
HGBool manual_reset;
|
||||
pthread_mutex_t mutex;
|
||||
pthread_cond_t cond;
|
||||
}event_t, * event_handle;
|
||||
};
|
||||
#endif
|
||||
|
||||
HGResult HGAPI HGBase_CreateEvent(HGBool manualReset, HGBool initState, HGEvent* event)
|
||||
|
@ -19,7 +19,7 @@ HGResult HGAPI HGBase_CreateEvent(HGBool manualReset, HGBool initState, HGEvent*
|
|||
}
|
||||
|
||||
#if !defined(HG_CMP_MSC)
|
||||
event_handle hEvent = new event_t;
|
||||
event_t* hEvent = new event_t;
|
||||
|
||||
hEvent->state = initState;
|
||||
hEvent->manual_reset = manualReset;
|
||||
|
@ -50,7 +50,7 @@ HGResult HGAPI HGBase_DestroyEvent(HGEvent event)
|
|||
}
|
||||
|
||||
#if !defined(HG_CMP_MSC)
|
||||
event_handle hEvent = (event_handle)event;
|
||||
event_t* hEvent = (event_t*)event;
|
||||
pthread_cond_destroy(&hEvent->cond);
|
||||
pthread_mutex_destroy(&hEvent->mutex);
|
||||
delete hEvent;
|
||||
|
@ -69,7 +69,7 @@ HGResult HGAPI HGBase_WaitEvent(HGEvent event)
|
|||
}
|
||||
|
||||
#if !defined(HG_CMP_MSC)
|
||||
event_handle hEvent = (event_handle)event;
|
||||
event_t* hEvent = (event_t*)event;
|
||||
if (0 != pthread_mutex_lock(&hEvent->mutex))
|
||||
{
|
||||
return HGBASE_ERR_FAIL;
|
||||
|
@ -121,7 +121,7 @@ HGResult HGAPI HGBase_WaitEventTimeout(HGEvent event, HGUInt milliseconds)
|
|||
}
|
||||
|
||||
int rc = 0;
|
||||
event_handle hEvent = (event_handle)event;
|
||||
event_t* hEvent = (event_t*)event;
|
||||
if (pthread_mutex_lock(&hEvent->mutex) != 0)
|
||||
{
|
||||
return HGBASE_ERR_FAIL;
|
||||
|
@ -174,7 +174,7 @@ HGResult HGAPI HGBase_SetEvent(HGEvent event)
|
|||
}
|
||||
|
||||
#if !defined(HG_CMP_MSC)
|
||||
event_handle hEvent = (event_handle)event;
|
||||
event_t* hEvent = (event_t*)event;
|
||||
if (0 != pthread_mutex_lock(&hEvent->mutex))
|
||||
{
|
||||
return HGBASE_ERR_FAIL;
|
||||
|
@ -218,7 +218,7 @@ HGResult HGAPI HGBase_ResetEvent(HGEvent event)
|
|||
}
|
||||
|
||||
#if !defined(HG_CMP_MSC)
|
||||
event_handle hEvent = (event_handle)event;
|
||||
event_t* hEvent = (event_t*)event;
|
||||
if (0 != pthread_mutex_lock(&hEvent->mutex))
|
||||
{
|
||||
return HGBASE_ERR_FAIL;
|
||||
|
|
|
@ -27,6 +27,9 @@ HG_DECLARE_HANDLE(HGImage);
|
|||
/* 底左结构 */
|
||||
#define HGBASE_IMGORIGIN_BOTTOM 2L
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
/* 图像信息 */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -46,6 +49,8 @@ typedef struct
|
|||
HGUInt bottom;
|
||||
}HGImageRoi;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* 创建空白的新图像
|
||||
* 参数:
|
||||
* 1) width: in, 新图像宽度
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
#define II(a, b, c, d, x, s, ac) { (a) += I ((b), (c), (d)) + (x) + (HGUInt)(ac); (a) = ROTATE_LEFT ((a), (s)); (a) += (b); }
|
||||
|
||||
/* MD5 context. */
|
||||
typedef struct
|
||||
struct MD5_CTX
|
||||
{
|
||||
/* state (ABCD) */
|
||||
/*四个32bits数,用于存放最终计算得到的消息摘要。当消息长度〉512bits时,也用于存放每个512bits的中间结果*/
|
||||
|
@ -56,7 +56,7 @@ typedef struct
|
|||
/* input buffer */
|
||||
/*存放输入的信息的缓冲区,512bits*/
|
||||
HGByte buffer[64];
|
||||
}MD5_CTX;
|
||||
};
|
||||
|
||||
/* MD5 initialization. Begins an MD5 operation, writing a new context. */
|
||||
/*初始化md5的结构*/
|
||||
|
|
|
@ -6,6 +6,9 @@
|
|||
|
||||
HG_DECLARE_HANDLE(HGMsgPump);
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
/* 消息结构体, 可以自定义 */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -13,7 +16,9 @@ typedef struct
|
|||
HGPointer data; /* 携带的数据 */
|
||||
}HGMsg;
|
||||
|
||||
typedef void (*HGMsgPumpFunc)(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||||
#pragma pack(pop)
|
||||
|
||||
typedef void (HGAPI *HGMsgPumpFunc)(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGBase_CreateMsgPump(HGMsgPump *msgPump);
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ struct HGNamedPipeClientImpl
|
|||
#endif
|
||||
};
|
||||
|
||||
static void NamedPipeServerFunc(HGThread thread, HGPointer param)
|
||||
static void HGAPI NamedPipeServerFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
HGNamedPipeServerImpl* p = (HGNamedPipeServerImpl*)param;
|
||||
#if defined(HG_CMP_MSC)
|
||||
|
|
|
@ -12,7 +12,7 @@ HG_DECLARE_HANDLE(HGThread);
|
|||
* 2) param: in, 回调参数
|
||||
* 说明:
|
||||
*/
|
||||
typedef void (*HGThreadFunc)(HGThread thread, HGPointer param);
|
||||
typedef void (HGAPI *HGThreadFunc)(HGThread thread, HGPointer param);
|
||||
|
||||
/* 开启线程
|
||||
* 参数:
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
#include "HGDef.h"
|
||||
#include "HGBaseErr.h"
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUShort year;
|
||||
|
@ -16,6 +19,8 @@ typedef struct
|
|||
HGUShort milliseconds;
|
||||
}HGTimeInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
HGEXPORT HGResult HGAPI HGBase_GetLocalTime(HGTimeInfo *timeInfo);
|
||||
|
||||
#endif /* __HGTIME_H__ */
|
|
@ -12,6 +12,9 @@
|
|||
#define HGIMGFMT_BMPENCODING_RLE4 2L
|
||||
#define HGIMGFMT_BMPENCODING_BITFIELDS 3L
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUInt width; /* 宽 */
|
||||
|
@ -28,6 +31,8 @@ typedef struct
|
|||
HGUInt yPelsPerMeter; /* 每米的像素数y */
|
||||
}HGBmpSaveInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* 检查文件是否是BMP图像
|
||||
* 参数:
|
||||
* 1) fileName: in, 文件名, windows系统上是GBK编码, linux系统上是UTF8编码
|
||||
|
|
|
@ -117,19 +117,21 @@ struct HGGifWriterImpl
|
|||
|
||||
static int SortRGBAxis;
|
||||
|
||||
typedef struct QuantizedColorType {
|
||||
struct QuantizedColorType
|
||||
{
|
||||
GifByteType RGB[3];
|
||||
GifByteType NewColorIndex;
|
||||
long Count;
|
||||
struct QuantizedColorType* Pnext;
|
||||
} QuantizedColorType;
|
||||
};
|
||||
|
||||
typedef struct NewColorMapType {
|
||||
struct NewColorMapType
|
||||
{
|
||||
GifByteType RGBMin[3], RGBWidth[3];
|
||||
unsigned int NumEntries; /* # of QuantizedColorType in linked list below */
|
||||
unsigned long Count; /* Total number of pixels in all the entries */
|
||||
QuantizedColorType* QuantizedColors;
|
||||
} NewColorMapType;
|
||||
};
|
||||
|
||||
static int SortCmpRtn(const void* Entry1,
|
||||
const void* Entry2) {
|
||||
|
|
|
@ -9,6 +9,9 @@
|
|||
HG_DECLARE_HANDLE(HGGifReader);
|
||||
HG_DECLARE_HANDLE(HGGifWriter);
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUInt width; /* 图像宽 */
|
||||
|
@ -23,6 +26,8 @@ typedef struct
|
|||
HGUInt height; /* 图像高 */
|
||||
}HGGifSaveInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_CheckGifFile(const HGChar* fileName, HGBool* isGif);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_OpenGifReader(const HGChar* fileName, HGGifLoadInfo* info, HGGifReader* reader);
|
||||
|
|
|
@ -25,6 +25,9 @@ HG_DECLARE_HANDLE(HGImgFmtWriter);
|
|||
/* GIF */
|
||||
#define HGIMGFMT_TYPE_GIF 7L
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUInt width; /* 图像宽 */
|
||||
|
@ -41,6 +44,8 @@ typedef struct
|
|||
HGUInt tiffJpegQuality; /* tiff-jpeg质量 */
|
||||
}HGImgFmtSaveInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_GetImgFmtType(const HGChar* fileName, HGUInt* fmtType);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_GetImgFmtTypeFromFileName(const HGChar* fileName, HGUInt* fmtType);
|
||||
|
|
|
@ -7,15 +7,15 @@ extern "C"
|
|||
#include "jmemsys.h"
|
||||
};
|
||||
|
||||
typedef struct my_error_mgr
|
||||
struct my_error_mgr
|
||||
{
|
||||
struct jpeg_error_mgr pub;
|
||||
jmp_buf setjmp_buffer;
|
||||
}my_error_mgr, * my_error_mgr_ptr;
|
||||
};
|
||||
|
||||
METHODDEF(void) my_error_exit(j_common_ptr cinfo)
|
||||
{
|
||||
my_error_mgr_ptr myerr = (my_error_mgr_ptr)cinfo->err;
|
||||
my_error_mgr* myerr = (my_error_mgr*)cinfo->err;
|
||||
(*cinfo->err->output_message)(cinfo);
|
||||
longjmp(myerr->setjmp_buffer, (int)HGBASE_ERR_FAIL);
|
||||
}
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
#define HGIMGFMT_JPEGDENUNIT_INCH 1L /* 英寸 */
|
||||
#define HGIMGFMT_JPEGDENUNIT_CENTIMETER 2L /* 厘米 */
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUInt width; /* 图像宽 */
|
||||
|
@ -35,6 +38,8 @@ typedef struct
|
|||
HGUShort yDensity; /* 分辨率y值 */
|
||||
}HGJpegSaveInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_CheckJpegFile(const HGChar* fileName, HGBool *isJpeg);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_LoadJpegImage(const HGChar* fileName, HGJpegLoadInfo* info,
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
HG_DECLARE_HANDLE(HGOfdReader);
|
||||
HG_DECLARE_HANDLE(HGOfdImageWriter);
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUInt width;
|
||||
|
@ -17,6 +20,8 @@ typedef struct
|
|||
HGUInt bpp;
|
||||
}HGOfdPageInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_CheckOfdFile(const HGChar* fileName, HGBool* isOfd);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_OpenOfdReader(const HGChar* fileName, HGOfdReader* reader);
|
||||
|
|
|
@ -10,6 +10,9 @@
|
|||
HG_DECLARE_HANDLE(HGPdfReader);
|
||||
HG_DECLARE_HANDLE(HGPdfImageWriter);
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUInt width;
|
||||
|
@ -17,6 +20,8 @@ typedef struct
|
|||
HGUInt bpp;
|
||||
}HGPdfPageInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_CheckPdfFile(const HGChar* fileName, HGBool* isPdf);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_OpenPdfReader(const HGChar* fileName, HGPdfReader* reader);
|
||||
|
|
|
@ -27,6 +27,9 @@
|
|||
#define HGIMGFMT_PNGPHYSUNIT_METER 1L
|
||||
#define HGIMGFMT_PNGPHYSUNIT_LAST 2L
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUInt width; /* 图像宽 */
|
||||
|
@ -50,6 +53,8 @@ typedef struct
|
|||
HGUInt yPixelsPerUnit; /* 分辨率y */
|
||||
}HGPngSaveInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_CheckPngFile(const HGChar* fileName, HGBool* isPng);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_LoadPngImage(const HGChar* fileName, HGPngLoadInfo* info,
|
||||
|
|
|
@ -20,6 +20,9 @@ HG_DECLARE_HANDLE(HGTiffWriter);
|
|||
#define HGIMGFMT_TIFFRESUNIT_INCH 2L /* 英寸 */
|
||||
#define HGIMGFMT_TIFFRESUNIT_CENTIMETER 3L /* 厘米 */
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUInt width; /* 图像宽 */
|
||||
|
@ -41,6 +44,8 @@ typedef struct
|
|||
HGFloat yResolution; /* 分辨率y值 */
|
||||
}HGTiffSaveInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_CheckTiffFile(const HGChar* fileName, HGBool* isTiff);
|
||||
|
||||
HGEXPORT HGResult HGAPI HGImgFmt_OpenTiffReader(const HGChar* fileName, HGTiffReader* reader);
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
/* 外部去污 */
|
||||
#define HGIMGPROC_DECOTYPE_OUTSIDE 2L
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
/* 自动裁剪参数 */
|
||||
typedef struct
|
||||
{
|
||||
|
@ -83,6 +86,8 @@ typedef struct
|
|||
HGInt range; /* 默认40 */
|
||||
}HGImgFaceBkColorParam;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* 图像缩放
|
||||
* 参数:
|
||||
* 1) image: in, 源图像句柄
|
||||
|
|
|
@ -244,7 +244,7 @@ HGResult HGSaneManagerImpl::GetImage(HGSaneDeviceImpl* device, HGUInt type, HGUI
|
|||
return HGBASE_ERR_FAIL;
|
||||
}
|
||||
|
||||
void HGSaneManagerImpl::ThreadFunc(HGThread thread, HGPointer param)
|
||||
void HGAPI HGSaneManagerImpl::ThreadFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
HGSaneDeviceImpl* p = (HGSaneDeviceImpl*)param;
|
||||
|
||||
|
|
|
@ -72,7 +72,7 @@ public:
|
|||
HGResult GetImage(HGSaneDeviceImpl* device, HGUInt type, HGUInt origin, HGImage* image);
|
||||
|
||||
private:
|
||||
static void ThreadFunc(HGThread thread, HGPointer param);
|
||||
static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
|
||||
HGResult FindFunctions();
|
||||
|
||||
private:
|
||||
|
|
|
@ -29,7 +29,7 @@ HG_DECLARE_HANDLE(HGTwainDS);
|
|||
* 1) 如果event为HGTWAIN_EVENT_XFERREADY, TWAIN状态从5变为6
|
||||
* 2) 如果event为HGTWAIN_EVENT_CLOSEDSREQ, 表示需要关闭该DS
|
||||
*/
|
||||
typedef void (*HGDSEventFunc)(HGTwainDS ds, HGUInt event, HGPointer param);
|
||||
typedef void (HGAPI *HGDSEventFunc)(HGTwainDS ds, HGUInt event, HGPointer param);
|
||||
|
||||
/* 加载DSM
|
||||
* 参数:
|
||||
|
|
|
@ -8,6 +8,9 @@ HG_DECLARE_HANDLE(HGVersionMgr);
|
|||
|
||||
#define HGVERSION_APPNAME_SCANNER "Scanner"
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGBool postCrashInfo; /* 是否上报崩溃信息 */
|
||||
|
@ -25,6 +28,8 @@ typedef struct
|
|||
HGChar *md5; /* 安装包MD5 */
|
||||
}HGVersionInfo;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* HTTP下载回调, 如果需要停止下载返回非0, 否则返回0
|
||||
*/
|
||||
typedef HGInt (*HGHttpDownloadFunc)(HGULonglong totalSize, HGULonglong nowSize, HGPointer param);
|
||||
|
|
|
@ -1576,13 +1576,13 @@ HGResult HGVersionMgrImpl::GetDriverVersionList(const HGChar* devType, HGVersion
|
|||
return HGBASE_ERR_OK;
|
||||
}
|
||||
|
||||
void HGVersionMgrImpl::ThreadFunc(HGThread thread, HGPointer param)
|
||||
void HGAPI HGVersionMgrImpl::ThreadFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
HGVersionMgrImpl* p = (HGVersionMgrImpl*)param;
|
||||
HGBase_RunMsgPump(p->m_msgPump, MsgPumpFunc, p);
|
||||
}
|
||||
|
||||
void HGVersionMgrImpl::MsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointer param)
|
||||
void HGAPI HGVersionMgrImpl::MsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointer param)
|
||||
{
|
||||
(void)msgPump;
|
||||
assert(NULL != msg);
|
||||
|
|
|
@ -48,8 +48,8 @@ public:
|
|||
HGResult GetDriverVersionList(const HGChar* devType, HGVersionInfo** info, HGUInt* count);
|
||||
|
||||
private:
|
||||
static void ThreadFunc(HGThread thread, HGPointer param);
|
||||
static void MsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||||
static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
|
||||
static void HGAPI MsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||||
|
||||
private:
|
||||
HGServerConfig m_serverCfg;
|
||||
|
|
|
@ -6,14 +6,17 @@
|
|||
#include "HGString.h"
|
||||
#include "HGLibDeviceImpl.hpp"
|
||||
|
||||
typedef struct
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
struct HGLibSaveImageParam_V1
|
||||
{
|
||||
HGUInt size; /* 结构体大小 */
|
||||
HGUInt jpegQuality; /* jpeg下有效, 0-100 */
|
||||
HGUInt tiffCompression; /* tiff下有效, HGLIB_TIFFCOMPRESSION_* */
|
||||
HGUInt tiffJpegQuality; /* tiff且HGLIB_TIFFCOMPRESSION_JPEG下有效, 0-100 */
|
||||
HGBool ocr; /* 是否OCR,pdf和ofd格式有效 */
|
||||
}HGLibSaveImageParam_V1;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
HGLibImage HGAPI HGLib_LoadImage(const HGChar* filePath)
|
||||
{
|
||||
|
|
|
@ -346,6 +346,9 @@ HG_DECLARE_HANDLE(HGLibDevice);
|
|||
#define HGLIB_OPTION_VALUERANGETYPE_INTRANGE 4L
|
||||
#define HGLIB_OPTION_VALUERANGETYPE_DOUBLERANGE 5L
|
||||
|
||||
#pragma pack(push)
|
||||
#pragma pack(4)
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HGUInt size; /* 结构体大小,必须初始化为sizeof(HGLibSaveImageParam) */
|
||||
|
@ -416,12 +419,14 @@ typedef struct
|
|||
HGUInt paramCount;
|
||||
}HGLibDeviceParamGroup;
|
||||
|
||||
#pragma pack(pop)
|
||||
|
||||
/* 设备热拔插回调
|
||||
* event: HGLIB_DEVHOTPLUG_EVENT_*
|
||||
* deviceName: 设备名
|
||||
* param: 回调参数
|
||||
*/
|
||||
typedef void (*HGLibDeviceHotPlugEventFunc)(HGUInt event, const HGChar *deviceName, HGPointer param);
|
||||
typedef void (HGAPI *HGLibDeviceHotPlugEventFunc)(HGUInt event, const HGChar *deviceName, HGPointer param);
|
||||
|
||||
/* 设备扫描事件回调
|
||||
* device: 设备句柄
|
||||
|
@ -430,14 +435,14 @@ typedef void (*HGLibDeviceHotPlugEventFunc)(HGUInt event, const HGChar *deviceNa
|
|||
* info: 扫描信息, HGLIB_DEVSCAN_EVENT_INFO下有效
|
||||
* param: 回调参数
|
||||
*/
|
||||
typedef void (*HGLibDeviceScanEventFunc)(HGLibDevice device, HGUInt event, HGBool err, const HGChar *info, HGPointer param);
|
||||
typedef void (HGAPI *HGLibDeviceScanEventFunc)(HGLibDevice device, HGUInt event, HGBool err, const HGChar *info, HGPointer param);
|
||||
|
||||
/* 设备扫描图像回调
|
||||
* device: 设备句柄
|
||||
* image: 图像句柄, 不要调用HGLib_ReleaseImage释放, 回调执行后会自动释放
|
||||
* param: 回调参数
|
||||
*/
|
||||
typedef void (*HGLibDeviceScanImageFunc)(HGLibDevice device, HGLibImage image, HGPointer param);
|
||||
typedef void (HGAPI *HGLibDeviceScanImageFunc)(HGLibDevice device, HGLibImage image, HGPointer param);
|
||||
|
||||
/* 加载图像 */
|
||||
HGEXPORT HGLibImage HGAPI HGLib_LoadImage(const HGChar *filePath);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
#include "base/HGInc.h"
|
||||
#include "WebServer.h"
|
||||
|
||||
void HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param)
|
||||
void HGAPI HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param)
|
||||
{
|
||||
(void)msgPump;
|
||||
(void)param;
|
||||
|
|
|
@ -2,4 +2,4 @@
|
|||
|
||||
#include "base/HGMsgPump.h"
|
||||
|
||||
void HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||||
void HGAPI HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
|
@ -235,7 +235,7 @@ int WebServer::GetUserIndex(HGUInt id)
|
|||
return nIndex;
|
||||
}
|
||||
|
||||
void WebServer::ThreadFunc(HGThread thread, HGPointer param)
|
||||
void HGAPI WebServer::ThreadFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
WebServer* p = (WebServer*)param;
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ private:
|
|||
void PostConnectMsg(const std::string &ip, uint16_t port, int sockConn);
|
||||
#endif
|
||||
int GetUserIndex(HGUInt id);
|
||||
static void ThreadFunc(HGThread thread, HGPointer param);
|
||||
static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
|
||||
|
||||
private:
|
||||
HGMsgPump m_msgPump;
|
||||
|
|
|
@ -737,7 +737,7 @@ void WebUser::PostEventMsg(const HGByte* data, HGUInt dataSize)
|
|||
}
|
||||
}
|
||||
|
||||
void WebUser::ThreadFunc(HGThread thread, HGPointer param)
|
||||
void HGAPI WebUser::ThreadFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
WebUser* p = (WebUser*)param;
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ private:
|
|||
void PostDisConnectMsg();
|
||||
void PostCmdMsg(const HGByte* data, HGUInt dataSize);
|
||||
void PostEventMsg(const HGByte* data, HGUInt dataSize);
|
||||
static void ThreadFunc(HGThread thread, HGPointer param);
|
||||
static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
|
||||
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
|
||||
std::string GetBase64(HGImage image);
|
||||
HGBool SetParam(const char* optionName, const HGVoid* data);
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#include "WebServer.h"
|
||||
#include "MsgPumpCallback.h"
|
||||
|
||||
static void ThreadFunc(HGThread thread, HGPointer param)
|
||||
static void HGAPI ThreadFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
(void)thread;
|
||||
HGMsgPump msgPump = (HGMsgPump)param;
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
namespace ver_1
|
||||
{
|
||||
void HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param)
|
||||
void HGAPI HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param)
|
||||
{
|
||||
(void)msgPump;
|
||||
(void)param;
|
||||
|
@ -80,7 +80,7 @@ namespace ver_1
|
|||
|
||||
namespace ver_2
|
||||
{
|
||||
void HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param)
|
||||
void HGAPI HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param)
|
||||
{
|
||||
(void)msgPump;
|
||||
(void)param;
|
||||
|
|
|
@ -4,10 +4,10 @@
|
|||
|
||||
namespace ver_1
|
||||
{
|
||||
void HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||||
void HGAPI HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||||
}
|
||||
|
||||
namespace ver_2
|
||||
{
|
||||
void HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||||
void HGAPI HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
|
||||
}
|
|
@ -177,7 +177,7 @@ int WebServer::GetUserIndex(HGUInt id)
|
|||
return nIndex;
|
||||
}
|
||||
|
||||
void WebServer::ThreadFunc(HGThread thread, HGPointer param)
|
||||
void HGAPI WebServer::ThreadFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
WebServer* p = (WebServer*)param;
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ protected:
|
|||
void PostConnectMsg(const std::string &ip, uint16_t port, int sockConn);
|
||||
#endif
|
||||
int GetUserIndex(HGUInt id);
|
||||
static void ThreadFunc(HGThread thread, HGPointer param);
|
||||
static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
|
||||
|
||||
protected:
|
||||
HGMsgPump m_msgPump;
|
||||
|
|
|
@ -68,7 +68,7 @@ void WebUser::ThreadFunc()
|
|||
HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "WebUser::ThreadFunc");
|
||||
}
|
||||
|
||||
void WebUser::ThreadFunc(HGThread thread, HGPointer param)
|
||||
void HGAPI WebUser::ThreadFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
WebUser* p = (WebUser*)param;
|
||||
p->ThreadFunc();
|
||||
|
|
|
@ -27,7 +27,7 @@ protected:
|
|||
virtual void ThreadFunc();
|
||||
|
||||
private:
|
||||
static void ThreadFunc(HGThread thread, HGPointer param);
|
||||
static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
|
||||
|
||||
protected:
|
||||
WebServer* m_server;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include "MsgPumpCallback.h"
|
||||
#include "curl/curl.h"
|
||||
|
||||
static void CrashFunc(HGPointer crashAddr, HGPointer param)
|
||||
static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param)
|
||||
{
|
||||
HGChar logPath[256];
|
||||
HGBase_GetLogFilePath(logPath, 256);
|
||||
|
@ -21,7 +21,7 @@ static void CrashFunc(HGPointer crashAddr, HGPointer param)
|
|||
HGBase_MakeCrashFile(logPath);
|
||||
}
|
||||
|
||||
static void ThreadFunc(HGThread thread, HGPointer param)
|
||||
static void HGAPI ThreadFunc(HGThread thread, HGPointer param)
|
||||
{
|
||||
(void)thread;
|
||||
HGMsgPump msgPump = (HGMsgPump)param;
|
||||
|
|
|
@ -8,6 +8,7 @@ namespace WindowsFormsApp1
|
|||
{
|
||||
public class HGScannerLib
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
public struct HGLibSaveImageParam
|
||||
{
|
||||
public UInt32 size;
|
||||
|
@ -17,37 +18,42 @@ namespace WindowsFormsApp1
|
|||
public Int32 ocr;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
public struct HGLibDeviceIntValueList
|
||||
{
|
||||
public IntPtr value; // Int32指针
|
||||
public UInt32 count;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
public struct HGLibDeviceEnumValueList
|
||||
{
|
||||
public IntPtr value; // UInt32指针
|
||||
public UInt32 count;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
public struct HGLibDeviceDoubleValueList
|
||||
{
|
||||
public IntPtr value; // Double指针
|
||||
public UInt32 count;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
public struct HGLibDeviceIntValueRange
|
||||
{
|
||||
public Int32 minValue;
|
||||
public Int32 maxValue;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
public struct HGLibDeviceDoubleValueRange
|
||||
{
|
||||
public Double minValue;
|
||||
public Double maxValue;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 4)]
|
||||
public struct HGLibDeviceParamType
|
||||
{
|
||||
[FieldOffset(0)] public Int32 intValue;
|
||||
|
@ -56,7 +62,7 @@ namespace WindowsFormsApp1
|
|||
[FieldOffset(0)] public Int32 boolValue;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Explicit)]
|
||||
[StructLayout(LayoutKind.Explicit, Pack = 4)]
|
||||
public struct HGLibDeviceParamRangeType
|
||||
{
|
||||
[FieldOffset(0)] public HGLibDeviceIntValueList intValueList;
|
||||
|
@ -66,6 +72,7 @@ namespace WindowsFormsApp1
|
|||
[FieldOffset(0)] public HGLibDeviceDoubleValueRange doubleValueRange;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
public struct HGLibDeviceParam
|
||||
{
|
||||
public UInt32 option;
|
||||
|
@ -75,6 +82,7 @@ namespace WindowsFormsApp1
|
|||
public HGLibDeviceParamRangeType rangeTypeValue;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 4)]
|
||||
public struct HGLibDeviceParamGroup
|
||||
{
|
||||
public UInt32 group;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
using namespace std;
|
||||
|
||||
//有图事件回调
|
||||
static void DeviceScanImageFunc(HGLibDevice device, HGLibImage image, HGPointer param)
|
||||
static void HGAPI DeviceScanImageFunc(HGLibDevice device, HGLibImage image, HGPointer param)
|
||||
{
|
||||
static int indeximg = 0;
|
||||
string savepath = std::to_string(++indeximg) + ".jpg";
|
||||
|
@ -18,13 +18,13 @@ static void DeviceScanImageFunc(HGLibDevice device, HGLibImage image, HGPointer
|
|||
}
|
||||
|
||||
//设备热拔插事件回调
|
||||
static void DeviceHotPlugEvent(HGUInt event, const HGChar *deviceName, HGPointer param)
|
||||
static void HGAPI DeviceHotPlugEvent(HGUInt event, const HGChar *deviceName, HGPointer param)
|
||||
{
|
||||
cout << "Devices : " << deviceName << " DeviceHotPlugEvent : " << (event == HGLIB_DEVHOTPLUG_EVENT_ARRIVE ? "HGLIB_DEVHOTPLUG_EVENT_ARRIVE " : "HGLIB_DEVHOTPLUG_EVENT_LEFT") << endl;
|
||||
}
|
||||
|
||||
//扫描状态事件回调
|
||||
static void DeviceScanEvent(HGLibDevice device, HGUInt event, HGBool err, const HGChar *info, HGPointer param)
|
||||
static void HGAPI DeviceScanEvent(HGLibDevice device, HGUInt event, HGBool err, const HGChar *info, HGPointer param)
|
||||
{
|
||||
switch (event)
|
||||
{
|
||||
|
|
|
@ -7,6 +7,7 @@ from ctypes import *
|
|||
import random
|
||||
|
||||
class HGLibSaveImageParam(Structure):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("size", c_uint),
|
||||
("jpegQuality", c_uint),
|
||||
("tiffCompression", c_uint),
|
||||
|
@ -14,32 +15,39 @@ class HGLibSaveImageParam(Structure):
|
|||
("ocr", c_int)]
|
||||
|
||||
class HGLibDeviceIntValueList(Structure):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("value", POINTER(c_int)),
|
||||
("count", c_uint)]
|
||||
|
||||
class HGLibDeviceEnumValueList(Structure):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("value", POINTER(c_uint)),
|
||||
("count", c_uint)]
|
||||
|
||||
class HGLibDeviceDoubleValueList(Structure):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("value", POINTER(c_double)),
|
||||
("count", c_uint)]
|
||||
|
||||
class HGLibDeviceIntValueRange(Structure):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("minValue", c_int),
|
||||
("maxValue", c_int)]
|
||||
|
||||
class HGLibDeviceDoubleValueRange(Structure):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("minValue", c_double),
|
||||
("maxValue", c_double)]
|
||||
|
||||
class HGLibDeviceParamType(Union):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("intValue", c_int),
|
||||
("enumValue", c_uint),
|
||||
("doubleValue", c_double),
|
||||
("boolValue", c_int)]
|
||||
|
||||
class HGLibDeviceParamRangeType(Union):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("intValueList", HGLibDeviceIntValueList),
|
||||
("enumValueList", HGLibDeviceEnumValueList),
|
||||
("doubleValueList", HGLibDeviceDoubleValueList),
|
||||
|
@ -47,6 +55,7 @@ class HGLibDeviceParamRangeType(Union):
|
|||
("doubleValueRange", HGLibDeviceDoubleValueRange)]
|
||||
|
||||
class HGLibDeviceParam(Structure):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("option", c_uint),
|
||||
("type", c_uint),
|
||||
("typeValue", HGLibDeviceParamType),
|
||||
|
@ -54,6 +63,7 @@ class HGLibDeviceParam(Structure):
|
|||
("rangeTypeValue", HGLibDeviceParamRangeType)]
|
||||
|
||||
class HGLibDeviceParamGroup(Structure):
|
||||
_pack_ = 4
|
||||
_fields_ = [ ("group", c_uint),
|
||||
("param", POINTER(HGLibDeviceParam)),
|
||||
("paramCount", c_uint)]
|
||||
|
@ -78,9 +88,9 @@ HGLib_SaveImage.argtypes = [ctypes.c_void_p, ctypes.c_char_p, POINTER(HGLibSaveI
|
|||
HGLib_SaveImage.restype = ctypes.c_int
|
||||
ImageParam = HGLibSaveImageParam()
|
||||
ImageParam.size = 20
|
||||
ImageParam.jpegQuality = 100
|
||||
ImageParam.tiffCompression = 0
|
||||
ImageParam.tiffJpegQuality = 0
|
||||
ImageParam.jpegQuality = 80
|
||||
ImageParam.tiffCompression = 4
|
||||
ImageParam.tiffJpegQuality = 80
|
||||
ImageParam.ocr = 0
|
||||
Ret = HGLib_SaveImage(Image, c_char_p(b"2.jpg"), pointer(ImageParam))
|
||||
|
||||
|
|
Loading…
Reference in New Issue