From ed5cfeb2be4e09c34d4c9306427317f7415da81c Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Mon, 7 Aug 2023 15:56:02 +0800 Subject: [PATCH] =?UTF-8?q?win32=E9=85=8D=E7=BD=AE=E7=95=8C=E9=9D=A2?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E7=BB=B4=E6=8A=A4=EF=BC=9A=E5=B1=8F=E8=94=BD?= =?UTF-8?q?GAMMA=E6=95=B0=E6=8D=AE=E5=AD=98=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sane/DlgGamma.cpp | 202 +++++++++++++++++++++++----------------------- 1 file changed, 101 insertions(+), 101 deletions(-) diff --git a/sane/DlgGamma.cpp b/sane/DlgGamma.cpp index 6019e20..c40149a 100644 --- a/sane/DlgGamma.cpp +++ b/sane/DlgGamma.cpp @@ -707,117 +707,117 @@ void dlg_gamma::get_gamma(SANE_Gamma* gamma) { gamma->apply_to_back = SANE_FALSE; //if (cur_ == &rgb_gray_) - { - cur_ = &rgb_gray_; - gamma->pt_count = (SANE_Byte)(cur_->points.size() - 2); - // gamma->pt_count_r = gamma->pt_count_g = gamma->pt_count_b = 0; - for (int i = 2; i < (int)cur_->points.size(); ++i) - { - gamma->keypoint[i - 2].x = (SANE_Byte)cur_->points[i].x; - gamma->keypoint[i - 2].y = (SANE_Byte)cur_->points[i].y; - } + //{ + // cur_ = &rgb_gray_; + // gamma->pt_count = (SANE_Byte)(cur_->points.size() - 2); + //// gamma->pt_count_r = gamma->pt_count_g = gamma->pt_count_b = 0; + // for (int i = 2; i < (int)cur_->points.size(); ++i) + // { + // gamma->keypoint[i - 2].x = (SANE_Byte)cur_->points[i].x; + // gamma->keypoint[i - 2].y = (SANE_Byte)cur_->points[i].y; + // } - for (int i = 0; i < 256; ++i) - gamma->table[i] = calc_value(i); - } - //else - { - // gamma->pt_count = 0; + // for (int i = 0; i < 256; ++i) + // gamma->table[i] = calc_value(i); + //} + ////else + //{ + //// gamma->pt_count = 0; - cur_ = &red_; - gamma->pt_count_r = (SANE_Byte)(cur_->points.size() - 2); - for (int i = 2; i < (int)cur_->points.size(); ++i) - { - gamma->keypoint_r[i - 2].x = (SANE_Byte)cur_->points[i].x; - gamma->keypoint_r[i - 2].y = (SANE_Byte)cur_->points[i].y; - } - for (int i = 0; i < 256; ++i) - gamma->table[i] = calc_value(i); + // cur_ = &red_; + // gamma->pt_count_r = (SANE_Byte)(cur_->points.size() - 2); + // for (int i = 2; i < (int)cur_->points.size(); ++i) + // { + // gamma->keypoint_r[i - 2].x = (SANE_Byte)cur_->points[i].x; + // gamma->keypoint_r[i - 2].y = (SANE_Byte)cur_->points[i].y; + // } + // for (int i = 0; i < 256; ++i) + // gamma->table[i] = calc_value(i); - cur_ = &green_; - gamma->pt_count_g = (SANE_Byte)(cur_->points.size() - 2); - for (int i = 2; i < (int)cur_->points.size(); ++i) - { - gamma->keypoint_g[i - 2].x = (SANE_Byte)cur_->points[i].x; - gamma->keypoint_g[i - 2].y = (SANE_Byte)cur_->points[i].y; - } - for (int i = 0; i < 256; ++i) - gamma->table[256 + i] = calc_value(i); + // cur_ = &green_; + // gamma->pt_count_g = (SANE_Byte)(cur_->points.size() - 2); + // for (int i = 2; i < (int)cur_->points.size(); ++i) + // { + // gamma->keypoint_g[i - 2].x = (SANE_Byte)cur_->points[i].x; + // gamma->keypoint_g[i - 2].y = (SANE_Byte)cur_->points[i].y; + // } + // for (int i = 0; i < 256; ++i) + // gamma->table[256 + i] = calc_value(i); - cur_ = &blue_; - gamma->pt_count_b = (SANE_Byte)(cur_->points.size() - 2); - for (int i = 2; i < (int)cur_->points.size(); ++i) - { - gamma->keypoint_b[i - 2].x = (SANE_Byte)cur_->points[i].x; - gamma->keypoint_b[i - 2].y = (SANE_Byte)cur_->points[i].y; - } - for (int i = 0; i < 256; ++i) - gamma->table[512 + i] = calc_value(i); - } + // cur_ = &blue_; + // gamma->pt_count_b = (SANE_Byte)(cur_->points.size() - 2); + // for (int i = 2; i < (int)cur_->points.size(); ++i) + // { + // gamma->keypoint_b[i - 2].x = (SANE_Byte)cur_->points[i].x; + // gamma->keypoint_b[i - 2].y = (SANE_Byte)cur_->points[i].y; + // } + // for (int i = 0; i < 256; ++i) + // gamma->table[512 + i] = calc_value(i); + //} } void dlg_gamma::set_gamma(const SANE_Gamma* gamma, bool gray) { int sel = 0; - std::wstring text(L""); - - SendMessage(get_item(IDC_CHANNEL), CB_RESETCONTENT, 0, 0); - is_color_ = !gray; - cur_ = &rgb_gray_; - init_curve(cur_); - for (int i = 0; i < gamma->pt_count; ++i) - { - POINT pt = { gamma->keypoint[i].x, gamma->keypoint[i].y }; - cur_->points.push_back(pt); - } - cur_->coefs = calc::coefs_from_points(cur_->points); - if (is_color_) - { - SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)L"RGB"); - } - else - { - text = local_trans::lang_trans_between_hz936(CONST_STRING_GRAY); - SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)&text[0]); - } - - if(!gray) - { - is_color_ = true; - cur_ = &red_; - init_curve(cur_); - for (int i = 0; i < gamma->pt_count_r; ++i) - { - POINT pt = { gamma->keypoint_r[i].x, gamma->keypoint_r[i].y }; - cur_->points.push_back(pt); - } - cur_->coefs = calc::coefs_from_points(cur_->points); - - cur_ = &green_; - init_curve(cur_); - for (int i = 0; i < gamma->pt_count_g; ++i) - { - POINT pt = { gamma->keypoint_g[i].x, gamma->keypoint_g[i].y }; - cur_->points.push_back(pt); - } - cur_->coefs = calc::coefs_from_points(cur_->points); - - cur_ = &blue_; - init_curve(cur_); - for (int i = 0; i < gamma->pt_count_b; ++i) - { - POINT pt = { gamma->keypoint_b[i].x, gamma->keypoint_b[i].y }; - cur_->points.push_back(pt); - } - cur_->coefs = calc::coefs_from_points(cur_->points); + //std::wstring text(L""); + //SendMessage(get_item(IDC_CHANNEL), CB_RESETCONTENT, 0, 0); + //is_color_ = !gray; + //cur_ = &rgb_gray_; + //init_curve(cur_); + //for (int i = 0; i < gamma->pt_count; ++i) + //{ + // POINT pt = { gamma->keypoint[i].x, gamma->keypoint[i].y }; + // cur_->points.push_back(pt); + //} + //cur_->coefs = calc::coefs_from_points(cur_->points); + //if (is_color_) + //{ // SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)L"RGB"); - text = local_trans::lang_trans_between_hz936(CONST_STRING_RED); - SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)&text[0]); - text = local_trans::lang_trans_between_hz936(CONST_STRING_GREEN); - SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)&text[0]); - text = local_trans::lang_trans_between_hz936(CONST_STRING_BLUE); - SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)&text[0]); - } + //} + //else + //{ + // text = local_trans::lang_trans_between_hz936(CONST_STRING_GRAY); + // SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)&text[0]); + //} + + //if(!gray) + //{ + // is_color_ = true; + // cur_ = &red_; + // init_curve(cur_); + // for (int i = 0; i < gamma->pt_count_r; ++i) + // { + // POINT pt = { gamma->keypoint_r[i].x, gamma->keypoint_r[i].y }; + // cur_->points.push_back(pt); + // } + // cur_->coefs = calc::coefs_from_points(cur_->points); + + // cur_ = &green_; + // init_curve(cur_); + // for (int i = 0; i < gamma->pt_count_g; ++i) + // { + // POINT pt = { gamma->keypoint_g[i].x, gamma->keypoint_g[i].y }; + // cur_->points.push_back(pt); + // } + // cur_->coefs = calc::coefs_from_points(cur_->points); + + // cur_ = &blue_; + // init_curve(cur_); + // for (int i = 0; i < gamma->pt_count_b; ++i) + // { + // POINT pt = { gamma->keypoint_b[i].x, gamma->keypoint_b[i].y }; + // cur_->points.push_back(pt); + // } + // cur_->coefs = calc::coefs_from_points(cur_->points); + + //// SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)L"RGB"); + // text = local_trans::lang_trans_between_hz936(CONST_STRING_RED); + // SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)&text[0]); + // text = local_trans::lang_trans_between_hz936(CONST_STRING_GREEN); + // SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)&text[0]); + // text = local_trans::lang_trans_between_hz936(CONST_STRING_BLUE); + // SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)&text[0]); + //} cur_ = &rgb_gray_; sel = 0; SendMessage(get_item(IDC_CHANNEL), CB_SETCURSEL, sel, 0);