Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void Paint::on_pushButton_5_clicked()
- {
- int ii=0;
- char b=0;
- unsigned char lcd_word_array[8][128]={{0}};
- QFile fileIn("example.bmp");
- QFile fileOut("example.txt");
- if(!fileIn.open(QFile::ReadOnly)){
- qDebug() << "File not exists";
- }
- if(!fileOut.open(QFile::WriteOnly)){
- qDebug() << "File not exists";
- }
- fileIn.seek(SEEK_SET);
- QTextStream stream(&fileIn);
- char *ch = new char();
- int i = 0;
- int j = 0;
- while(!fileIn.atEnd()){
- b = fileIn.getChar(ch);
- b = ~ b;
- lcd_word_array[i][j] = b;
- qDebug() << b;
- if(i < 7) {i++;}
- else {j++; i = 0;}
- ii++;
- if(ii > 1023) break;
- }
- fileIn.close();
- i = 0;
- j = 0;
- fileOut.write("const byte satan[8][128]={");
- fileOut.write("\r\n");
- for(i = 7; i >= 0; i--){
- fileOut.write("{");
- for(j = 0; j < 128; j++){
- if(j > 0 && j != 128) fileOut.write(", ");
- if(lcd_word_array[i][j] == 0x00) {fileOut.write("0x00");}
- else{
- if(lcd_word_array[i][j] <= 0x0F) {fileOut.write(QString("0x0%1").arg(lcd_word_array[i][j], 0, 16).toUtf8());}
- else
- fileOut.write(QString("0x%1").arg(lcd_word_array[i][j] & 0xFF, 0, 16).toUtf8());
- }
- }
- if(i != 0) fileOut.write("},\r\n");
- else fileOut.write("}");
- }
- fileOut.write("\r\n};");
- fileOut.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement