code_device/hgdriver/hgdev/PaperSize.h

48 lines
914 B
C
Raw Normal View History

2022-05-03 03:56:07 +00:00
#ifndef PAPER_SIZE_H
#define PAPER_SIZE_H
#include <map>
#if defined(WIN32) || defined(_WIN64)
2022-05-03 03:56:07 +00:00
#include <Windows.h>
#endif
#include "common_setting.h"
#ifdef __linux__
typedef CSSIZE Size;
typedef CSSIZE SIZE;
#endif
typedef struct Paper_Status {
unsigned int Paper;
unsigned int Orentate;
friend bool operator<(const struct Paper_Status& a, const struct Paper_Status& b) {
if (a.Paper < b.Paper ||
(a.Paper == b.Paper && a.Orentate < b.Orentate)) {
return true;
}
return false;
}
}PaperStatus;
namespace Device {
class PaperSize
{
public:
2022-05-04 08:57:05 +00:00
PaperSize(int pid);
2022-05-03 03:56:07 +00:00
private:
void InitPaperMap();
std::map<TwSS, SIZE> papersize;
std::map<std::pair<TwSS, float>, SIZE> dpiDct;
std::map<TwSS, SIZE> dpiDct_100;
std::map<TwSS, SIZE> dpiDct_400;
std::map<TwSS, SIZE> dpiDct_300;
2022-05-04 08:57:05 +00:00
int pid_;
2022-05-03 03:56:07 +00:00
public:
SIZE GetPaperSize(DWORD paperType, float dpi, int orentation);
};
}
#endif