解决websdk保存图片时dpi不正确的问题
This commit is contained in:
parent
acb353df9f
commit
fcd1fd0448
|
@ -70,6 +70,7 @@ namespace ver_2
|
|||
m_scanTemp = false;
|
||||
m_scanning = false;
|
||||
m_scanEvent = NULL;
|
||||
m_dpi = 200;
|
||||
|
||||
HGChar cfgPath[256];
|
||||
HGBase_GetConfigPath(cfgPath, 256);
|
||||
|
@ -1493,6 +1494,7 @@ namespace ver_2
|
|||
m_scanTemp = temp;
|
||||
HGBase_CreateEvent(HGFALSE, HGFALSE, &m_scanEvent);
|
||||
assert(NULL != m_scanEvent);
|
||||
m_dpi = GetDpi();
|
||||
|
||||
SANE_Status status = sane_start(m_devHandle);
|
||||
if (SANE_STATUS_GOOD != status)
|
||||
|
@ -1502,6 +1504,7 @@ namespace ver_2
|
|||
m_scanEvent = NULL;
|
||||
m_scanBlankCheck = false;
|
||||
m_scanTemp = false;
|
||||
m_dpi = 200;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1530,6 +1533,7 @@ namespace ver_2
|
|||
m_scanBlankCheck = false;
|
||||
m_scanTemp = false;
|
||||
m_scanning = false;
|
||||
m_dpi = 200;
|
||||
|
||||
errInfo.clear();
|
||||
return 0;
|
||||
|
@ -4139,6 +4143,31 @@ namespace ver_2
|
|||
}
|
||||
}
|
||||
|
||||
HGUInt ManagerV2::GetDpi()
|
||||
{
|
||||
HGUInt dpi = 200;
|
||||
SANE_Int num_dev_options = 0;
|
||||
sane_control_option(m_devHandle, 0, SANE_ACTION_GET_VALUE, &num_dev_options, nullptr);
|
||||
for (int i = 1; i < num_dev_options; ++i)
|
||||
{
|
||||
const SANE_Option_Descriptor* desp = sane_get_option_descriptor(m_devHandle, i);
|
||||
if (nullptr == desp)
|
||||
continue;
|
||||
|
||||
if (SANE_TYPE_INT == desp->type)
|
||||
{
|
||||
SANE_Int value = 0;
|
||||
sane_control_option(m_devHandle, i, SANE_ACTION_GET_VALUE, &value, nullptr);
|
||||
if (0 == strcmp(desp->name, SANE_STD_OPT_NAME_RESOLUTION))
|
||||
{
|
||||
dpi = (HGUInt)value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dpi;
|
||||
}
|
||||
|
||||
int ManagerV2::sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param)
|
||||
{
|
||||
(void)hdev;
|
||||
|
@ -4286,6 +4315,8 @@ namespace ver_2
|
|||
HGBase_CreateImageFromData(data, &imgInfo, NULL, 0, HGBASE_IMGORIGIN_TOP, &img);
|
||||
if (NULL != img)
|
||||
{
|
||||
HGBase_SetImageDpi(img, p->m_dpi, p->m_dpi);
|
||||
|
||||
HGBool blank = HGFALSE;
|
||||
if (p->m_scanBlankCheck)
|
||||
HGImgProc_ImageBlankCheck(img, NULL, &blank);
|
||||
|
|
|
@ -297,6 +297,7 @@ namespace ver_2
|
|||
void ExchangeBindFolderImage(const std::vector<BatchTableInfo>& tables, int imageIndex1, int imageIndex2);
|
||||
void ClearBindFolderImageList(const std::vector<BatchTableInfo>& tables);
|
||||
|
||||
HGUInt GetDpi();
|
||||
static int sane_ex_callback(SANE_Handle hdev, int code, void* data, unsigned int* len, void* param);
|
||||
static void HGAPI ThreadFunc(HGThread thread, HGPointer param);
|
||||
|
||||
|
@ -319,6 +320,7 @@ namespace ver_2
|
|||
bool m_scanTemp;
|
||||
bool m_scanning;
|
||||
HGEvent m_scanEvent;
|
||||
HGUInt m_dpi;
|
||||
|
||||
sqlite3* m_sqlite;
|
||||
std::string m_currBatchId;
|
||||
|
|
Loading…
Reference in New Issue