mirror of http://192.168.1.51:8099/lmh188/twain3
314 lines
6.7 KiB
C++
314 lines
6.7 KiB
C++
#ifndef COMMON_H
|
|
#define COMMON_H
|
|
#include <string>
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
extern "C"{
|
|
#endif
|
|
|
|
typedef struct Scan_Param
|
|
{
|
|
int val;
|
|
} ScanParam;
|
|
|
|
typedef struct tagImageInfo
|
|
{
|
|
int Width;
|
|
int Height;
|
|
int bpp;
|
|
} ImageInfo;
|
|
|
|
typedef struct Scan_Rect {
|
|
int width;
|
|
int height;
|
|
int x;
|
|
int y;
|
|
}ScanRect;
|
|
|
|
/*********************************************************************************/
|
|
//基础参数
|
|
typedef enum tagColorMode {
|
|
BlackWhite,
|
|
Gray,
|
|
RGB
|
|
}ColorMode;
|
|
|
|
typedef enum tagMulti_Output {
|
|
Unused = -1,
|
|
All,
|
|
ColorGray,
|
|
ColorBw,
|
|
GrayBw
|
|
}MultiOutput;
|
|
|
|
typedef enum tagtwSS
|
|
{
|
|
None = 0,
|
|
A4Letter = 1,
|
|
A4 = 1,
|
|
B5Letter = 2,
|
|
JISB5 = 2,
|
|
B5 = 2,
|
|
USLetter = 3,
|
|
USLegal = 4,
|
|
A5 = 5,
|
|
B4 = 6,
|
|
ISOB4 = 6,
|
|
B6 = 7,
|
|
ISOB6 = 7,
|
|
USLedger = 9,
|
|
USExecutive = 10,
|
|
A3 = 11,
|
|
B3 = 12,
|
|
ISOB3 = 12,
|
|
A6 = 13,
|
|
C4 = 14,
|
|
C5 = 15,
|
|
C6 = 16,
|
|
_4A0 = 17,
|
|
_2A0 = 18,
|
|
A0 = 19,
|
|
A1 = 20,
|
|
A2 = 21,
|
|
A7 = 22,
|
|
A8 = 23,
|
|
A9 = 24,
|
|
A10 = 25,
|
|
ISOB0 = 26,
|
|
ISOB1 = 27,
|
|
ISOB2 = 28,
|
|
ISOB5 = 29,
|
|
ISOB7 = 30,
|
|
ISOB8 = 31,
|
|
ISOB9 = 32,
|
|
ISOB10 = 33,
|
|
JISB0 = 34,
|
|
JISB1 = 35,
|
|
JISB2 = 36,
|
|
JISB3 = 37,
|
|
JISB4 = 38,
|
|
JISB6 = 39,
|
|
JISB7 = 40,
|
|
JISB8 = 41,
|
|
JISB9 = 42,
|
|
JISB10 = 43,
|
|
C0 = 44,
|
|
C1 = 45,
|
|
C2 = 46,
|
|
C3 = 47,
|
|
C7 = 48,
|
|
C8 = 49,
|
|
C9 = 50,
|
|
C10 = 51,
|
|
USStatement = 52,
|
|
BusinessCard = 53,
|
|
MaxSize = 54
|
|
}TwSS;
|
|
|
|
typedef enum tagPaper_Align {
|
|
Rot0 = 0,
|
|
Rot270 = 3
|
|
}PaperAlign;
|
|
|
|
typedef struct tagCrop_Rect
|
|
{
|
|
int enable;
|
|
int x; /*****自定义裁切区域左上角x坐标*/
|
|
int y; /*****自定义裁切区域左上角y坐标*/
|
|
int width; /*****自定义裁切区域宽度*******/
|
|
int height; /*****自定义裁切区域高度*******/
|
|
}CropRect;
|
|
|
|
typedef struct tagScan_Side {
|
|
int duplex; /*0: both ; 1: front*/
|
|
int discardBlank; /*跳过空白页通用*/
|
|
int discardBlankVince; /*跳过空白页(发票)*/
|
|
int fold; /*对折*/
|
|
int switchFrontBack; /*互换正反面*/
|
|
}ScanSide;
|
|
|
|
typedef struct tagSkew_Detection {
|
|
int enable;
|
|
int level;
|
|
}SkewDetection;
|
|
|
|
typedef struct tagHhardware_Params
|
|
{
|
|
int capturepixtype;
|
|
int doubleFeedDetection;
|
|
int bindingDetection;
|
|
int sizeDetection;
|
|
SkewDetection skewDetection;
|
|
}HardwareCaps;
|
|
|
|
typedef struct tagCcustom_Gamma
|
|
{
|
|
int enable;
|
|
unsigned char table[768];
|
|
int tableLength;
|
|
};
|
|
|
|
typedef struct tagFill_Hole
|
|
{
|
|
int enable;
|
|
int ratio;/*1~50;*/
|
|
}FillHole;
|
|
|
|
typedef enum tagColor_Filter
|
|
{
|
|
FILTER_RED,
|
|
FILTER_GREEN,
|
|
FILTER_BLUE,
|
|
FILTER_NONE,
|
|
FILTER_ALL,
|
|
ENHANCE_RED,
|
|
ENHANCE_GREEN,
|
|
ENHANCE_BLUE
|
|
}ColorFilter;
|
|
|
|
typedef enum tagSharpen_Type
|
|
{
|
|
STNone,
|
|
Sharpen,
|
|
SharpenMore,
|
|
Blur,
|
|
BlurMore
|
|
}SharpenType;
|
|
|
|
typedef enum tagOrentation
|
|
{
|
|
ROTATE_NONE = 0,
|
|
ROTATE_90,
|
|
ROTATE_180,
|
|
ROTATE_270,
|
|
AUTOTEXT_DETECT = 4
|
|
}Orentation;
|
|
|
|
typedef struct tagjpegCompress {
|
|
int enable;
|
|
int ratio;
|
|
}JpegCompress;
|
|
|
|
typedef struct tagImage_Process
|
|
{
|
|
int autoCrop; /*自动裁剪尺寸*/
|
|
//亮度对比度伽马值
|
|
int brightness; /*1~255*/
|
|
int contrast; /*1~7*/
|
|
float gamma; /*0.1f~5.0f*/
|
|
tagCcustom_Gamma customGamma;
|
|
//图像处理
|
|
int fillBlackRect;
|
|
bool isfillcolor;
|
|
int autoDescrew;
|
|
int refuseInflow;/*防止渗透*/
|
|
FillHole fillHole;
|
|
ColorFilter filter;
|
|
int colorCorrection;/*色彩校正*/
|
|
int removeMorr; /*去除摩尔纹*/
|
|
int errorExtention; /*错误扩散*/
|
|
int nosieDetach;/*噪点优化*/
|
|
int textureRemove;/*除网纹*/
|
|
int indent;/*边缘缩进像素*/
|
|
int noise;/*降噪像素点*/
|
|
int AutoCrop_threshold;/*自动裁剪二值化阀值*/
|
|
bool is_convex;/*填充黑框方式*/
|
|
bool backgroundremoval;
|
|
bool automaticcolor;
|
|
int automaticcolortype;
|
|
SharpenType sharpenType;
|
|
int multiOutFilterRed;/*多流输出除红*/
|
|
int answerSheetFilterRed;/*答题卡除红*/
|
|
//送纸
|
|
Orentation orentation;
|
|
int backRotate180;
|
|
//其他
|
|
JpegCompress jpegCompress;
|
|
int splitImage;
|
|
}ImageProcess;
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
/*********************************************************************************/
|
|
class GScanCap
|
|
{
|
|
public:
|
|
ColorMode pixelType;
|
|
MultiOutput multiOutput;
|
|
TwSS paperSize;
|
|
PaperAlign paperAlign;
|
|
CropRect cropRect;
|
|
int resolution;
|
|
int resolution_native;
|
|
ScanSide scanSide;
|
|
ImageProcess imageProcess;
|
|
int scanCount; /* -1: 连续扫描 */
|
|
HardwareCaps hardwareParam;
|
|
int previewScan;
|
|
int threshold;
|
|
/*保存信息*/
|
|
std::string Caption;
|
|
std::string SavePath;
|
|
};
|
|
|
|
/******************
|
|
**参数保存结构体**
|
|
*******************/
|
|
typedef struct tagCONFIGPARAMS
|
|
{
|
|
/*基本选项卡参数*/
|
|
int Pixtype;
|
|
int PaperSize;
|
|
bool EnAutoCrop;
|
|
int Resolution;
|
|
bool EnDuplex;
|
|
bool EnDiscardBlank;
|
|
bool EnDiscardBlankVince;
|
|
int DBlank_AreaNum;
|
|
int DBlank_DevnMax;
|
|
bool EnFold;
|
|
bool EnExchangeFrontBack;
|
|
/*亮度对比度选项卡参数*/
|
|
float Brightness;
|
|
bool EnAutoContrast;
|
|
float Contrast;
|
|
float Gamma;
|
|
|
|
/*图像处理选项卡参数*/
|
|
int Filter;
|
|
int Sharpen;
|
|
bool EnFillBlack;
|
|
bool EnAutoDescrew;
|
|
bool EnOutHole;
|
|
int OutHoleRatio;
|
|
bool EnMultiOutPutR;
|
|
bool EnAnswerSheetR;
|
|
|
|
/*送纸部分选项卡参数*/
|
|
bool EnUltrasonicDetect;
|
|
bool EnBindingDetect;
|
|
int ScanCount;
|
|
int Orentation;
|
|
bool EnBackRotate180;
|
|
bool EnScrewDetect;
|
|
int ScrewDetectLevel;
|
|
|
|
/*保存信息*/
|
|
std::string Caption;
|
|
std::string SavePath;
|
|
}CONFIGPARAMS, * PCONFIGPARAMS;
|
|
|
|
typedef struct tagCONFIGINFO
|
|
{
|
|
std::string Caption;
|
|
std::string SavePath;
|
|
}CONFIGINFO, * PCONFIGINFO;
|
|
|
|
#endif
|