Open maikebing opened 6 years ago
I don't see any QR code generation in your example...
BOOL WriteBMP(char*text)
{
QRCode qrcode;
unsigned char buffer[1024];
int buffsize = qrcode_getBufferSize(3);
uint8_t *qrcodeBytes= malloc(buffsize);
bzero(qrcodeBytes, buffsize);
qrcode_initText(&qrcode, qrcodeBytes, 3, ECC_LOW, text);
HW_BIN2BMPStore(qrcodeBytes,(unsigned char*) &buffer);
PBITMAPINFO pinf = BuildBitmapInfo(1, qrcode.size, qrcode.size);
SaveDIB(pinf, (unsigned char*)&buffer,"/TEMP.BMP");
free(pinf);
free(qrcodeBytes);
return TRUE;
}
void HW_BIN2BMPStore( unsigned char * pbByteBinImage,unsigned char * buf)
{
//int iCX = 112;
int iCY = 20;
int i = 0;
for(; i<iCY; i++)
{
int j = 0;
//printf("%d\n",i);
for (; j<14; j++)
{
//printf("j=%d\n",j);
unsigned char t=1;
int n = 0;
for (; n<8; n++)
{
//printf("n=%d\n",n);
unsigned char d = pbByteBinImage[i*14+j] & t;
//printf("d=%d\n",d);
if (d)
{
buf[(iCY-1-i)*16+j] |= 1<<(7-n);
//printf("%d\n",buf[(iCY-1-i)*16+j]);
}
t *= 2;
}
}
}
}
I want to show some of the data to the QRcode picture file, can you write an example? With the pure C language, the code I wrote above always has a problem, and maybe I don't understand something.
I implemented saving a QR code as a BMP file using C language
I have some code!try save to a BMP! but can't scan! can you help me?