修改SANE_Gamma结构定义
This commit is contained in:
parent
a88d505c25
commit
5567a2a28c
|
@ -24,11 +24,14 @@ hg_scanner::hg_scanner(ScannerSerial serial
|
||||||
, notify_setting_result_(false), user_cancel_(false), cb_mem_(true), test_1_paper_(false)
|
, notify_setting_result_(false), user_cancel_(false), cb_mem_(true), test_1_paper_(false)
|
||||||
, setting_count_(0),img_type_(""), online_(false)
|
, setting_count_(0),img_type_(""), online_(false)
|
||||||
{
|
{
|
||||||
|
custom_gamma_val_ = new SANE_Gamma;
|
||||||
|
memset(custom_gamma_val_, 0, sizeof(SANE_Gamma));
|
||||||
|
|
||||||
paper_size_mm_.cx = 210;
|
paper_size_mm_.cx = 210;
|
||||||
paper_size_mm_.cy = 297;
|
paper_size_mm_.cy = 297;
|
||||||
custom_gamma_val_.pt_count_r = custom_gamma_val_.pt_count_g = custom_gamma_val_.pt_count_b = 0;
|
custom_gamma_val_->pt_count_r = custom_gamma_val_->pt_count_g = custom_gamma_val_->pt_count_b = 0;
|
||||||
for (int i = 0; i < ARRAY_SIZE(custom_gamma_val_.table); ++i)
|
for (int i = 0; i < ARRAY_SIZE(custom_gamma_val_->table); ++i)
|
||||||
custom_gamma_val_.table[i] = i & 0x0ff;
|
custom_gamma_val_->table[i] = i & 0x0ff;
|
||||||
|
|
||||||
HG_VLOG_MINI_2(HG_LOG_LEVEL_DEBUG_INFO, "%s(%s) constructed\n", name_.c_str(), hg_log::format_ptr(this).c_str());
|
HG_VLOG_MINI_2(HG_LOG_LEVEL_DEBUG_INFO, "%s(%s) constructed\n", name_.c_str(), hg_log::format_ptr(this).c_str());
|
||||||
image_prc_param_.value = 0;
|
image_prc_param_.value = 0;
|
||||||
|
@ -53,6 +56,7 @@ hg_scanner::~hg_scanner()
|
||||||
thread_usb_read_->join();
|
thread_usb_read_->join();
|
||||||
if (thread_img_handle_.get() && thread_img_handle_->joinable())
|
if (thread_img_handle_.get() && thread_img_handle_->joinable())
|
||||||
thread_img_handle_->join();
|
thread_img_handle_->join();
|
||||||
|
delete custom_gamma_val_;
|
||||||
|
|
||||||
name_.insert(0, "\350\256\276\345\244\207 “");
|
name_.insert(0, "\350\256\276\345\244\207 “");
|
||||||
name_ += "”\345\267\262\347\273\217\345\205\263\351\227\255\343\200\202";
|
name_ += "”\345\267\262\347\273\217\345\205\263\351\227\255\343\200\202";
|
||||||
|
@ -455,9 +459,9 @@ int hg_scanner::restore(int setting_no)
|
||||||
setting_jsn_.at(key).at("name").get_to(val);
|
setting_jsn_.at(key).at("name").get_to(val);
|
||||||
if (val == KNOWN_OPT_NAME_CUSTOM_GAMMA)
|
if (val == KNOWN_OPT_NAME_CUSTOM_GAMMA)
|
||||||
{
|
{
|
||||||
custom_gamma_val_.pt_count_r = custom_gamma_val_.pt_count_g = custom_gamma_val_.pt_count_b = 0;
|
custom_gamma_val_->pt_count_r = custom_gamma_val_->pt_count_g = custom_gamma_val_->pt_count_b = 0;
|
||||||
for (int i = 0; i < ARRAY_SIZE(custom_gamma_val_.table); ++i)
|
for (int i = 0; i < ARRAY_SIZE(custom_gamma_val_->table); ++i)
|
||||||
custom_gamma_val_.table[i] = i & 0x0ff;
|
custom_gamma_val_->table[i] = i & 0x0ff;
|
||||||
|
|
||||||
return HG_ERR_OK;
|
return HG_ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1357,7 +1361,7 @@ int hg_scanner::setting_custom_gamma_data(void* data)
|
||||||
{
|
{
|
||||||
SANE_Gamma* gamma = (SANE_Gamma*)data;
|
SANE_Gamma* gamma = (SANE_Gamma*)data;
|
||||||
|
|
||||||
memcpy(&custom_gamma_val_, gamma, sizeof(custom_gamma_val_));
|
memcpy(custom_gamma_val_, gamma, sizeof(*custom_gamma_val_));
|
||||||
|
|
||||||
return HG_ERR_OK;
|
return HG_ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1899,11 +1903,11 @@ int hg_scanner::get_setting(int setting_no, char* json_txt_buf, int* len)
|
||||||
{
|
{
|
||||||
name = "";
|
name = "";
|
||||||
add = 3 * 256;
|
add = 3 * 256;
|
||||||
sprintf(sn, "[%u", custom_gamma_val_.table[0]);
|
sprintf(sn, "[%u", custom_gamma_val_->table[0]);
|
||||||
name += sn;
|
name += sn;
|
||||||
for (int i = 1; i < add; ++i)
|
for (int i = 1; i < add; ++i)
|
||||||
{
|
{
|
||||||
sprintf(sn, ",%u", custom_gamma_val_.table[i]);
|
sprintf(sn, ",%u", custom_gamma_val_->table[i]);
|
||||||
name += sn;
|
name += sn;
|
||||||
}
|
}
|
||||||
name += "]";
|
name += "]";
|
||||||
|
@ -2188,7 +2192,7 @@ int hg_scanner::device_io_control(unsigned long code, void* data, unsigned* len)
|
||||||
{
|
{
|
||||||
SANE_Gamma* v = (SANE_Gamma*)data;
|
SANE_Gamma* v = (SANE_Gamma*)data;
|
||||||
|
|
||||||
memcpy(v, &custom_gamma_val_, sizeof(custom_gamma_val_));
|
memcpy(v, custom_gamma_val_, sizeof(*custom_gamma_val_));
|
||||||
|
|
||||||
return HG_ERR_OK;
|
return HG_ERR_OK;
|
||||||
}
|
}
|
||||||
|
@ -2196,7 +2200,7 @@ int hg_scanner::device_io_control(unsigned long code, void* data, unsigned* len)
|
||||||
{
|
{
|
||||||
SANE_Gamma* v = (SANE_Gamma*)data;
|
SANE_Gamma* v = (SANE_Gamma*)data;
|
||||||
|
|
||||||
memcpy(&custom_gamma_val_, v, sizeof(custom_gamma_val_));
|
memcpy(custom_gamma_val_, v, sizeof(*custom_gamma_val_));
|
||||||
|
|
||||||
return HG_ERR_OK;
|
return HG_ERR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -253,7 +253,7 @@ protected:
|
||||||
////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////
|
||||||
// 新增自定义伽玛曲线及扫描区域属性 - 2022-05-05
|
// 新增自定义伽玛曲线及扫描区域属性 - 2022-05-05
|
||||||
bool custom_gamma_; // 为true时,应用custom_gamma_val_阵列调整图像色彩;为false时,保持原来的处理方式
|
bool custom_gamma_; // 为true时,应用custom_gamma_val_阵列调整图像色彩;为false时,保持原来的处理方式
|
||||||
SANE_Gamma custom_gamma_val_; // 当为RGB或者彩色时,为三组256字节的数据;当为黑白或灰度时,只有一组256字节
|
SANE_Gamma *custom_gamma_val_; // 当为RGB或者彩色时,为三组256字节的数据;当为黑白或灰度时,只有一组256字节
|
||||||
bool custom_area_; // 是否启用自定义区域,为true时才使用下列4个数据;为false时保持原来的处理方式
|
bool custom_area_; // 是否启用自定义区域,为true时才使用下列4个数据;为false时保持原来的处理方式
|
||||||
double custom_area_lt_x_; // 自定义区域左上角x坐标
|
double custom_area_lt_x_; // 自定义区域左上角x坐标
|
||||||
double custom_area_lt_y_; // 自定义区域左上角y坐标
|
double custom_area_lt_y_; // 自定义区域左上角y坐标
|
||||||
|
|
Loading…
Reference in New Issue