添加异常图片处理流程
This commit is contained in:
parent
8faee2ea33
commit
1ea5dda99a
|
@ -355,6 +355,8 @@ namespace callback
|
||||||
int (*apply_given_config)(const char* content, SANE_Handle device, LPSANEAPI api) = NULL; // 閹煎瓨姊婚弫銈夊箰閸パ呮毎é—<C3A9>汇劌瀚伴崢銈囩磾椤曞棛绀塩ontentæ¿žæˆžæŒ»å¦žä»‹å´¢éŠˆå›©ç£¾æ¤¤æ—‡å§¤å¨ˆå •æŸŸç’‡â€³æžŸç¼?
|
int (*apply_given_config)(const char* content, SANE_Handle device, LPSANEAPI api) = NULL; // 閹煎瓨姊婚弫銈夊箰閸パ呮毎é—<C3A9>汇劌瀚伴崢銈囩磾椤曞棛绀塩ontentæ¿žæˆžæŒ»å¦žä»‹å´¢éŠˆå›©ç£¾æ¤¤æ—‡å§¤å¨ˆå •æŸŸç’‡â€³æžŸç¼?
|
||||||
char* (*get_config_content)(const char* dev_name, const char* name) = NULL;
|
char* (*get_config_content)(const char* dev_name, const char* name) = NULL;
|
||||||
void (*twain_ui_free)(void* buf) = NULL;
|
void (*twain_ui_free)(void* buf) = NULL;
|
||||||
|
void (*pump_ui_message)(void* reserved) = NULL;
|
||||||
|
int (*abnormal_image)(SANE_Image* img) = NULL; // return SANE_Abnormal_Image_Treat
|
||||||
|
|
||||||
|
|
||||||
static int load_dll(const char* path_dll, HMODULE* dll)
|
static int load_dll(const char* path_dll, HMODULE* dll)
|
||||||
|
@ -428,6 +430,8 @@ namespace callback
|
||||||
GET_API(twain_ui_free);
|
GET_API(twain_ui_free);
|
||||||
GET_API(apply_given_config);
|
GET_API(apply_given_config);
|
||||||
GET_API(get_config_content);
|
GET_API(get_config_content);
|
||||||
|
GET_API(pump_ui_message);
|
||||||
|
GET_API(abnormal_image);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static void unint_ui(void)
|
static void unint_ui(void)
|
||||||
|
@ -443,6 +447,8 @@ namespace callback
|
||||||
twain_ui_free = NULL;
|
twain_ui_free = NULL;
|
||||||
apply_given_config = NULL;
|
apply_given_config = NULL;
|
||||||
get_config_content = NULL;
|
get_config_content = NULL;
|
||||||
|
pump_ui_message = NULL;
|
||||||
|
abnormal_image = NULL;
|
||||||
if (hui)
|
if (hui)
|
||||||
{
|
{
|
||||||
FreeLibrary(hui);
|
FreeLibrary(hui);
|
||||||
|
@ -3529,6 +3535,19 @@ int scanner::handle_device_event(int ev_code, void* data, unsigned int* len)
|
||||||
scanned_img* img = NULL;
|
scanned_img* img = NULL;
|
||||||
wchar_t name[40] = { 0 };
|
wchar_t name[40] = { 0 };
|
||||||
|
|
||||||
|
if (simg->flag.statu && callback::abnormal_image)
|
||||||
|
{
|
||||||
|
if (callback::abnormal_image(simg) == SANE_Abnormal_Image_Discard)
|
||||||
|
{
|
||||||
|
wchar_t info[128] = { 0 };
|
||||||
|
|
||||||
|
swprintf_s(info, _countof(info) - 1, L"Discard image %d for the status is: %d\r\n", simg->src_id, simg->flag.statu);
|
||||||
|
log_info(info, LOG_LEVEL_DEBUG_INFO);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
swprintf_s(name, _countof(name) - 1, L"img_%05u.bmp", ++img_ind_);
|
swprintf_s(name, _countof(name) - 1, L"img_%05u.bmp", ++img_ind_);
|
||||||
img = new scanned_img(handle_, simg->header, simg->data, simg->bytes, simg->flag.dpi, (tmp_path_ + name).c_str(), xfer_, &img_fmt_);
|
img = new scanned_img(handle_, simg->header, simg->data, simg->bytes, simg->flag.dpi, (tmp_path_ + name).c_str(), xfer_, &img_fmt_);
|
||||||
if (img->bytes() /*>= simg->bytes*/)
|
if (img->bytes() /*>= simg->bytes*/)
|
||||||
|
|
Loading…
Reference in New Issue