调整尺寸大小

This commit is contained in:
mo1027728827@qq.com 2022-05-04 16:57:05 +08:00
parent 2fe8fc4d51
commit e7db4bdf16
8 changed files with 41 additions and 31 deletions

View File

@ -23,15 +23,22 @@ namespace Device {
papersize.insert({ B4,SIZE{250,353} });
papersize.insert({ B5,SIZE{176,250} });
papersize.insert({ B6,SIZE{125,176} });
#ifdef G400
papersize.insert({ MaxSize,SIZE{297,420 * 1.5} });
#else
if(pid_ == 0x400)
papersize.insert({ MaxSize,SIZE{297,(long)(420 * 1.5)} });
else if(pid_ == 0x300)
papersize.insert({ MaxSize,SIZE{210,297 * 2} });
else
papersize.insert({ MaxSize,SIZE{297,420 * 2} });
#endif
papersize.insert({ USStatement,SIZE{297,long(420 * 1.5)} });
if(pid_ == 0x300)
papersize.insert({ USStatement,SIZE{210,(long)(297 * 1.5)} });
else
papersize.insert({ USStatement,SIZE{297,(long)(420 * 1.5)} });
papersize.insert({ USLetter,SIZE{216,279} });
papersize.insert({ USLegal,SIZE{216,356} });
papersize.insert({ USLedger,SIZE{279,432} });
papersize.insert({ USLedger,SIZE{216,559} });
papersize.insert({ None,SIZE{297,420} });
papersize.insert({ K8,SIZE{270,390} });
papersize.insert({ K16,SIZE{190,270} });

View File

@ -31,7 +31,7 @@ namespace Device {
class PaperSize
{
public:
PaperSize();
PaperSize(int pid);
~PaperSize();
private:
void InitPaperMap();
@ -40,6 +40,8 @@ namespace Device {
std::map<TwSS, SIZE> dpiDct_100;
std::map<TwSS, SIZE> dpiDct_400;
std::map<TwSS, SIZE> dpiDct_300;
int pid_;
public:
SIZE GetPaperSize(DWORD paperType, float dpi, int orentation);
};

View File

@ -572,7 +572,7 @@ void hg_scanner_200::image_process(std::shared_ptr<std::vector<char>>& buffer)
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"param.dpi :%d\r\n",param.dpi);
handle = hg_imgproc::init(&img_conf_,&param);
handle = hg_imgproc::init(&img_conf_,&param,pid_);
hg_imgproc::load_buffer(handle, buffer);
hg_imgproc::decode(handle,pid_);

View File

@ -636,7 +636,7 @@ void hg_scanner_239::image_process(std::shared_ptr<std::vector<char>>& buff)
// printf("param.double_side :%d\r\n",param.double_side);
// printf("param.dpi :%d\r\n",param.dpi);
handle = hg_imgproc::init(&img_conf_,&param);
handle = hg_imgproc::init(&img_conf_,&param,pid_);
err = hg_imgproc::load_buffer(handle, buff);
err = hg_imgproc::decode(handle,pid_);

View File

@ -179,7 +179,7 @@ enum hg_239_setting_item
hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io),pid_(pid)
hg_scanner_300::hg_scanner_300(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io),pid_(pid),papersize(pid)
{
string fw = get_firmware_version();
@ -527,7 +527,7 @@ void hg_scanner_300::image_process(std::shared_ptr<std::vector<char>>& buffer)
handle = hg_imgproc::init(&img_conf_,&param);
handle = hg_imgproc::init(&img_conf_,&param,pid_);
hg_imgproc::load_buffer(handle, buffer);
hg_imgproc::decode(handle,pid_);

View File

@ -180,7 +180,7 @@ enum hg_239_setting_item
hg_scanner_400::hg_scanner_400(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io),pid_(pid)
hg_scanner_400::hg_scanner_400(const char* dev_name,int pid, usb_io* io) : hg_scanner(G100Serial, dev_name, io),pid_(pid),papersize(pid)
{
string fw = get_firmware_version();
@ -528,7 +528,7 @@ void hg_scanner_400::image_process(std::shared_ptr<std::vector<char>>& buffer)
HG_VLOG_MINI_1(HG_LOG_LEVEL_DEBUG_INFO,"param.dpi :%d\r\n",param.dpi);
handle = hg_imgproc::init(&img_conf_,&param);
handle = hg_imgproc::init(&img_conf_,&param,pid_);
hg_imgproc::load_buffer(handle, buffer);
hg_imgproc::decode(handle,pid_);

View File

@ -42,6 +42,7 @@ namespace hg_imgproc
std::shared_ptr<std::string> raw_data_;
std::shared_ptr<vector<char>> buffer_;
std::vector<cv::Mat> mats_;
int pid_;
Device::PaperSize papersize_;
@ -66,7 +67,7 @@ namespace hg_imgproc
// construction
public:
imgproc(LPSCANCONF img_param,LPIMGPRCPARAM param) : img_conf_(*img_param),param_(*param)
imgproc(LPSCANCONF img_param,LPIMGPRCPARAM param,int pid) : img_conf_(*img_param),param_(*param),pid_(pid),papersize_(pid_)
{
my_path_ = hg_log::pe_path();
}
@ -755,9 +756,9 @@ namespace hg_imgproc
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// api ...
HIMGPRC init(LPSCANCONF parameter,LPIMGPRCPARAM param)
HIMGPRC init(LPSCANCONF parameter,LPIMGPRCPARAM param,int pid)
{
imgproc* obj = new imgproc(parameter,param);
imgproc* obj = new imgproc(parameter,param,pid);
return (HIMGPRC)obj;
}

View File

@ -158,7 +158,7 @@ namespace hg_imgproc
}IMGHEAD, *LPIMGHEAD;
HIMGPRC init(LPSCANCONF parameter,LPIMGPRCPARAM param);
HIMGPRC init(LPSCANCONF parameter,LPIMGPRCPARAM param,int pid);
int load_buffer(HIMGPRC himg,std::shared_ptr<std::vector<char>> buff);
int load_file(HIMGPRC himg, const char* path_file);