95 lines
2.9 KiB
C
95 lines
2.9 KiB
C
|
#ifndef CREATPRINTBMP_H
|
|||
|
#define CREATPRINTBMP_H
|
|||
|
|
|||
|
#include <QObject>
|
|||
|
#include <QPicture>
|
|||
|
#include <QPainter>
|
|||
|
#include <QPicture>
|
|||
|
#include <QDebug>
|
|||
|
#include <QFile>
|
|||
|
#include <QBitmap>
|
|||
|
#include <QThread>
|
|||
|
#include <QSettings>
|
|||
|
#include <QDir>
|
|||
|
#include "bwbmp.h"
|
|||
|
#include "machine/printinfo/mcfiles.h"
|
|||
|
#include "datafile/hpgl/importhpgl.h"
|
|||
|
|
|||
|
#define TYPE_FILE 0
|
|||
|
#define TYPE_IMAGE 1
|
|||
|
#define PIXMAPWIDTH 1200
|
|||
|
#define PENWIDTH 5
|
|||
|
|
|||
|
#define START 1
|
|||
|
#define PAUSE 0
|
|||
|
|
|||
|
#define PRINTDIR "print"
|
|||
|
#define PRINTMCDIR "mc"
|
|||
|
#define PRINTFILEDIR "file"
|
|||
|
|
|||
|
typedef struct
|
|||
|
{
|
|||
|
u32 blkIdx; // 当前位图块号(位图分块后的编号)
|
|||
|
u32 biWidth; // 本块位图有效宽度,以像素为单位
|
|||
|
u32 biHeight; // 本块位图有效高度,以像素为单位
|
|||
|
u32 begPosY; // 本块起始位置(像素单位)
|
|||
|
u32 endPosY; // 本块结束位置(像素单位)
|
|||
|
u8 compType; // 本块位图压缩类型, =0, 不压缩; =1, 按字节压缩;
|
|||
|
u8 compDir; // 本块位图压缩方向, =0, 从上到下; =1, 从下到上;(喷墨方向)
|
|||
|
}__attribute__ ((packed)) BmpDatInfo;
|
|||
|
|
|||
|
class CreatPrintBmp : public QObject
|
|||
|
{
|
|||
|
Q_OBJECT
|
|||
|
public:
|
|||
|
explicit CreatPrintBmp(QObject *parent = NULL);
|
|||
|
virtual ~CreatPrintBmp();
|
|||
|
|
|||
|
private:
|
|||
|
QPicture m_picture;//绘图路径-线段
|
|||
|
QString m_savePath;
|
|||
|
int m_workState;
|
|||
|
int m_beginPrintFileIdx;//开始打印文件索引
|
|||
|
int m_deleteFileIdx;//删除打印文件索引
|
|||
|
McPrintInfo *m_mcPrintInfo;//机器信息
|
|||
|
int m_fileBegIdx;
|
|||
|
int m_fileEndIdx;
|
|||
|
int m_curFileIdx;//当前生成数据的文件索引
|
|||
|
int m_curBmpBlockIdx;//当前生成数据的位图块数索引
|
|||
|
int m_conpressDir;//压缩方向
|
|||
|
QString m_printFileDir;//打印文件目录
|
|||
|
|
|||
|
int m_moveFileIdx;//上下移动打印文件索引
|
|||
|
s16 m_moveDir;//-1,上移 1,下移
|
|||
|
|
|||
|
private:
|
|||
|
int creatFileListMarker();//加载文件列表marker数据
|
|||
|
void creatMarkerDat(McFilesInfo &curFilesInfo, QString filePath, int fileIdx);//创建Marker数据
|
|||
|
QPicture getPicture(Marker marker,int penWidth = 1);
|
|||
|
|
|||
|
int creatFileListDatAndSend(int idx);//创建文件列表数据并发送
|
|||
|
int creatBmpBlockDatAndSend(int idx);//创建位图块数据并发送
|
|||
|
|
|||
|
public:
|
|||
|
void setPicture(QPicture pic);
|
|||
|
void setPicture(QBitmap bitmap);
|
|||
|
void setSavePath(QString path);
|
|||
|
QString getSavePath();
|
|||
|
void setMcPrintInfo(int fileIdx,McPrintInfo *printInfo);//设置机器信息
|
|||
|
void setDeleteFile(int fileIdx);//删除文件
|
|||
|
void setMoveFile(int fileIdx, int dir = -1);//上下移动文件
|
|||
|
|
|||
|
signals:
|
|||
|
void siCreatOneBmpFinished(int mcIdx,unsigned char *dat,int datSize);
|
|||
|
void siSendFileListDatToMc(int idx);
|
|||
|
void siSendDatToMc(QByteArray dat, BmpDatInfo bmpInfo);
|
|||
|
void siDeleteFileFinish();//删除文件完成
|
|||
|
|
|||
|
public slots:
|
|||
|
void slotCreatBmp();
|
|||
|
void slotCreatNextBmpBlockDat();//创建下一个位图块数据
|
|||
|
|
|||
|
};
|
|||
|
|
|||
|
#endif // CREATPRINTBMP_H
|