From ca2e83e14c36d414aef7964fb8dba8722c5b7b88 Mon Sep 17 00:00:00 2001 From: 13038267101 Date: Tue, 14 Jun 2022 17:02:19 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=83=A8=E5=88=86=E7=9A=84?= =?UTF-8?q?=E5=88=87=E6=8D=A2=E9=A2=9C=E8=89=B2=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hgdriver/hgdev/hg_scanner.cpp | 61 ++++++++++++++++++++++++++++--- hgdriver/hgdev/hg_scanner.h | 2 + hgdriver/hgdev/hg_scanner_239.cpp | 16 +++++++- hgdriver/hgdev/hg_scanner_239.h | 2 +- 4 files changed, 74 insertions(+), 7 deletions(-) diff --git a/hgdriver/hgdev/hg_scanner.cpp b/hgdriver/hgdev/hg_scanner.cpp index d4145b8..0efc944 100644 --- a/hgdriver/hgdev/hg_scanner.cpp +++ b/hgdriver/hgdev/hg_scanner.cpp @@ -857,6 +857,16 @@ void hg_scanner::reset_custom_area_range(int paper) } } +int hg_scanner::set_color_change(void) +{ + // if (/* condition */) + // { + // /* code */ + // } + + return SCANNER_ERR_OK; +} + int hg_scanner::setting_restore(void* data) { // restore ... @@ -942,12 +952,18 @@ int hg_scanner::setting_multi_out(void *data) { is_multiout = *((bool*)data); int val = image_prc_param_.bits.color_mode; - + printf("val = %d\r\n",val); VLOG_MINI_1(LOG_LEVEL_DEBUG_INFO, "image_prc_param_.bits.multi_out %d ", image_prc_param_.bits.multi_out); - if (!is_multiout) - on_color_mode_changed(val); - + if (is_multiout) + { + if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW) + val = COLOR_MODE_256_GRAY; + else + val = COLOR_MODE_24_BITS; + } + on_color_mode_changed(val); + return SCANNER_ERR_OK; } int hg_scanner::setting_multi_out_type(void *data) @@ -1544,6 +1560,40 @@ int hg_scanner::setting_color_fill(void *data) } int hg_scanner::on_color_mode_changed(int& color_mode) { + int ret = SCANNER_ERR_OK; + if ((((color_mode == COLOR_MODE_24_BITS || color_mode == COLOR_MODE_AUTO_MATCH) && !is_color_type_) || + ((color_mode != COLOR_MODE_24_BITS && color_mode != COLOR_MODE_AUTO_MATCH) && is_color_type_)) && color_mode != -1) + { + is_color_type_ ^= 1; + } + if (image_prc_param_.bits.rid_color != RID_COLOR_NONE + &&(image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE) + ) + { + is_color_type_ = 1; + } + if(image_prc_param_.bits.rid_color != RID_COLOR_NONE + && (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE) + && color_mode == -1) + { + is_color_type_ = 1; + } + else if (image_prc_param_.bits.rid_color == RID_COLOR_NONE + && (image_prc_param_.bits.color_mode == COLOR_MODE_256_GRAY || image_prc_param_.bits.color_mode == COLOR_MODE_BLACK_WHITE) + && color_mode == -1) + { + is_color_type_ = 0; + } + if (is_multiout) + { + is_color_type_ = 1; + // if (/* condition */) + // { + // /* code */ + // } + + } + return SCANNER_ERR_OK; } int hg_scanner::on_paper_changed(int& paper) @@ -2607,4 +2657,5 @@ int hg_scanner::set_scan_with_hole(void) int hg_scanner::get_scan_is_sleep(void) { return SCANNER_ERR_DEVICE_NOT_SUPPORT; -} \ No newline at end of file +} + diff --git a/hgdriver/hgdev/hg_scanner.h b/hgdriver/hgdev/hg_scanner.h index eec73bb..2d58db9 100644 --- a/hgdriver/hgdev/hg_scanner.h +++ b/hgdriver/hgdev/hg_scanner.h @@ -102,6 +102,7 @@ class hg_scanner std::string name_; std::string save_multiout; //保存多留输出类型 bool save_sizecheck; + int is_color_type_;//保存最后下发到设备的颜色类型 sane_callback ui_ev_cb_; do_when_born_and_dead* scan_life_; @@ -125,6 +126,7 @@ class hg_scanner void working_done(void*); void reset_custom_area_range(int paper); + int set_color_change(void); // 设置接口 protected: diff --git a/hgdriver/hgdev/hg_scanner_239.cpp b/hgdriver/hgdev/hg_scanner_239.cpp index 26c253f..e2272c2 100644 --- a/hgdriver/hgdev/hg_scanner_239.cpp +++ b/hgdriver/hgdev/hg_scanner_239.cpp @@ -913,7 +913,7 @@ else ic.hsvcorrect = 0; ic.multi_output_red = 0; ic.multiOutput = MultiOutput::Unused; - ic.fadeback = false; + } //多留输出的处理 if (image_prc_param_.bits.multi_out == MULTI_GRAY_AND_BW && is_multiout) @@ -923,7 +923,21 @@ else else if ((image_prc_param_.bits.multi_out == MULTI_OUT_ALL ||image_prc_param_.bits.multi_out == MULTI_COLOR_AND_GRAY||image_prc_param_.bits.multi_out == MULTI_COLOR_AND_BW) && is_multiout) { ic.pixtype = 2; + } + if (is_multiout) + { + ic.hsvcorrect = 0; + ic.multi_output_red = 0; + ic.fadeback = false; + ic.sharpen = 0; + ic.removeMorr = 0; + ic.textureRemove = 0; + + ic.errorExtention = 0; + ic.detachnoise.is_detachnoise = 0; + } + //自定义裁切 if (image_prc_param_.bits.paper == PAPER_AUTO_MATCH ||image_prc_param_.bits.paper == PAPER_MAX_SIZE diff --git a/hgdriver/hgdev/hg_scanner_239.h b/hgdriver/hgdev/hg_scanner_239.h index c0fd3f6..12adf37 100644 --- a/hgdriver/hgdev/hg_scanner_239.h +++ b/hgdriver/hgdev/hg_scanner_239.h @@ -59,7 +59,7 @@ class hg_scanner_239 : public hg_scanner protected: virtual void init_setting_map(int* setting_map, int count) override; - virtual int on_color_mode_changed(int& color_mode) override; + int on_color_mode_changed(int& color_mode) override; virtual int on_paper_changed(int& paper) override; virtual int on_paper_check_changed(bool& check) override; virtual int on_resolution_changed(int& dpi) override;