1.所有回调函数改为HGAPI类型

2.所有结构改为4字节对齐
This commit is contained in:
luoliangyi 2022-10-12 11:35:09 +08:00
parent e0af02073c
commit fda0ad0afe
47 changed files with 168 additions and 69 deletions

1
.gitignore vendored
View File

@ -6,3 +6,4 @@
/third_party /third_party
/build /build
/build-qt /build-qt
/test

View File

@ -23,7 +23,7 @@ protected:
HGTwainDSM m_dsm; HGTwainDSM m_dsm;
HGTwainDS m_ds; HGTwainDS m_ds;
static void DSEventCallback(HGTwainDS ds, HGUInt event, HGPointer param); static void HGAPI DSEventCallback(HGTwainDS ds, HGUInt event, HGPointer param);
// 实现 // 实现
protected: protected:

View File

@ -4,7 +4,7 @@
#include "HGDef.h" #include "HGDef.h"
#include "HGBaseErr.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); HGEXPORT HGResult HGAPI HGBase_RegisterCrashFunc(HGCrashFunc func, HGPointer param);

View File

@ -110,6 +110,9 @@ typedef HGUInt HGResult;
#define HG_DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name #define HG_DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGInt left; HGInt left;
@ -138,4 +141,6 @@ typedef struct
HGFloat y; HGFloat y;
}HGPointF; }HGPointF;
#pragma pack(pop)
#endif /* __HGDEF_H__ */ #endif /* __HGDEF_H__ */

View File

@ -2,13 +2,13 @@
#include "HGInc.h" #include "HGInc.h"
#if !defined(HG_CMP_MSC) #if !defined(HG_CMP_MSC)
typedef struct struct event_t
{ {
HGBool state; HGBool state;
HGBool manual_reset; HGBool manual_reset;
pthread_mutex_t mutex; pthread_mutex_t mutex;
pthread_cond_t cond; pthread_cond_t cond;
}event_t, * event_handle; };
#endif #endif
HGResult HGAPI HGBase_CreateEvent(HGBool manualReset, HGBool initState, HGEvent* event) 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) #if !defined(HG_CMP_MSC)
event_handle hEvent = new event_t; event_t* hEvent = new event_t;
hEvent->state = initState; hEvent->state = initState;
hEvent->manual_reset = manualReset; hEvent->manual_reset = manualReset;
@ -50,7 +50,7 @@ HGResult HGAPI HGBase_DestroyEvent(HGEvent event)
} }
#if !defined(HG_CMP_MSC) #if !defined(HG_CMP_MSC)
event_handle hEvent = (event_handle)event; event_t* hEvent = (event_t*)event;
pthread_cond_destroy(&hEvent->cond); pthread_cond_destroy(&hEvent->cond);
pthread_mutex_destroy(&hEvent->mutex); pthread_mutex_destroy(&hEvent->mutex);
delete hEvent; delete hEvent;
@ -69,7 +69,7 @@ HGResult HGAPI HGBase_WaitEvent(HGEvent event)
} }
#if !defined(HG_CMP_MSC) #if !defined(HG_CMP_MSC)
event_handle hEvent = (event_handle)event; event_t* hEvent = (event_t*)event;
if (0 != pthread_mutex_lock(&hEvent->mutex)) if (0 != pthread_mutex_lock(&hEvent->mutex))
{ {
return HGBASE_ERR_FAIL; return HGBASE_ERR_FAIL;
@ -121,7 +121,7 @@ HGResult HGAPI HGBase_WaitEventTimeout(HGEvent event, HGUInt milliseconds)
} }
int rc = 0; int rc = 0;
event_handle hEvent = (event_handle)event; event_t* hEvent = (event_t*)event;
if (pthread_mutex_lock(&hEvent->mutex) != 0) if (pthread_mutex_lock(&hEvent->mutex) != 0)
{ {
return HGBASE_ERR_FAIL; return HGBASE_ERR_FAIL;
@ -174,7 +174,7 @@ HGResult HGAPI HGBase_SetEvent(HGEvent event)
} }
#if !defined(HG_CMP_MSC) #if !defined(HG_CMP_MSC)
event_handle hEvent = (event_handle)event; event_t* hEvent = (event_t*)event;
if (0 != pthread_mutex_lock(&hEvent->mutex)) if (0 != pthread_mutex_lock(&hEvent->mutex))
{ {
return HGBASE_ERR_FAIL; return HGBASE_ERR_FAIL;
@ -218,7 +218,7 @@ HGResult HGAPI HGBase_ResetEvent(HGEvent event)
} }
#if !defined(HG_CMP_MSC) #if !defined(HG_CMP_MSC)
event_handle hEvent = (event_handle)event; event_t* hEvent = (event_t*)event;
if (0 != pthread_mutex_lock(&hEvent->mutex)) if (0 != pthread_mutex_lock(&hEvent->mutex))
{ {
return HGBASE_ERR_FAIL; return HGBASE_ERR_FAIL;

View File

@ -27,6 +27,9 @@ HG_DECLARE_HANDLE(HGImage);
/* 底左结构 */ /* 底左结构 */
#define HGBASE_IMGORIGIN_BOTTOM 2L #define HGBASE_IMGORIGIN_BOTTOM 2L
#pragma pack(push)
#pragma pack(4)
/* 图像信息 */ /* 图像信息 */
typedef struct typedef struct
{ {
@ -46,6 +49,8 @@ typedef struct
HGUInt bottom; HGUInt bottom;
}HGImageRoi; }HGImageRoi;
#pragma pack(pop)
/* 创建空白的新图像 /* 创建空白的新图像
* : * :
* 1) width: in, * 1) width: in,

View File

@ -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); } #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. */ /* MD5 context. */
typedef struct struct MD5_CTX
{ {
/* state (ABCD) */ /* state (ABCD) */
/*四个32bits数用于存放最终计算得到的消息摘要。当消息长度〉512bits时也用于存放每个512bits的中间结果*/ /*四个32bits数用于存放最终计算得到的消息摘要。当消息长度〉512bits时也用于存放每个512bits的中间结果*/
@ -56,7 +56,7 @@ typedef struct
/* input buffer */ /* input buffer */
/*存放输入的信息的缓冲区512bits*/ /*存放输入的信息的缓冲区512bits*/
HGByte buffer[64]; HGByte buffer[64];
}MD5_CTX; };
/* MD5 initialization. Begins an MD5 operation, writing a new context. */ /* MD5 initialization. Begins an MD5 operation, writing a new context. */
/*初始化md5的结构*/ /*初始化md5的结构*/

View File

@ -6,6 +6,9 @@
HG_DECLARE_HANDLE(HGMsgPump); HG_DECLARE_HANDLE(HGMsgPump);
#pragma pack(push)
#pragma pack(4)
/* 消息结构体, 可以自定义 */ /* 消息结构体, 可以自定义 */
typedef struct typedef struct
{ {
@ -13,7 +16,9 @@ typedef struct
HGPointer data; /* 携带的数据 */ HGPointer data; /* 携带的数据 */
}HGMsg; }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); HGEXPORT HGResult HGAPI HGBase_CreateMsgPump(HGMsgPump *msgPump);

View File

@ -107,7 +107,7 @@ struct HGNamedPipeClientImpl
#endif #endif
}; };
static void NamedPipeServerFunc(HGThread thread, HGPointer param) static void HGAPI NamedPipeServerFunc(HGThread thread, HGPointer param)
{ {
HGNamedPipeServerImpl* p = (HGNamedPipeServerImpl*)param; HGNamedPipeServerImpl* p = (HGNamedPipeServerImpl*)param;
#if defined(HG_CMP_MSC) #if defined(HG_CMP_MSC)

View File

@ -12,7 +12,7 @@ HG_DECLARE_HANDLE(HGThread);
* 2) param: in, * 2) param: in,
* : * :
*/ */
typedef void (*HGThreadFunc)(HGThread thread, HGPointer param); typedef void (HGAPI *HGThreadFunc)(HGThread thread, HGPointer param);
/* 开启线程 /* 开启线程
* : * :

View File

@ -4,6 +4,9 @@
#include "HGDef.h" #include "HGDef.h"
#include "HGBaseErr.h" #include "HGBaseErr.h"
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUShort year; HGUShort year;
@ -16,6 +19,8 @@ typedef struct
HGUShort milliseconds; HGUShort milliseconds;
}HGTimeInfo; }HGTimeInfo;
#pragma pack(pop)
HGEXPORT HGResult HGAPI HGBase_GetLocalTime(HGTimeInfo *timeInfo); HGEXPORT HGResult HGAPI HGBase_GetLocalTime(HGTimeInfo *timeInfo);
#endif /* __HGTIME_H__ */ #endif /* __HGTIME_H__ */

View File

@ -12,6 +12,9 @@
#define HGIMGFMT_BMPENCODING_RLE4 2L #define HGIMGFMT_BMPENCODING_RLE4 2L
#define HGIMGFMT_BMPENCODING_BITFIELDS 3L #define HGIMGFMT_BMPENCODING_BITFIELDS 3L
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUInt width; /* 宽 */ HGUInt width; /* 宽 */
@ -28,6 +31,8 @@ typedef struct
HGUInt yPelsPerMeter; /* 每米的像素数y */ HGUInt yPelsPerMeter; /* 每米的像素数y */
}HGBmpSaveInfo; }HGBmpSaveInfo;
#pragma pack(pop)
/* 检查文件是否是BMP图像 /* 检查文件是否是BMP图像
* : * :
* 1) fileName: in, , windows系统上是GBK编码, linux系统上是UTF8编码 * 1) fileName: in, , windows系统上是GBK编码, linux系统上是UTF8编码

View File

@ -117,19 +117,21 @@ struct HGGifWriterImpl
static int SortRGBAxis; static int SortRGBAxis;
typedef struct QuantizedColorType { struct QuantizedColorType
{
GifByteType RGB[3]; GifByteType RGB[3];
GifByteType NewColorIndex; GifByteType NewColorIndex;
long Count; long Count;
struct QuantizedColorType* Pnext; struct QuantizedColorType* Pnext;
} QuantizedColorType; };
typedef struct NewColorMapType { struct NewColorMapType
{
GifByteType RGBMin[3], RGBWidth[3]; GifByteType RGBMin[3], RGBWidth[3];
unsigned int NumEntries; /* # of QuantizedColorType in linked list below */ unsigned int NumEntries; /* # of QuantizedColorType in linked list below */
unsigned long Count; /* Total number of pixels in all the entries */ unsigned long Count; /* Total number of pixels in all the entries */
QuantizedColorType* QuantizedColors; QuantizedColorType* QuantizedColors;
} NewColorMapType; };
static int SortCmpRtn(const void* Entry1, static int SortCmpRtn(const void* Entry1,
const void* Entry2) { const void* Entry2) {

View File

@ -9,6 +9,9 @@
HG_DECLARE_HANDLE(HGGifReader); HG_DECLARE_HANDLE(HGGifReader);
HG_DECLARE_HANDLE(HGGifWriter); HG_DECLARE_HANDLE(HGGifWriter);
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUInt width; /* 图像宽 */ HGUInt width; /* 图像宽 */
@ -23,6 +26,8 @@ typedef struct
HGUInt height; /* 图像高 */ HGUInt height; /* 图像高 */
}HGGifSaveInfo; }HGGifSaveInfo;
#pragma pack(pop)
HGEXPORT HGResult HGAPI HGImgFmt_CheckGifFile(const HGChar* fileName, HGBool* isGif); HGEXPORT HGResult HGAPI HGImgFmt_CheckGifFile(const HGChar* fileName, HGBool* isGif);
HGEXPORT HGResult HGAPI HGImgFmt_OpenGifReader(const HGChar* fileName, HGGifLoadInfo* info, HGGifReader* reader); HGEXPORT HGResult HGAPI HGImgFmt_OpenGifReader(const HGChar* fileName, HGGifLoadInfo* info, HGGifReader* reader);

View File

@ -25,6 +25,9 @@ HG_DECLARE_HANDLE(HGImgFmtWriter);
/* GIF */ /* GIF */
#define HGIMGFMT_TYPE_GIF 7L #define HGIMGFMT_TYPE_GIF 7L
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUInt width; /* 图像宽 */ HGUInt width; /* 图像宽 */
@ -41,6 +44,8 @@ typedef struct
HGUInt tiffJpegQuality; /* tiff-jpeg质量 */ HGUInt tiffJpegQuality; /* tiff-jpeg质量 */
}HGImgFmtSaveInfo; }HGImgFmtSaveInfo;
#pragma pack(pop)
HGEXPORT HGResult HGAPI HGImgFmt_GetImgFmtType(const HGChar* fileName, HGUInt* fmtType); HGEXPORT HGResult HGAPI HGImgFmt_GetImgFmtType(const HGChar* fileName, HGUInt* fmtType);
HGEXPORT HGResult HGAPI HGImgFmt_GetImgFmtTypeFromFileName(const HGChar* fileName, HGUInt* fmtType); HGEXPORT HGResult HGAPI HGImgFmt_GetImgFmtTypeFromFileName(const HGChar* fileName, HGUInt* fmtType);

View File

@ -7,15 +7,15 @@ extern "C"
#include "jmemsys.h" #include "jmemsys.h"
}; };
typedef struct my_error_mgr struct my_error_mgr
{ {
struct jpeg_error_mgr pub; struct jpeg_error_mgr pub;
jmp_buf setjmp_buffer; jmp_buf setjmp_buffer;
}my_error_mgr, * my_error_mgr_ptr; };
METHODDEF(void) my_error_exit(j_common_ptr cinfo) 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); (*cinfo->err->output_message)(cinfo);
longjmp(myerr->setjmp_buffer, (int)HGBASE_ERR_FAIL); longjmp(myerr->setjmp_buffer, (int)HGBASE_ERR_FAIL);
} }

View File

@ -16,6 +16,9 @@
#define HGIMGFMT_JPEGDENUNIT_INCH 1L /* 英寸 */ #define HGIMGFMT_JPEGDENUNIT_INCH 1L /* 英寸 */
#define HGIMGFMT_JPEGDENUNIT_CENTIMETER 2L /* 厘米 */ #define HGIMGFMT_JPEGDENUNIT_CENTIMETER 2L /* 厘米 */
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUInt width; /* 图像宽 */ HGUInt width; /* 图像宽 */
@ -35,6 +38,8 @@ typedef struct
HGUShort yDensity; /* 分辨率y值 */ HGUShort yDensity; /* 分辨率y值 */
}HGJpegSaveInfo; }HGJpegSaveInfo;
#pragma pack(pop)
HGEXPORT HGResult HGAPI HGImgFmt_CheckJpegFile(const HGChar* fileName, HGBool *isJpeg); HGEXPORT HGResult HGAPI HGImgFmt_CheckJpegFile(const HGChar* fileName, HGBool *isJpeg);
HGEXPORT HGResult HGAPI HGImgFmt_LoadJpegImage(const HGChar* fileName, HGJpegLoadInfo* info, HGEXPORT HGResult HGAPI HGImgFmt_LoadJpegImage(const HGChar* fileName, HGJpegLoadInfo* info,

View File

@ -10,6 +10,9 @@
HG_DECLARE_HANDLE(HGOfdReader); HG_DECLARE_HANDLE(HGOfdReader);
HG_DECLARE_HANDLE(HGOfdImageWriter); HG_DECLARE_HANDLE(HGOfdImageWriter);
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUInt width; HGUInt width;
@ -17,6 +20,8 @@ typedef struct
HGUInt bpp; HGUInt bpp;
}HGOfdPageInfo; }HGOfdPageInfo;
#pragma pack(pop)
HGEXPORT HGResult HGAPI HGImgFmt_CheckOfdFile(const HGChar* fileName, HGBool* isOfd); HGEXPORT HGResult HGAPI HGImgFmt_CheckOfdFile(const HGChar* fileName, HGBool* isOfd);
HGEXPORT HGResult HGAPI HGImgFmt_OpenOfdReader(const HGChar* fileName, HGOfdReader* reader); HGEXPORT HGResult HGAPI HGImgFmt_OpenOfdReader(const HGChar* fileName, HGOfdReader* reader);

View File

@ -10,6 +10,9 @@
HG_DECLARE_HANDLE(HGPdfReader); HG_DECLARE_HANDLE(HGPdfReader);
HG_DECLARE_HANDLE(HGPdfImageWriter); HG_DECLARE_HANDLE(HGPdfImageWriter);
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUInt width; HGUInt width;
@ -17,6 +20,8 @@ typedef struct
HGUInt bpp; HGUInt bpp;
}HGPdfPageInfo; }HGPdfPageInfo;
#pragma pack(pop)
HGEXPORT HGResult HGAPI HGImgFmt_CheckPdfFile(const HGChar* fileName, HGBool* isPdf); HGEXPORT HGResult HGAPI HGImgFmt_CheckPdfFile(const HGChar* fileName, HGBool* isPdf);
HGEXPORT HGResult HGAPI HGImgFmt_OpenPdfReader(const HGChar* fileName, HGPdfReader* reader); HGEXPORT HGResult HGAPI HGImgFmt_OpenPdfReader(const HGChar* fileName, HGPdfReader* reader);

View File

@ -27,6 +27,9 @@
#define HGIMGFMT_PNGPHYSUNIT_METER 1L #define HGIMGFMT_PNGPHYSUNIT_METER 1L
#define HGIMGFMT_PNGPHYSUNIT_LAST 2L #define HGIMGFMT_PNGPHYSUNIT_LAST 2L
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUInt width; /* 图像宽 */ HGUInt width; /* 图像宽 */
@ -50,6 +53,8 @@ typedef struct
HGUInt yPixelsPerUnit; /* 分辨率y */ HGUInt yPixelsPerUnit; /* 分辨率y */
}HGPngSaveInfo; }HGPngSaveInfo;
#pragma pack(pop)
HGEXPORT HGResult HGAPI HGImgFmt_CheckPngFile(const HGChar* fileName, HGBool* isPng); HGEXPORT HGResult HGAPI HGImgFmt_CheckPngFile(const HGChar* fileName, HGBool* isPng);
HGEXPORT HGResult HGAPI HGImgFmt_LoadPngImage(const HGChar* fileName, HGPngLoadInfo* info, HGEXPORT HGResult HGAPI HGImgFmt_LoadPngImage(const HGChar* fileName, HGPngLoadInfo* info,

View File

@ -20,6 +20,9 @@ HG_DECLARE_HANDLE(HGTiffWriter);
#define HGIMGFMT_TIFFRESUNIT_INCH 2L /* 英寸 */ #define HGIMGFMT_TIFFRESUNIT_INCH 2L /* 英寸 */
#define HGIMGFMT_TIFFRESUNIT_CENTIMETER 3L /* 厘米 */ #define HGIMGFMT_TIFFRESUNIT_CENTIMETER 3L /* 厘米 */
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUInt width; /* 图像宽 */ HGUInt width; /* 图像宽 */
@ -41,6 +44,8 @@ typedef struct
HGFloat yResolution; /* 分辨率y值 */ HGFloat yResolution; /* 分辨率y值 */
}HGTiffSaveInfo; }HGTiffSaveInfo;
#pragma pack(pop)
HGEXPORT HGResult HGAPI HGImgFmt_CheckTiffFile(const HGChar* fileName, HGBool* isTiff); HGEXPORT HGResult HGAPI HGImgFmt_CheckTiffFile(const HGChar* fileName, HGBool* isTiff);
HGEXPORT HGResult HGAPI HGImgFmt_OpenTiffReader(const HGChar* fileName, HGTiffReader* reader); HGEXPORT HGResult HGAPI HGImgFmt_OpenTiffReader(const HGChar* fileName, HGTiffReader* reader);

View File

@ -42,6 +42,9 @@
/* 外部去污 */ /* 外部去污 */
#define HGIMGPROC_DECOTYPE_OUTSIDE 2L #define HGIMGPROC_DECOTYPE_OUTSIDE 2L
#pragma pack(push)
#pragma pack(4)
/* 自动裁剪参数 */ /* 自动裁剪参数 */
typedef struct typedef struct
{ {
@ -83,6 +86,8 @@ typedef struct
HGInt range; /* 默认40 */ HGInt range; /* 默认40 */
}HGImgFaceBkColorParam; }HGImgFaceBkColorParam;
#pragma pack(pop)
/* 图像缩放 /* 图像缩放
* : * :
* 1) image: in, * 1) image: in,

View File

@ -244,7 +244,7 @@ HGResult HGSaneManagerImpl::GetImage(HGSaneDeviceImpl* device, HGUInt type, HGUI
return HGBASE_ERR_FAIL; return HGBASE_ERR_FAIL;
} }
void HGSaneManagerImpl::ThreadFunc(HGThread thread, HGPointer param) void HGAPI HGSaneManagerImpl::ThreadFunc(HGThread thread, HGPointer param)
{ {
HGSaneDeviceImpl* p = (HGSaneDeviceImpl*)param; HGSaneDeviceImpl* p = (HGSaneDeviceImpl*)param;

View File

@ -72,7 +72,7 @@ public:
HGResult GetImage(HGSaneDeviceImpl* device, HGUInt type, HGUInt origin, HGImage* image); HGResult GetImage(HGSaneDeviceImpl* device, HGUInt type, HGUInt origin, HGImage* image);
private: private:
static void ThreadFunc(HGThread thread, HGPointer param); static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
HGResult FindFunctions(); HGResult FindFunctions();
private: private:

View File

@ -29,7 +29,7 @@ HG_DECLARE_HANDLE(HGTwainDS);
* 1) event为HGTWAIN_EVENT_XFERREADY, TWAIN状态从5变为6 * 1) event为HGTWAIN_EVENT_XFERREADY, TWAIN状态从5变为6
* 2) event为HGTWAIN_EVENT_CLOSEDSREQ, DS * 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 /* 加载DSM
* : * :

View File

@ -8,6 +8,9 @@ HG_DECLARE_HANDLE(HGVersionMgr);
#define HGVERSION_APPNAME_SCANNER "Scanner" #define HGVERSION_APPNAME_SCANNER "Scanner"
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGBool postCrashInfo; /* 是否上报崩溃信息 */ HGBool postCrashInfo; /* 是否上报崩溃信息 */
@ -25,6 +28,8 @@ typedef struct
HGChar *md5; /* 安装包MD5 */ HGChar *md5; /* 安装包MD5 */
}HGVersionInfo; }HGVersionInfo;
#pragma pack(pop)
/* HTTP下载回调, 如果需要停止下载返回非0, 否则返回0 /* HTTP下载回调, 如果需要停止下载返回非0, 否则返回0
*/ */
typedef HGInt (*HGHttpDownloadFunc)(HGULonglong totalSize, HGULonglong nowSize, HGPointer param); typedef HGInt (*HGHttpDownloadFunc)(HGULonglong totalSize, HGULonglong nowSize, HGPointer param);

View File

@ -1576,13 +1576,13 @@ HGResult HGVersionMgrImpl::GetDriverVersionList(const HGChar* devType, HGVersion
return HGBASE_ERR_OK; return HGBASE_ERR_OK;
} }
void HGVersionMgrImpl::ThreadFunc(HGThread thread, HGPointer param) void HGAPI HGVersionMgrImpl::ThreadFunc(HGThread thread, HGPointer param)
{ {
HGVersionMgrImpl* p = (HGVersionMgrImpl*)param; HGVersionMgrImpl* p = (HGVersionMgrImpl*)param;
HGBase_RunMsgPump(p->m_msgPump, MsgPumpFunc, p); 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; (void)msgPump;
assert(NULL != msg); assert(NULL != msg);

View File

@ -48,8 +48,8 @@ public:
HGResult GetDriverVersionList(const HGChar* devType, HGVersionInfo** info, HGUInt* count); HGResult GetDriverVersionList(const HGChar* devType, HGVersionInfo** info, HGUInt* count);
private: private:
static void ThreadFunc(HGThread thread, HGPointer param); static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
static void MsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointer param); static void HGAPI MsgPumpFunc(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
private: private:
HGServerConfig m_serverCfg; HGServerConfig m_serverCfg;

View File

@ -6,14 +6,17 @@
#include "HGString.h" #include "HGString.h"
#include "HGLibDeviceImpl.hpp" #include "HGLibDeviceImpl.hpp"
typedef struct #pragma pack(push)
#pragma pack(4)
struct HGLibSaveImageParam_V1
{ {
HGUInt size; /* 结构体大小 */ HGUInt size; /* 结构体大小 */
HGUInt jpegQuality; /* jpeg下有效, 0-100 */ HGUInt jpegQuality; /* jpeg下有效, 0-100 */
HGUInt tiffCompression; /* tiff下有效, HGLIB_TIFFCOMPRESSION_* */ HGUInt tiffCompression; /* tiff下有效, HGLIB_TIFFCOMPRESSION_* */
HGUInt tiffJpegQuality; /* tiff且HGLIB_TIFFCOMPRESSION_JPEG下有效, 0-100 */ HGUInt tiffJpegQuality; /* tiff且HGLIB_TIFFCOMPRESSION_JPEG下有效, 0-100 */
HGBool ocr; /* 是否OCRpdf和ofd格式有效 */ HGBool ocr; /* 是否OCRpdf和ofd格式有效 */
}HGLibSaveImageParam_V1; };
#pragma pack(pop)
HGLibImage HGAPI HGLib_LoadImage(const HGChar* filePath) HGLibImage HGAPI HGLib_LoadImage(const HGChar* filePath)
{ {

View File

@ -346,6 +346,9 @@ HG_DECLARE_HANDLE(HGLibDevice);
#define HGLIB_OPTION_VALUERANGETYPE_INTRANGE 4L #define HGLIB_OPTION_VALUERANGETYPE_INTRANGE 4L
#define HGLIB_OPTION_VALUERANGETYPE_DOUBLERANGE 5L #define HGLIB_OPTION_VALUERANGETYPE_DOUBLERANGE 5L
#pragma pack(push)
#pragma pack(4)
typedef struct typedef struct
{ {
HGUInt size; /* 结构体大小必须初始化为sizeof(HGLibSaveImageParam) */ HGUInt size; /* 结构体大小必须初始化为sizeof(HGLibSaveImageParam) */
@ -416,12 +419,14 @@ typedef struct
HGUInt paramCount; HGUInt paramCount;
}HGLibDeviceParamGroup; }HGLibDeviceParamGroup;
#pragma pack(pop)
/* 设备热拔插回调 /* 设备热拔插回调
* event: HGLIB_DEVHOTPLUG_EVENT_* * event: HGLIB_DEVHOTPLUG_EVENT_*
* deviceName: * deviceName:
* param: * param:
*/ */
typedef void (*HGLibDeviceHotPlugEventFunc)(HGUInt event, const HGChar *deviceName, HGPointer param); typedef void (HGAPI *HGLibDeviceHotPlugEventFunc)(HGUInt event, const HGChar *deviceName, HGPointer param);
/* 设备扫描事件回调 /* 设备扫描事件回调
* device: * device:
@ -430,14 +435,14 @@ typedef void (*HGLibDeviceHotPlugEventFunc)(HGUInt event, const HGChar *deviceNa
* info: , HGLIB_DEVSCAN_EVENT_INFO下有效 * info: , HGLIB_DEVSCAN_EVENT_INFO下有效
* param: * 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: * device:
* image: , HGLib_ReleaseImage释放, * image: , HGLib_ReleaseImage释放,
* param: * 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); HGEXPORT HGLibImage HGAPI HGLib_LoadImage(const HGChar *filePath);

View File

@ -3,7 +3,7 @@
#include "base/HGInc.h" #include "base/HGInc.h"
#include "WebServer.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)msgPump;
(void)param; (void)param;

View File

@ -2,4 +2,4 @@
#include "base/HGMsgPump.h" #include "base/HGMsgPump.h"
void HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param); void HGAPI HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);

View File

@ -235,7 +235,7 @@ int WebServer::GetUserIndex(HGUInt id)
return nIndex; return nIndex;
} }
void WebServer::ThreadFunc(HGThread thread, HGPointer param) void HGAPI WebServer::ThreadFunc(HGThread thread, HGPointer param)
{ {
WebServer* p = (WebServer*)param; WebServer* p = (WebServer*)param;

View File

@ -30,7 +30,7 @@ private:
void PostConnectMsg(const std::string &ip, uint16_t port, int sockConn); void PostConnectMsg(const std::string &ip, uint16_t port, int sockConn);
#endif #endif
int GetUserIndex(HGUInt id); int GetUserIndex(HGUInt id);
static void ThreadFunc(HGThread thread, HGPointer param); static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
private: private:
HGMsgPump m_msgPump; HGMsgPump m_msgPump;

View File

@ -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; WebUser* p = (WebUser*)param;

View File

@ -44,7 +44,7 @@ private:
void PostDisConnectMsg(); void PostDisConnectMsg();
void PostCmdMsg(const HGByte* data, HGUInt dataSize); void PostCmdMsg(const HGByte* data, HGUInt dataSize);
void PostEventMsg(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); static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
std::string GetBase64(HGImage image); std::string GetBase64(HGImage image);
HGBool SetParam(const char* optionName, const HGVoid* data); HGBool SetParam(const char* optionName, const HGVoid* data);

View File

@ -5,7 +5,7 @@
#include "WebServer.h" #include "WebServer.h"
#include "MsgPumpCallback.h" #include "MsgPumpCallback.h"
static void ThreadFunc(HGThread thread, HGPointer param) static void HGAPI ThreadFunc(HGThread thread, HGPointer param)
{ {
(void)thread; (void)thread;
HGMsgPump msgPump = (HGMsgPump)param; HGMsgPump msgPump = (HGMsgPump)param;

View File

@ -9,7 +9,7 @@
namespace ver_1 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)msgPump;
(void)param; (void)param;
@ -80,7 +80,7 @@ namespace ver_1
namespace ver_2 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)msgPump;
(void)param; (void)param;

View File

@ -4,10 +4,10 @@
namespace ver_1 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 namespace ver_2
{ {
void HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param); void HGAPI HGMsgPumpCallback(HGMsgPump msgPump, const HGMsg* msg, HGPointer param);
} }

View File

@ -177,7 +177,7 @@ int WebServer::GetUserIndex(HGUInt id)
return nIndex; return nIndex;
} }
void WebServer::ThreadFunc(HGThread thread, HGPointer param) void HGAPI WebServer::ThreadFunc(HGThread thread, HGPointer param)
{ {
WebServer* p = (WebServer*)param; WebServer* p = (WebServer*)param;

View File

@ -27,7 +27,7 @@ protected:
void PostConnectMsg(const std::string &ip, uint16_t port, int sockConn); void PostConnectMsg(const std::string &ip, uint16_t port, int sockConn);
#endif #endif
int GetUserIndex(HGUInt id); int GetUserIndex(HGUInt id);
static void ThreadFunc(HGThread thread, HGPointer param); static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
protected: protected:
HGMsgPump m_msgPump; HGMsgPump m_msgPump;

View File

@ -68,7 +68,7 @@ void WebUser::ThreadFunc()
HGBase_WriteInfo(HGBASE_INFOTYPE_DESC, "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; WebUser* p = (WebUser*)param;
p->ThreadFunc(); p->ThreadFunc();

View File

@ -27,7 +27,7 @@ protected:
virtual void ThreadFunc(); virtual void ThreadFunc();
private: private:
static void ThreadFunc(HGThread thread, HGPointer param); static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
protected: protected:
WebServer* m_server; WebServer* m_server;

View File

@ -13,7 +13,7 @@
#include "MsgPumpCallback.h" #include "MsgPumpCallback.h"
#include "curl/curl.h" #include "curl/curl.h"
static void CrashFunc(HGPointer crashAddr, HGPointer param) static void HGAPI CrashFunc(HGPointer crashAddr, HGPointer param)
{ {
HGChar logPath[256]; HGChar logPath[256];
HGBase_GetLogFilePath(logPath, 256); HGBase_GetLogFilePath(logPath, 256);
@ -21,7 +21,7 @@ static void CrashFunc(HGPointer crashAddr, HGPointer param)
HGBase_MakeCrashFile(logPath); HGBase_MakeCrashFile(logPath);
} }
static void ThreadFunc(HGThread thread, HGPointer param) static void HGAPI ThreadFunc(HGThread thread, HGPointer param)
{ {
(void)thread; (void)thread;
HGMsgPump msgPump = (HGMsgPump)param; HGMsgPump msgPump = (HGMsgPump)param;

View File

@ -8,6 +8,7 @@ namespace WindowsFormsApp1
{ {
public class HGScannerLib public class HGScannerLib
{ {
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct HGLibSaveImageParam public struct HGLibSaveImageParam
{ {
public UInt32 size; public UInt32 size;
@ -17,37 +18,42 @@ namespace WindowsFormsApp1
public Int32 ocr; public Int32 ocr;
} }
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct HGLibDeviceIntValueList public struct HGLibDeviceIntValueList
{ {
public IntPtr value; // Int32指针 public IntPtr value; // Int32指针
public UInt32 count; public UInt32 count;
} }
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct HGLibDeviceEnumValueList public struct HGLibDeviceEnumValueList
{ {
public IntPtr value; // UInt32指针 public IntPtr value; // UInt32指针
public UInt32 count; public UInt32 count;
} }
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct HGLibDeviceDoubleValueList public struct HGLibDeviceDoubleValueList
{ {
public IntPtr value; // Double指针 public IntPtr value; // Double指针
public UInt32 count; public UInt32 count;
} }
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct HGLibDeviceIntValueRange public struct HGLibDeviceIntValueRange
{ {
public Int32 minValue; public Int32 minValue;
public Int32 maxValue; public Int32 maxValue;
} }
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct HGLibDeviceDoubleValueRange public struct HGLibDeviceDoubleValueRange
{ {
public Double minValue; public Double minValue;
public Double maxValue; public Double maxValue;
} }
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit, Pack = 4)]
public struct HGLibDeviceParamType public struct HGLibDeviceParamType
{ {
[FieldOffset(0)] public Int32 intValue; [FieldOffset(0)] public Int32 intValue;
@ -56,7 +62,7 @@ namespace WindowsFormsApp1
[FieldOffset(0)] public Int32 boolValue; [FieldOffset(0)] public Int32 boolValue;
} }
[StructLayout(LayoutKind.Explicit)] [StructLayout(LayoutKind.Explicit, Pack = 4)]
public struct HGLibDeviceParamRangeType public struct HGLibDeviceParamRangeType
{ {
[FieldOffset(0)] public HGLibDeviceIntValueList intValueList; [FieldOffset(0)] public HGLibDeviceIntValueList intValueList;
@ -66,6 +72,7 @@ namespace WindowsFormsApp1
[FieldOffset(0)] public HGLibDeviceDoubleValueRange doubleValueRange; [FieldOffset(0)] public HGLibDeviceDoubleValueRange doubleValueRange;
} }
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct HGLibDeviceParam public struct HGLibDeviceParam
{ {
public UInt32 option; public UInt32 option;
@ -75,6 +82,7 @@ namespace WindowsFormsApp1
public HGLibDeviceParamRangeType rangeTypeValue; public HGLibDeviceParamRangeType rangeTypeValue;
} }
[StructLayout(LayoutKind.Sequential, Pack = 4)]
public struct HGLibDeviceParamGroup public struct HGLibDeviceParamGroup
{ {
public UInt32 group; public UInt32 group;

View File

@ -8,7 +8,7 @@
using namespace std; 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; static int indeximg = 0;
string savepath = std::to_string(++indeximg) + ".jpg"; 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; 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) switch (event)
{ {

View File

@ -7,6 +7,7 @@ from ctypes import *
import random import random
class HGLibSaveImageParam(Structure): class HGLibSaveImageParam(Structure):
_pack_ = 4
_fields_ = [ ("size", c_uint), _fields_ = [ ("size", c_uint),
("jpegQuality", c_uint), ("jpegQuality", c_uint),
("tiffCompression", c_uint), ("tiffCompression", c_uint),
@ -14,32 +15,39 @@ class HGLibSaveImageParam(Structure):
("ocr", c_int)] ("ocr", c_int)]
class HGLibDeviceIntValueList(Structure): class HGLibDeviceIntValueList(Structure):
_pack_ = 4
_fields_ = [ ("value", POINTER(c_int)), _fields_ = [ ("value", POINTER(c_int)),
("count", c_uint)] ("count", c_uint)]
class HGLibDeviceEnumValueList(Structure): class HGLibDeviceEnumValueList(Structure):
_pack_ = 4
_fields_ = [ ("value", POINTER(c_uint)), _fields_ = [ ("value", POINTER(c_uint)),
("count", c_uint)] ("count", c_uint)]
class HGLibDeviceDoubleValueList(Structure): class HGLibDeviceDoubleValueList(Structure):
_pack_ = 4
_fields_ = [ ("value", POINTER(c_double)), _fields_ = [ ("value", POINTER(c_double)),
("count", c_uint)] ("count", c_uint)]
class HGLibDeviceIntValueRange(Structure): class HGLibDeviceIntValueRange(Structure):
_pack_ = 4
_fields_ = [ ("minValue", c_int), _fields_ = [ ("minValue", c_int),
("maxValue", c_int)] ("maxValue", c_int)]
class HGLibDeviceDoubleValueRange(Structure): class HGLibDeviceDoubleValueRange(Structure):
_pack_ = 4
_fields_ = [ ("minValue", c_double), _fields_ = [ ("minValue", c_double),
("maxValue", c_double)] ("maxValue", c_double)]
class HGLibDeviceParamType(Union): class HGLibDeviceParamType(Union):
_pack_ = 4
_fields_ = [ ("intValue", c_int), _fields_ = [ ("intValue", c_int),
("enumValue", c_uint), ("enumValue", c_uint),
("doubleValue", c_double), ("doubleValue", c_double),
("boolValue", c_int)] ("boolValue", c_int)]
class HGLibDeviceParamRangeType(Union): class HGLibDeviceParamRangeType(Union):
_pack_ = 4
_fields_ = [ ("intValueList", HGLibDeviceIntValueList), _fields_ = [ ("intValueList", HGLibDeviceIntValueList),
("enumValueList", HGLibDeviceEnumValueList), ("enumValueList", HGLibDeviceEnumValueList),
("doubleValueList", HGLibDeviceDoubleValueList), ("doubleValueList", HGLibDeviceDoubleValueList),
@ -47,6 +55,7 @@ class HGLibDeviceParamRangeType(Union):
("doubleValueRange", HGLibDeviceDoubleValueRange)] ("doubleValueRange", HGLibDeviceDoubleValueRange)]
class HGLibDeviceParam(Structure): class HGLibDeviceParam(Structure):
_pack_ = 4
_fields_ = [ ("option", c_uint), _fields_ = [ ("option", c_uint),
("type", c_uint), ("type", c_uint),
("typeValue", HGLibDeviceParamType), ("typeValue", HGLibDeviceParamType),
@ -54,6 +63,7 @@ class HGLibDeviceParam(Structure):
("rangeTypeValue", HGLibDeviceParamRangeType)] ("rangeTypeValue", HGLibDeviceParamRangeType)]
class HGLibDeviceParamGroup(Structure): class HGLibDeviceParamGroup(Structure):
_pack_ = 4
_fields_ = [ ("group", c_uint), _fields_ = [ ("group", c_uint),
("param", POINTER(HGLibDeviceParam)), ("param", POINTER(HGLibDeviceParam)),
("paramCount", c_uint)] ("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 HGLib_SaveImage.restype = ctypes.c_int
ImageParam = HGLibSaveImageParam() ImageParam = HGLibSaveImageParam()
ImageParam.size = 20 ImageParam.size = 20
ImageParam.jpegQuality = 100 ImageParam.jpegQuality = 80
ImageParam.tiffCompression = 0 ImageParam.tiffCompression = 4
ImageParam.tiffJpegQuality = 0 ImageParam.tiffJpegQuality = 80
ImageParam.ocr = 0 ImageParam.ocr = 0
Ret = HGLib_SaveImage(Image, c_char_p(b"2.jpg"), pointer(ImageParam)) Ret = HGLib_SaveImage(Image, c_char_p(b"2.jpg"), pointer(ImageParam))