twain3/device/scn_config.cpp

66 lines
2.1 KiB
C++

#include "scn_config.h"
#include "math.h"
hgConfigClass::hgConfigClass(GScanCap& param)
{
PaperStatus ps = { param.paperSize,param.paperAlign };
m_param.paper = ContainspaperTypesKey(ps) ? SupPaperTyps[ps] : 0;
if ((param.imageProcess.filter != 3) || param.imageProcess.answerSheetFilterRed)
m_param.color = 1;//color
else
{
m_param.color = ContainsPixTypeKey(param.pixelType) ? SupPixelTypes[param.pixelType] : 2;
}
m_param.dpi = ContainsResolutionKey(param.resolution_native) ? SupResolutions[param.resolution_native] : 1;
m_param.double_feed_enbale = param.hardwareParam.doubleFeedDetection;
m_param.stable_enbale = param.hardwareParam.bindingDetection;
m_param.screw_detect_enable = param.hardwareParam.skewDetection.enable;
m_param.screw_detect_level = m_param.screw_detect_enable ? secrewMaps[param.hardwareParam.skewDetection.level] : 0;
m_param.pc_correct = 0;
m_param.unused_one = m_param.unused_two = 0;
// PaperStatus ps = { (unsigned int)param.papertype,(unsigned int)param.paperAlign };
//m_param.paper = ContainspaperTypesKey(ps) ? SupPaperTyps[ps] : 0;
//m_param.color = ContainsPixTypeKey(param.colorMode) ? SupPixelTypes[param.colorMode] : 2;
//m_param.dpi = 1;//ĬÈÏ 200dpi ContainsResolutionKey(param.resolution_native) ? SupResolutions[param.resolution_native] :
// m_param.double_feed_enbale = param.UltrasonicDetect;
// m_param.stable_enbale = param.BindingDetect;
// m_param.screw_detect_enable = param.ScrewDetect;
// m_param.screw_detect_level = m_param.screw_detect_enable? secrewMaps[param.ScrewTopLevel]:0;
//m_param.pc_correct = 0;
//m_param.unused_one = m_param.unused_two = 0;
}
unsigned int hgConfigClass::GetData()
{
return m_param.value;
}
bool hgConfigClass::ContainspaperTypesKey(PaperStatus key)
{
if (SupPaperTyps.count(key) > 0)
{
return true;
}
return false;
}
bool hgConfigClass::ContainsPixTypeKey(unsigned short key)
{
if (SupPixelTypes.count(key)>0)
{
return true;
}
return false;
}
bool hgConfigClass::ContainsResolutionKey(float key)
{
if ( SupResolutions.count(key)>0)
{
return true;
}
return false;
}