twain3.0/huagao/Device/scn_config.cpp

62 lines
1.6 KiB
C++

#include "stdafx.h"
#include "scn_config.h"
#include "math.h"
hgConfigClass::hgConfigClass(GScanCap param)
{
m_param = { 0 };
PaperStatus ps = { param.papertype,param.paperAlign };
m_param.paper = ContainspaperTypesKey(ps) ? SupPaperTyps[ps] : 0;
if(param.filter!=3||param.enhance_color!=0||param.hsvcorrect)
m_param.color = 1;//color
else
{
m_param.color = ContainsPixTypeKey(param.pixtype) ? SupPixelTypes[param.pixtype] : 2;
}
m_param.dpi = ContainsResolutionKey(param.resolution_native) ? SupResolutions[param.resolution_native] : 1;
m_param.double_feed_enbale = (unsigned int)param.hardwarecaps.en_doublefeed;
m_param.stable_enbale =(unsigned int) param.hardwarecaps.en_stapledetect;
m_param.screw_detect_enable = (unsigned int)param.hardwarecaps.en_skrewdetect;
m_param.screw_detect_level = (unsigned int)m_param.screw_detect_enable ? secrewMaps[param.hardwarecaps.skrewdetectlevel] : 0;
#ifdef G200
m_param.pc_correct = 0;
#endif
m_param.lowpowermode = (byte)param.hardwarecaps.lowpowermode;
m_param.enable_sizecheck = param.en_sizecheck == 1 ? 1 : 0;
m_param.unused_one = m_param.sizeerror_errorratio = 0;
param.resolution_dst >= 240.0f ? 1 : 0;
}
bool hgConfigClass::ContainspaperTypesKey(PaperStatus key)
{
if (SupPaperTyps.count(key) > 0)
{
return true;
}
return false;
}
bool hgConfigClass::ContainsPixTypeKey(uint16_t key)
{
if (SupPixelTypes.count(key)>0)
{
return true;
}
return false;
}
bool hgConfigClass::ContainsResolutionKey(float key)
{
if ( SupResolutions.count(key)>0)
{
return true;
}
return false;
}
unsigned int hgConfigClass::GetData()
{
return m_param.value;
}