久久久久久久999_99精品久久精品一区二区爱城_成人欧美一区二区三区在线播放_国产精品日本一区二区不卡视频_国产午夜视频_欧美精品在线观看免费
標題:
QrcodeVC二維碼生成VC源代碼
[打印本頁]
作者:
jin510
時間:
2016-4-9 21:44
標題:
QrcodeVC二維碼生成VC源代碼
QrcodeVC二維碼生成VC源代碼.rar
(1014.98 KB, 下載次數: 79)
2016-4-9 21:43 上傳
點擊文件名下載附件
下載積分: 黑幣 -5
部分程序預覽:
// Qrcode.cpp: implementation of the Qrcode class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "QrcodeApp.h"
#include "Qrcode.h"
#include <math.h>
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
#define QRCODE_DATA_PATH "qrcode_data"
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
Qrcode::Qrcode()
{
qrcodeErrorCorrect = 'M';
qrcodeEncodeMode = 'B';
qrcodeVersion = 0;
qrcodeStructureappendN = 0;
qrcodeStructureappendM = 0;
qrcodeStructureappendParity = 0;
qrcodeStructureappendOriginaldata = "";
}
Qrcode::~Qrcode()
{
}
void Qrcode::setQrcodeErrorCorrect(char c)
{
qrcodeErrorCorrect = c;
}
char Qrcode::getQrcodeErrorCorrect()
{
return qrcodeErrorCorrect;
}
int Qrcode::getQrcodeVersion()
{
return qrcodeVersion;
}
void Qrcode::setQrcodeVersion(int i)
{
if(i >= 0 && i <= 40)
qrcodeVersion = i;
}
void Qrcode::setQrcodeEncodeMode(char c)
{
qrcodeEncodeMode = c;
}
char Qrcode::getQrcodeEncodeMode()
{
return qrcodeEncodeMode;
}
void Qrcode::setStructureappend(int i, int j, int k)
{
if(j > 1 && j <= 16 && i > 0 && i <= 16 && k >= 0 && k <= 255)
{
qrcodeStructureappendM = i;
qrcodeStructureappendN = j;
qrcodeStructureappendParity = k;
}
}
//int Qrcode::calStructureappendParity(char abyte0[],int i)
int Qrcode::calStructureappendParity(char* abyte0,int i)
{
int j = 0;
int k = 0;
//int i = abyte0.length;
if(i > 1)
{
k = 0;
for(; j < i; j++)
k ^= abyte0[j] & 255;
} else
{
k = -1;
}
return k;
}
//bool** Qrcode::calQrcode(char abyte0[],int iLen0,int& iLenRet)
bool** Qrcode::calQrcode(char* abyte0,int iLen0,int& iLenRet)
{
int j = 0;
int n1;
int i = iLen0;
//int ai[] = new int[i + 32];
int* ai = new int[i + 32];
//char abyte1[] = new char[i + 32];
char* abyte1 = new char[i + 32];
memset(abyte1,0,i+32);
if(i <= 0)
{
bool** aflag=new bool*[1];
aflag[0]=new bool[1];
aflag[0][0]=false;
iLenRet=1;
return aflag;
}
if(qrcodeStructureappendN > 1)
{
ai[0] = 3;
abyte1[0] = 4;
ai[1] = qrcodeStructureappendM - 1;
abyte1[1] = 4;
ai[2] = qrcodeStructureappendN - 1;
abyte1[2] = 4;
ai[3] = qrcodeStructureappendParity;
abyte1[3] = 8;
j = 4;
}
abyte1[j] = 4;
//int* ai1=new int[41];
int ai1[41];
int k;
switch(qrcodeEncodeMode)
{
case 65: // 'A'
/*ai1 = (new int[] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4
});*/
{
for(int ii=0;ii<41;ii++)
{
if(ii<=9)ai1[ii]=0;
else if(ii<=26)ai1[ii]=2;
else ai1[ii]=4;
}
ai[j] = 2;
j++;
ai[j] = i;
abyte1[j] = 9;
k = j;
j++;
for(int l = 0; l < i; l++)
{
char c = (char)abyte0[l];
char byte0 = 0;
if(c >= '0' && c < ':')
byte0 = (char)(c - 48);
else
if(c >= 'A' && c < '[')
{
byte0 = (char)(c - 55);
} else
{
if(c == ' ')
byte0 = 36;
if(c == '
)
byte0 = 37;
if(c == '%')
byte0 = 38;
if(c == '*')
byte0 = 39;
if(c == '+')
byte0 = 40;
if(c == '-')
byte0 = 41;
if(c == '.')
byte0 = 42;
if(c == '/')
byte0 = 43;
if(c == ':')
byte0 = 44;
}
if(l % 2 == 0)
{
ai[j] = byte0;
abyte1[j] = 6;
} else
{
ai[j] = ai[j] * 45 + byte0;
abyte1[j] = 11;
if(l < i - 1)
j++;
}
}
j++;
}
break;
case 78: // 'N'
/*ai1 = (new int[] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4
});*/
{
for(int ii=0;ii<41;ii++)
{
if(ii<=9)ai1[ii]=0;
else if(ii<=26)ai1[ii]=2;
else ai1[ii]=4;
}
ai[j] = 1;
j++;
ai[j] = i;
abyte1[j] = 10;
k = j;
j++;
for(int i1 = 0; i1 < i; i1++)
if(i1 % 3 == 0)
{
ai[j] = abyte0[i1] - 48;
abyte1[j] = 4;
} else
{
ai[j] = ai[j] * 10 + (abyte0[i1] - 48);
if(i1 % 3 == 1)
{
abyte1[j] = 7;
} else
{
abyte1[j] = 10;
if(i1 < i - 1)
j++;
}
}
j++;
}
break;
default:
/*ai1 = (new int[] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
8
});*/
for(int ii=0;ii<41;ii++)
{
if(ii<=9)ai1[ii]=0;
else ai1[ii]=8;
}
ai[j] = 4;
j++;
ai[j] = i;
abyte1[j] = 8;
k = j;
j++;
for(int j1 = 0; j1 < i; j1++)
{
ai[j1 + j] = abyte0[j1] & 255;
abyte1[j1 + j] = 8;
}
j += i;
break;
}
int k1 = 0;
for(int l1 = 0; l1 < j; l1++)
k1 += abyte1[l1];
char byte1;
switch(qrcodeErrorCorrect)
{
case 76: // 'L'
byte1 = 1;
break;
case 81: // 'Q'
byte1 = 3;
break;
case 72: // 'H'
byte1 = 2;
break;
default:
byte1 = 0;
break;
}
//int ai2[4][41] = {
int ai2[4][41] = {
{
0, 128, 224, 352, 512, 688, 864, 992, 1232, 1456,
1728, 2032, 2320, 2672, 2920, 3320, 3624, 4056, 4504, 5016,
5352, 5712, 6256, 6880, 7312, 8000, 8496, 9024, 9544, 10136,
10984, 11640, 12328, 13048, 13800, 14496, 15312, 15936, 16816, 17728,
18672
},
{
0, 152, 272, 440, 640, 864, 1088, 1248, 1552, 1856,
2192, 2592, 2960, 3424, 3688, 4184, 4712, 5176, 5768, 6360,
6888, 7456, 8048, 8752, 9392, 10208, 10960, 11744, 12248, 13048,
13880, 14744, 15640, 16568, 17528, 18448, 19472, 20528, 21616, 22496,
23648
},
{
0, 72, 128, 208, 288, 368, 480, 528, 688, 800,
976, 1120, 1264, 1440, 1576, 1784, 2024, 2264, 2504, 2728,
3080, 3248, 3536, 3712, 4112, 4304, 4768, 5024, 5288, 5608,
5960, 6344, 6760, 7208, 7688, 7888, 8432, 8768, 9136, 9776,
10208
},
{
0, 104, 176, 272, 384, 496, 608, 704, 880, 1056,
1232, 1440, 1648, 1952, 2088, 2360, 2600, 2936, 3176, 3560,
3880, 4096, 4544, 4912, 5312, 5744, 6032, 6464, 6968, 7288,
7880, 8264, 8920, 9368, 9848, 10288, 10832, 11408, 12016, 12656,
13328
}
};
int i2 = 0;
if(qrcodeVersion == 0)
{
qrcodeVersion = 1;
for(int j2 = 1; j2 <= 40; j2++)
{
if(ai2[byte1][j2] >= k1 + ai1[qrcodeVersion])
{
i2 = ai2[byte1][j2];
break;
}
qrcodeVersion++;
}
} else
{
i2 = ai2[byte1][qrcodeVersion];
}
k1 += ai1[qrcodeVersion];
abyte1[k] += ai1[qrcodeVersion];
int ai3[] = {
0, 26, 44, 70, 100, 134, 172, 196, 242, 292,
346, 404, 466, 532, 581, 655, 733, 815, 901, 991,
1085, 1156, 1258, 1364, 1474, 1588, 1706, 1828, 1921, 2051,
2185, 2323, 2465, 2611, 2761, 2876, 3034, 3196, 3362, 3532,
3706
};
int k2 = ai3[qrcodeVersion];
int l2 = 17 + (qrcodeVersion << 2);
int ai4[] = {
0, 0, 7, 7, 7, 7, 7, 0, 0, 0,
0, 0, 0, 0, 3, 3, 3, 3, 3, 3,
3, 4, 4, 4, 4, 4, 4, 4, 3, 3,
3, 3, 3, 3, 3, 0, 0, 0, 0, 0,
0
};
int i3 = ai4[qrcodeVersion] + (k2 << 3);
char* abyte2 = new char[i3];
char* abyte3 = new char[i3];
char* abyte4 = new char[i3];
char abyte5[15];
char abyte6[15];
char abyte7[1];
char abyte8[128];
memset(abyte2,0,i3);
memset(abyte3,0,i3);
memset(abyte4,0,i3);
memset(abyte5,0,15);
memset(abyte6,0,15);
memset(abyte7,0,1);
memset(abyte8,0,128);
try
{
//CString s = "qrcode_data/qrv" + Integer.toString(qrcodeVersion) + "_" + Integer.toString(byte1) + ".dat";
CString s;
s.Format("qrcode_data/qrv%d_%d.dat",qrcodeVersion,byte1);
//CFile f(s, CFile::modeCreate | CFile::modeWrite );
CFile f(s, CFile::modeRead);
try
{
f.Read(abyte2, i3);
f.Read(abyte3, i3);
f.Read(abyte4, i3);
f.Read(abyte5, 15);
f.Read(abyte6, 15);
f.Read(abyte7, 1);
f.Read(abyte8, 128);
f.Close();
}
catch(...)
{
f.Close();
}
//寫臨時文件
/*InputStream inputstream = (com.swetake.util.Qrcode.class).getResourceAsStream(s);
BufferedInputStream bufferedinputstream = new BufferedInputStream(inputstream);
bufferedinputstream.read(abyte2);
bufferedinputstream.read(abyte3);
bufferedinputstream.read(abyte4);
bufferedinputstream.read(abyte5);
bufferedinputstream.read(abyte6);
bufferedinputstream.read(abyte7);
bufferedinputstream.read(abyte8);
bufferedinputstream.close();
inputstream.close();*/
}
catch(CException exception)
{
//AfxMessageBox(exception.)
//exception.printStackTrace();
}
int j3 = 1;
for(char byte2 = 1; byte2 < 128; byte2++)
{
if(abyte8[byte2] != 0)
continue;
j3 = byte2;
break;
}
char* abyte9 = new char[j3+1];
memset(abyte9,0,j3);
memcpy(abyte9,abyte8,j3);
abyte9[j3]=0;
//System.arraycopy(abyte8, 0, abyte9, 0, j3);
char abyte10[15] = {
0, 1, 2, 3, 4, 5, 7, 8, 8, 8,
8, 8, 8, 8, 8
};
char abyte11[15] = {
8, 8, 8, 8, 8, 8, 8, 8, 7, 5,
4, 3, 2, 1, 0
};
int k3 = i2 >> 3;
int l3 = 4 * qrcodeVersion + 17;
int i4 = l3 * l3;
char* abyte12 = new char[i4 + l3];
memset(abyte12,0,i4 + l3);
try
{
//CString s1 = "qrcode_data/qrvfr" + Integer.toString(qrcodeVersion) + ".dat";
CString s1;
s1.Format("qrcode_data/qrvfr%d.dat",qrcodeVersion);
//CFile f1(s1, CFile::modeCreate | CFile::modeWrite );
CFile f1(s1, CFile::modeRead);
try
{
f1.Read(abyte12, i4 + l3);
f1.Close();
}
catch(...)
{
f1.Close();
}
}
catch(CException exception1)
{
// exception1.printStackTrace();
}
if(k1 <= i2 - 4)
{
ai[j] = 0;
abyte1[j] = 4;
} else
if(k1 < i2)
{
ai[j] = 0;
abyte1[j] = (char)(i2 - k1);
} else
if(k1 > i2)
TRACE("overflow");
//AfxMessageBox()
// System.out.println("overflow");
int iLret1=0;
char* abyte13 = divideDataBy8Bits(ai, abyte1, k3,i + 32,iLret1);
char* abyte14 = calculateRSECC(abyte13, abyte7[0], abyte9, k3, k2,iLret1,j3);
char** abyte15=new char*[l3];
for( n1 = 0; n1 <l3; n1++)
{
//abyte15[n1] = new char[l3];
abyte15[n1] = new char[l3];
}
for(int j4 = 0; j4 < l3; j4++)
{
for(int k4 = 0; k4 < l3; k4++)
abyte15[k4][j4] = 0;
}
for(int l4 = 0; l4 < k2; l4++)
{
char byte3 = abyte14[l4];
for(int j5 = 7; j5 >= 0; j5--)
{
int l5 = l4 * 8 + j5;
//if((abyte2[l5]==0)&&(abyte3[l5]==34)) AfxMessageBox("1");
abyte15[abyte2[l5] & 255][abyte3[l5] & 255] = (char)(255 * (byte3 & 1) ^ abyte4[l5]);
//byte3 = (char)((byte3 & 255) >>> 1);
byte3 = (char)((byte3 & 255) >> 1);
//byte3 = (char)((unsigned char)((byte3 & 255) >> 1));
}
}
/*for( j4 = 0; j4 < l3; j4++)
{
TestMsg(abyte15[j4],l3);
}*/
for(int i5 = ai4[qrcodeVersion]; i5 > 0; i5--)
{
int k5 = (i5 + k2 * 8) - 1;
abyte15[abyte2[k5] & 255][abyte3[k5] & 255] = (char)(255 ^ abyte4[k5]);
}
char byte4 = selectMask((char**)abyte15, ai4[qrcodeVersion] + k2 * 8,l3);
char byte5 = (char)(1 << byte4);
char byte6 = (char)(byte1 << 3 | byte4);
CString as[32] = {
"101010000010010", "101000100100101", "101111001111100", "101101101001011", "100010111111001", "100000011001110", "100111110010111", "100101010100000", "111011111000100", "111001011110011",
"111110110101010", "111100010011101", "110011000101111", "110001100011000", "110110001000001", "110100101110110", "001011010001001", "001001110111110", "001110011100111", "001100111010000",
"000011101100010", "000001001010101", "000110100001100", "000100000111011", "011010101011111", "011000001101000", "011111100110001", "011101000000110", "010010010110100", "010000110000011",
"010111011011010", "010101111101101"
};
for(int i6 = 0; i6 < 15; i6++)
{
char byte7=as[byte6][i6]-48;
abyte15[abyte10[i6] & 255][abyte11[i6] & 255] = (char)(byte7 * 255);
abyte15[abyte5[i6] & 255][abyte6[i6] & 255] = (char)(byte7 * 255);
}
//boolean [][]aflag1 = new boolean[l3][l3];
bool** aflag1 = new bool*[l3]; //\\\\\\\\\\\
for( n1 = 0; n1 <l3; n1++)
{
aflag1[n1] = new bool[l3];
}
int j6 = 0;
for(int k6 = 0; k6 < l3; k6++)
{
for(int l6 = 0; l6 < l3; l6++)
{
if((abyte15[l6][k6] & byte5) != 0 || abyte12[j6] == 49)
aflag1[l6][k6] = true;
else
aflag1[l6][k6] = false;
j6++;
}
j6++;
}
//delete[] aflag1;
iLenRet=l3;
/************************************************************************/
/* 刪除new 變量 */
/************************************************************************/
delete []ai;
delete []abyte1;
delete []abyte2;
delete []abyte3;
delete []abyte4;
delete []abyte9;
delete []abyte12;
delete []abyte13;
delete []abyte14;
for( n1 = 0; n1 <l3; n1++)
{
delete []abyte15[n1];
}
delete[] abyte15;
return aflag1;
}
//char* Qrcode::divideDataBy8Bits(int ai[], char abyte0[],
char* Qrcode::divideDataBy8Bits(int* ai, char* abyte0,
int i,int iLen,int& iLRet)//int i,int j)
{
//int iLen = abyte0.length; iLenAi=ai..length
int j=iLen;
int l = 0;
int i1 = 8;
int j1 = 0;
//if(j == ai.length);
for(int i2 = 0; i2 < j; i2++)
j1 += abyte0[i2];
int k = (j1 - 1) / 8 + 1;
char* abyte1 = new char[i];
memset(abyte1,0,i);
for(int j2 = 0; j2 < k; j2++)
abyte1[j2] = 0;
for(int k2 = 0; k2 < j; k2++)
{
int k1 = ai[k2];
int l1 = abyte0[k2];
bool flag = true;
if(l1 == 0)
break;
while(flag)
if(i1 > l1)
{
abyte1[l] = (char)(abyte1[l] << l1 | k1);
i1 -= l1;
flag = false;
} else
{
l1 -= i1;
abyte1[l] = (char)(abyte1[l] << i1 | k1 >> l1);
if(l1 == 0)
{
flag = false;
} else
{
k1 &= (1 << l1) - 1;
flag = true;
}
l++;
i1 = 8;
}
}
if(i1 != 8)
abyte1[l] = (char)(abyte1[l] << i1);
else
l--;
if(l < i - 1)
{
for(bool flag1 = true; l < i - 1; flag1 = !flag1)
{
l++;
if(flag1)
abyte1[l] = -20;
else
abyte1[l] = 17;
}
}
iLRet=i;
return abyte1;
}
//private
//char* Qrcode::calculateRSECC(char abyte0[], char byte0, char abyte1[], int i, int j,
char* Qrcode::calculateRSECC(char* abyte0, char byte0, char* abyte1, int i, int j,
int iLen0,int iLen1)
{
//iLen1 abyte1.length ; iLen0 abyte0.length
char** abyte2 = new char*[256];
//char abyte2[][] = new char[256][byte0];
int n1;
for(n1=0;n1<256;n1++){
abyte2[n1]=new char[byte0];
memset(abyte2[n1],0,byte0);
}
try
{
CString s;
s.Format("qrcode_data/rsc%d.dat" ,byte0);
CFile f1(s, CFile::modeRead);
try
{
//for(int i2 = 0; i2 < 256; i2++) bufferedinputstream.read(abyte2[i2]);
for(int i2 = 0; i2 < 256; i2++)
f1.Read(abyte2[i2], byte0);
f1.Close();
}
catch(...)
{
f1.Close();
}
}
catch(CException exception)
{
//exception.printStackTrace();
}
bool flag = false;
int i1 = 0;
int k1 = 0;
char** abyte3 = new char*[iLen1];
char* abyte4 = new char[j];
memset(abyte4,0,j);
memcpy(abyte4, abyte0, iLen0);
int ab3Length=0;
for(int k = 0; k < iLen1; k++){
ab3Length= (abyte1[k] & 255) - byte0;
abyte3[k] = new char[(abyte1[k] & 255) - byte0];
memset(abyte3[k],0,(abyte1[k] & 255) - byte0);
}
for(int l = 0; l < i; l++)
{
abyte3[k1][i1] = abyte0[l];
if(++i1 >= (abyte1[k1] & 255) - byte0)
{
i1 = 0;
k1++;
}
}
/* for(int kkk=0;kkk<ab3Length;kkk++)
{
FILE *fp=NULL;
fp=fopen("C:\\test.txt","at+");
fprintf(fp,"%d: %d\r\n",kkk,abyte3[3][kkk]);
fclose(fp);
}*/
//for(int l1 = 0; l1 < abyte1.length; l1++)
for(int l1 = 0; l1 < iLen1; l1++)
{
//char abyte5[] = (char[])abyte3[l1].clone();
int iLen5=(abyte1[l1] & 255) - byte0;
char* abyte5=new char[iLen5];
memset(abyte5,0,iLen5);
for (n1=0;n1<iLen5;n1++)
{
abyte5[n1]=abyte3[l1][n1];
}
//char* abyte5 = abyte3[l1];
int j2 = abyte1[l1] & 255;
int k2 = j2 - byte0;
for(int j1 = k2; j1 > 0; j1--)
{
char byte1 = abyte5[0];
if(byte1 != 0)
{
//char abyte6[] = new char[abyte5.length - 1];
char* abyte6 = new char[iLen5];
memcpy(abyte6,abyte5+1,iLen5-1);
abyte6[iLen5-1]=0;
//System.arraycopy(abyte5, 1, abyte6, 0, iLen5 - 1);
//char abyte9[] = abyte2[byte1 & 255];
char* abyte9 = abyte2[byte1 & 255];
int iLret1;
abyte5 = calculateByteArrayBits(abyte6, abyte9, "xor",iLen5-1,byte0,iLret1);
//abyte5[iLen5-1]=0;
delete [] abyte6;
} else
if(byte0 < iLen5)
{
//char abyte7[] = new char[abyte5.length - 1];
char* abyte7 = new char[iLen5 - 1];
memcpy(abyte7,abyte5+1,iLen5-1);
for(n1=0;n1<iLen5-1;n1++)
abyte5[n1]=abyte7[n1];
//abyte5 = abyte7;
delete []abyte7;
} else
{
//char abyte8[] = new char[byte0];
char* abyte8 = new char[byte0];
memcpy(abyte8,abyte5+1,iLen5-1);
// abyte8[byte0 - 1] = 0;
for(n1=0;n1<byte0;n1++)
abyte5[n1]=abyte8[n1];
//abyte5 = abyte8;
delete []abyte8;
}
}
memcpy(abyte4+iLen0+l1*byte0,abyte5,byte0);
delete []abyte5;
}
for(n1=0;n1<256;n1++){
delete []abyte2[n1];
}
delete []abyte2;
for(n1=0;n1<iLen1;n1++){
delete []abyte3[n1];
}
delete []abyte3;
return abyte4;
}
//private
char* Qrcode::calculateByteArrayBits(char* abyte0, char* abyte1, CString s,
int iLen0,int iLen1,int& iLRet)
{
char* abyte3;//
char* abyte4;
int i,j,n1;
if(iLen0 > iLen1)
{
i=iLen0;
j=iLen1;
abyte3=new char[i+1];
abyte4=new char[j+1];
memset(abyte3,0,i+1);
for (n1=0;n1<i;n1++){
abyte3[n1]=abyte0[n1];
}
memset(abyte4,0,j+1);
for (n1=0;n1<j;n1++)
{
abyte4[n1]=abyte1[n1];
}
} else
{
i=iLen1;
j=iLen0;
abyte3=new char[i+1];
abyte4=new char[j+1];
memset(abyte3,0,i+1);
for (n1=0;n1<i;n1++)
{
abyte3[n1]=abyte1[n1];
}
memset(abyte4,0,j+1);
for (n1=0;n1<j;n1++)
{
abyte4[n1]=abyte0[n1];
}
}
char* abyte2 = new char[i+1];
memset(abyte2,0,i+1);
for(int k = 0; k < i; k++){
if(k < j)
{
if(s == "xor")
abyte2[k] = (char)(abyte3[k] ^ abyte4[k]);
else
abyte2[k] = (char)(abyte3[k] | abyte4[k]);
} else
{
abyte2[k] = abyte3[k];
}
}
delete []abyte3;
delete []abyte4;
return abyte2;
}
void Qrcode::TestMsg(char* myStr,int length)
{
//int kkk = strlen(myStr);
for(int iii=0;iii<length;iii++)
{
FILE *fp=NULL;
fp=fopen("C:\\test.txt","at+");
fprintf(fp,"%d: %d\r\n",iii,myStr[iii]);
fclose(fp);
}
}
char Qrcode::selectMask(char** abyte0, int i,int iLen0)
{
//iLen0 abyte0.GetLength();
//int j = abyte0.GetLength();
int j = iLen0;
int ai[] = {
0, 0, 0, 0, 0, 0, 0, 0
};
int ai1[] = {
0, 0, 0, 0, 0, 0, 0, 0
};
int ai2[] = {
0, 0, 0, 0, 0, 0, 0, 0
};
int ai3[] = {
0, 0, 0, 0, 0, 0, 0, 0
};
int k = 0;
int l = 0;
int ai4[] = {
0, 0, 0, 0, 0, 0, 0, 0
};
for(int i1 = 0; i1 < j; i1++)
{
int ai5[] = {
0, 0, 0, 0, 0, 0, 0, 0
};
int ai6[] = {
0, 0, 0, 0, 0, 0, 0, 0
};
bool aflag[] = {
false, false, false, false, false, false, false, false
};
bool aflag1[] = {
false, false, false, false, false, false, false, false
};
for(int l1 = 0; l1 < j; l1++)
{
if(l1 > 0 && i1 > 0)
{
k = abyte0[l1][i1] & abyte0[l1 - 1][i1] & abyte0[l1][i1 - 1] & abyte0[l1 - 1][i1 - 1] & 255;
l = abyte0[l1][i1] & 255 | abyte0[l1 - 1][i1] & 255 | abyte0[l1][i1 - 1] & 255 | abyte0[l1 - 1][i1 - 1] & 255;
}
for(int j2 = 0; j2 < 8; j2++)
{
// ai5[j2] = (ai5[j2] & 63) << 1 | (abyte0[l1][i1] & 255) >>> j2 & 1;
// ai6[j2] = (ai6[j2] & 63) << 1 | (abyte0[i1][l1] & 255) >>> j2 & 1;//高位自動補零
int n=abyte0[l1][i1] & 255;
int x=j2;
ai5[j2] = (ai5[j2] & 63) << 1 |(n>>x)&((int)pow(2,32-x)-1) & 1;
ai6[j2] = (ai6[j2] & 63) << 1 |(n>>x)&((int)pow(2,32-x)-1) & 1;
//ai5[j2] = (ai5[j2] & 63) << 1 |((abyte0[l1][i1] & 255))>> j2 & 1;
//ai6[j2] = (ai6[j2] & 63) << 1 |((abyte0[i1][l1] & 255))>> j2 & 1;
// ai5[j2] = (ai5[j2] & 63) << 1 | (abyte0[l1][i1] & 255) >> j2 & 1;
// ai6[j2] = (ai6[j2] & 63) << 1 | (abyte0[i1][l1] & 255) >> j2 & 1;//高位自動補零
if((abyte0[l1][i1] & 1 << j2) != 0)
ai4[j2]++;
if(ai5[j2] == 93)
ai2[j2] += 40;
if(ai6[j2] == 93)
ai2[j2] += 40;
if(l1 > 0 && i1 > 0)
{
if((k & 1) != 0 || (l & 1) == 0)
ai1[j2] += 3;
k >>= 1;
l >>= 1;
}
if((ai5[j2] & 31) == 0 || (ai5[j2] & 31) == 31)
{
if(l1 > 3)
if(aflag[j2])
{
ai[j2]++;
} else
{
ai[j2] += 3;
aflag[j2] = true;
}
} else
{
aflag[j2] = false;
}
if((ai6[j2] & 31) == 0 || (ai6[j2] & 31) == 31)
{
if(l1 > 3)
if(aflag1[j2])
{
ai[j2]++;
} else
{
ai[j2] += 3;
aflag1[j2] = true;
}
} else
{
aflag1[j2] = false;
}
}
}
}
int j1 = 0;
char byte0 = 0;
int ai7[] = {
90, 80, 70, 60, 50, 40, 30, 20, 10, 0,
0, 10, 20, 30, 40, 50, 60, 70, 80, 90,
90
};
for(int k1 = 0; k1 < 8; k1++)
{
ai3[k1] = ai7[(20 * ai4[k1]) / i];
int i2 = ai[k1] + ai1[k1] + ai2[k1] + ai3[k1];
if(i2 < j1 || k1 == 0)
{
byte0 = (char)k1;
j1 = i2;
}
}
return byte0;
}
復制代碼
作者:
cauzx
時間:
2016-10-30 22:49
正在學習二維碼,正是我需要的
作者:
huac82
時間:
2017-3-15 19:58
VC的二維碼真心是少,希望這個對我有參考價值
作者:
nmlnj
時間:
2017-3-25 16:31
最近在處理QR碼打印的工作。沒有思路了。。。
作者:
z17173
時間:
2017-3-26 13:19
初學者的好資料,51黑有你更精彩
作者:
chtctc
時間:
2017-8-16 10:02
最近在處理QR碼打印的工作。沒有思路了。。。
作者:
chtctc
時間:
2017-8-16 10:13
初來乍到,看看這個能不能用
作者:
xiongbo
時間:
2017-11-6 12:39
謝謝分享,剛剛開始要做一個二維碼的程序
作者:
羽Love墨
時間:
2017-11-19 16:17
點擊生成是會提示如下錯誤,暫時尚未找到原因。
4JOSG6](9]L7K7M$R6)PJ30.png
(20.61 KB, 下載次數: 54)
下載附件
運行錯誤
2017-11-19 16:16 上傳
作者:
reg1998
時間:
2018-6-8 20:24
能不能用啊
作者:
jwp2008
時間:
2019-12-19 15:18
正在找這個資料,希望有幫助
作者:
frank_tw
時間:
2021-11-7 14:48
Very Good Thanks!
歡迎光臨 (http://www.zg4o1577.cn/bbs/)
Powered by Discuz! X3.1
主站蜘蛛池模板:
亚洲福利在线观看
|
午夜tv免费观看
|
久久久精品综合
|
久久精品视频网站
|
国产精品成人一区二区
|
亚洲区一区二区
|
国产精品久久久乱弄
|
99国产精品久久久久老师
|
亚洲精品乱码久久久久久按摩观
|
蜜桃av一区二区三区
|
亚洲欧美一区二区三区在线
|
久久久精品一区
|
欧美视频在线看
|
亚洲精品视频在线看
|
亚洲a在线观看
|
国产区精品视频
|
成人综合在线视频
|
欧美啊v在线观看
|
久久久国产精品网站
|
亚洲精品乱码久久久久久蜜桃91
|
久久国产欧美日韩精品
|
日本高清视频在线播放
|
a久久
|
欧美日韩在线一区二区
|
羞羞在线视频
|
精品国产91亚洲一区二区三区www
|
91色网站
|
国产精品久久久久久久7电影
|
美日韩免费视频
|
一区在线观看视频
|
欧美午夜一区二区三区免费大片
|
欧美精品久久久
|
国产91精品久久久久久久网曝门
|
欧美日韩精品久久久免费观看
|
成人av网页
|
国产精品久久久久久婷婷天堂
|
日韩中出
|
日本久久福利
|
亚洲国产精品久久久久婷婷老年
|
中文字幕一区二区视频
|
亚洲视频网
|