提交原始齿轮泵代码
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
//
|
||||
// U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize
|
||||
#include "dm200.h"
|
||||
|
||||
#include "QImage"
|
||||
#include "QDebug"
|
||||
|
||||
#define MAX_WIDTH_BYTE 48 // 384/8
|
||||
|
||||
char DataMatrixdDraw(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize);
|
||||
//char DataMatrixdDrawImg(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize,QImage *pImg);
|
||||
|
||||
void Draw_Matrix(unsigned char *buffer)
|
||||
{
|
||||
U16 sColumns, sRows;
|
||||
U08 *Grid;
|
||||
sColumns = sRows = 0;
|
||||
Grid = 0;
|
||||
sColumns = sRows = 0;
|
||||
short sizeType = 0;
|
||||
Grid = iec16022ecc200((short*)&sRows, (short*)&sColumns, buffer, &sizeType);
|
||||
DataMatrixdDraw(Grid,sRows,sColumns,2);
|
||||
}
|
||||
|
||||
char DataMatrixdDraw(U08 *OutBuff, U16 cRows, U16 cColumns, U08 MSize)
|
||||
{
|
||||
int Size=MSize;
|
||||
int w = cColumns*Size;
|
||||
int h = cRows*Size;
|
||||
//qDebug()<<w<<h<<Size;
|
||||
QImage QRImage(w,h,QImage::Format_ARGB32 );
|
||||
QImage *img;
|
||||
img = &QRImage;
|
||||
img->fill(0x00ffffff);
|
||||
/* data */
|
||||
int margin=0;
|
||||
U08 *p = OutBuff;
|
||||
int ypos=0;//margin * Size;
|
||||
int xpos=0;
|
||||
int x,y,xx,yy,bit;
|
||||
for(y=0; y<cRows; y++) {
|
||||
bit = 7;
|
||||
bit = 7 - (margin * Size % 8);
|
||||
xpos=margin * Size;
|
||||
for(x=0; x<cColumns; x++) {
|
||||
for(xx=0; xx<Size; xx++) {
|
||||
if((*p & 1) << bit){
|
||||
for(yy=0; yy<Size; yy++) {
|
||||
img->setPixel(xpos,h-1-(ypos+yy),0xff000000);
|
||||
}
|
||||
}
|
||||
xpos++;
|
||||
}
|
||||
p++;
|
||||
bit--;
|
||||
if(bit < 0) {
|
||||
//q++;
|
||||
bit = 7;
|
||||
}
|
||||
}
|
||||
ypos+=Size;
|
||||
}
|
||||
img->save("Myqr.bmp");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user