关闭扫描仪时先关闭界面;修复mem传送方式时,遗漏颜色通道参数设置的BUG(PS可调用)

This commit is contained in:
gb 2022-10-10 18:09:52 +08:00
parent 21bc854c3e
commit 426fc2d0ef
2 changed files with 26 additions and 7 deletions

View File

@ -613,6 +613,7 @@ int scanner::open(void)
} }
int scanner::close(void) int scanner::close(void)
{ {
ui_hide();
callback::unreg_callback(this); callback::unreg_callback(this);
if (handle_) if (handle_)
{ {

View File

@ -771,8 +771,8 @@ Result huagao_ds::eventProcess(const Identity&, Event& event)
case SANE_EVENT_UI_CLOSE_NORMAL: case SANE_EVENT_UI_CLOSE_NORMAL:
scanner_->ui_hide(); scanner_->ui_hide();
case SANE_EVENT_SCAN_FINISHED: case SANE_EVENT_SCAN_FINISHED:
notifyCloseOk(); //notifyCloseOk();
break; //break;
case SANE_EVENT_UI_CLOSE_SETTING: case SANE_EVENT_UI_CLOSE_SETTING:
notifyCloseCancel(); notifyCloseCancel();
break; break;
@ -897,10 +897,16 @@ Result huagao_ds::setupMemXferGet(const Identity& id, SetupMemXfer& data)
UserInterface ui(FALSE, FALSE, (Twpp::Handle)0); UserInterface ui(FALSE, FALSE, (Twpp::Handle)0);
data.setPreferredSize(1); data.setPreferredSize(1);
call(id, DataGroup::Control, Dat::UserInterface, Msg::DisableDs, &ui); call(id, DataGroup::Control, Dat::UserInterface, Msg::DisableDs, &ui);
return success();
} }
else else
return seqError(); {
int def_w = 2000,
def_h = 6000;
data.setMinSize(def_w * 3);
data.setPreferredSize(def_w * 3);
data.setMaxSize(def_w * 3 * def_h);
}
return success();
} }
if (scanner_->get_first_image_header(&head, &total)) if (scanner_->get_first_image_header(&head, &total))
@ -909,7 +915,7 @@ Result huagao_ds::setupMemXferGet(const Identity& id, SetupMemXfer& data)
{ {
int line_bytes = (head.bytes_per_line + 3) / 4 * 4; int line_bytes = (head.bytes_per_line + 3) / 4 * 4;
data.setMinSize(head.bytes_per_line); data.setMinSize(head.bytes_per_line);
data.setPreferredSize(line_bytes); data.setPreferredSize(line_bytes * head.lines);
data.setMaxSize(line_bytes * head.lines); data.setMaxSize(line_bytes * head.lines);
} }
else else
@ -988,12 +994,14 @@ Result huagao_ds::imageInfoGet(const Identity&, ImageInfo& data)
if (head.format == SANE_FRAME_RGB) if (head.format == SANE_FRAME_RGB)
{ {
data.setBitsPerPixel(head.depth * 3); data.setBitsPerPixel(head.depth * 3);
data.bitsPerSample()[0] = data.bitsPerSample()[1] = data.bitsPerSample()[2] = 8; data.setSamplesPerPixel(3);
data.bitsPerSample()[0] = data.bitsPerSample()[1] = data.bitsPerSample()[2] = head.depth;
} }
else else
{ {
data.setSamplesPerPixel(1);
data.setBitsPerPixel(head.depth); data.setBitsPerPixel(head.depth);
data.bitsPerSample()[0] = 8; data.bitsPerSample()[0] = head.depth;
} }
data.setHeight(head.lines); data.setHeight(head.lines);
if (m_compression == Compression::Group4) if (m_compression == Compression::Group4)
@ -1516,6 +1524,11 @@ void huagao_ds::init_support_caps(void)
if (Msg::Set == msg || Msg::Reset == msg) { if (Msg::Set == msg || Msg::Reset == msg) {
auto mech = data.currentItem<CapType::IBitDepth>(); auto mech = data.currentItem<CapType::IBitDepth>();
int ret = SCANNER_ERR_INVALID_PARAMETER; int ret = SCANNER_ERR_INVALID_PARAMETER;
{
wchar_t info[128] = { 0 };
swprintf_s(info, _countof(info) - 1, L"set CapType::IBitDepth = %d\r\n", mech);
load_sane_util::log_info(info, 0);
}
if (Msg::Set == msg) if (Msg::Set == msg)
{ {
if (mech == 1) if (mech == 1)
@ -1715,6 +1728,11 @@ void huagao_ds::init_support_caps(void)
{ {
if(Msg::Set == msg) if(Msg::Set == msg)
init = (int)data.currentItem<CapType::IPixelType>(); init = (int)data.currentItem<CapType::IPixelType>();
{
wchar_t info[128] = { 0 }, * des[] = { L"BlackWhite", L"Gray", L"Rgb" };
swprintf_s(info, _countof(info) - 1, L"set CapType::IPixelType = %s\r\n", des[(int)init]);
load_sane_util::log_info(info, 0);
}
int ret = SCANNER_ERR_OK; int ret = SCANNER_ERR_OK;
SET_SANE_OPT(ret, scanner_, ex_color_mode, &init); SET_SANE_OPT(ret, scanner_, ex_color_mode, &init);
data = Capability::createOneValue<CapType::IPixelType>((Twpp::PixelType)init); data = Capability::createOneValue<CapType::IPixelType>((Twpp::PixelType)init);