win32配置界面不再维护:屏蔽GAMMA数据存取

This commit is contained in:
gb 2023-08-07 15:56:02 +08:00
parent caf88fadcc
commit ed5cfeb2be
1 changed files with 101 additions and 101 deletions

View File

@ -707,117 +707,117 @@ void dlg_gamma::get_gamma(SANE_Gamma* gamma)
{ {
gamma->apply_to_back = SANE_FALSE; gamma->apply_to_back = SANE_FALSE;
//if (cur_ == &rgb_gray_) //if (cur_ == &rgb_gray_)
{ //{
cur_ = &rgb_gray_; // cur_ = &rgb_gray_;
gamma->pt_count = (SANE_Byte)(cur_->points.size() - 2); // gamma->pt_count = (SANE_Byte)(cur_->points.size() - 2);
// gamma->pt_count_r = gamma->pt_count_g = gamma->pt_count_b = 0; //// gamma->pt_count_r = gamma->pt_count_g = gamma->pt_count_b = 0;
for (int i = 2; i < (int)cur_->points.size(); ++i) // 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].x = (SANE_Byte)cur_->points[i].x;
gamma->keypoint[i - 2].y = (SANE_Byte)cur_->points[i].y; // gamma->keypoint[i - 2].y = (SANE_Byte)cur_->points[i].y;
} // }
for (int i = 0; i < 256; ++i) // for (int i = 0; i < 256; ++i)
gamma->table[i] = calc_value(i); // gamma->table[i] = calc_value(i);
} //}
//else ////else
{ //{
// gamma->pt_count = 0; //// gamma->pt_count = 0;
cur_ = &red_; // cur_ = &red_;
gamma->pt_count_r = (SANE_Byte)(cur_->points.size() - 2); // gamma->pt_count_r = (SANE_Byte)(cur_->points.size() - 2);
for (int i = 2; i < (int)cur_->points.size(); ++i) // 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].x = (SANE_Byte)cur_->points[i].x;
gamma->keypoint_r[i - 2].y = (SANE_Byte)cur_->points[i].y; // gamma->keypoint_r[i - 2].y = (SANE_Byte)cur_->points[i].y;
} // }
for (int i = 0; i < 256; ++i) // for (int i = 0; i < 256; ++i)
gamma->table[i] = calc_value(i); // gamma->table[i] = calc_value(i);
cur_ = &green_; // cur_ = &green_;
gamma->pt_count_g = (SANE_Byte)(cur_->points.size() - 2); // gamma->pt_count_g = (SANE_Byte)(cur_->points.size() - 2);
for (int i = 2; i < (int)cur_->points.size(); ++i) // 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].x = (SANE_Byte)cur_->points[i].x;
gamma->keypoint_g[i - 2].y = (SANE_Byte)cur_->points[i].y; // gamma->keypoint_g[i - 2].y = (SANE_Byte)cur_->points[i].y;
} // }
for (int i = 0; i < 256; ++i) // for (int i = 0; i < 256; ++i)
gamma->table[256 + i] = calc_value(i); // gamma->table[256 + i] = calc_value(i);
cur_ = &blue_; // cur_ = &blue_;
gamma->pt_count_b = (SANE_Byte)(cur_->points.size() - 2); // gamma->pt_count_b = (SANE_Byte)(cur_->points.size() - 2);
for (int i = 2; i < (int)cur_->points.size(); ++i) // 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].x = (SANE_Byte)cur_->points[i].x;
gamma->keypoint_b[i - 2].y = (SANE_Byte)cur_->points[i].y; // gamma->keypoint_b[i - 2].y = (SANE_Byte)cur_->points[i].y;
} // }
for (int i = 0; i < 256; ++i) // for (int i = 0; i < 256; ++i)
gamma->table[512 + i] = calc_value(i); // gamma->table[512 + i] = calc_value(i);
} //}
} }
void dlg_gamma::set_gamma(const SANE_Gamma* gamma, bool gray) void dlg_gamma::set_gamma(const SANE_Gamma* gamma, bool gray)
{ {
int sel = 0; int sel = 0;
std::wstring text(L""); //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);
//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"); // 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]); //else
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_GRAY);
text = local_trans::lang_trans_between_hz936(CONST_STRING_BLUE); // SendMessageW(get_item(IDC_CHANNEL), CB_ADDSTRING, 0, (LPARAM)&text[0]);
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_; cur_ = &rgb_gray_;
sel = 0; sel = 0;
SendMessage(get_item(IDC_CHANNEL), CB_SETCURSEL, sel, 0); SendMessage(get_item(IDC_CHANNEL), CB_SETCURSEL, sel, 0);