Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "encryptmy.h"
- #include <stdlib.h>
- enCryptMy::enCryptMy(QObject *parent) : QObject(parent)
- {
- }
- void enCryptMy::EncrpytMy(QString encryptText, QString localizationToSave)
- {
- //variables for converting text to int
- QString localization = localizationToSave;
- QString texxt = encryptText;
- QChar test;
- QList <int> intArray[texxt.length()]; //converted text in ASCII format
- //converting...
- if (texxt.isNull())
- {
- return;
- }
- else
- {
- for (int d=0; d <texxt.size();d++)
- {
- test = texxt.at(d);
- intArray[0].append(0);
- intArray[d+1].append(test.toLatin1());
- qDebug()<<"the code to start mission 'Mars Revolution' is :" <<intArray[d +1];
- }
- }
- //making image
- int index = 0;
- int width = texxt.length();
- int isok = texxt.length() % 4
- qDebug()<<"width: "<<width;
- QRgb value =0;
- QImage img(width,width,QImage::Format_ARGB32);
- if (isok==0)
- {
- for (int w = 1; w <=texxt.length(); w++)
- {
- //converting ints to pixels
- index = w * 4;
- value = qRgba(intArray[index-3], intArray[index-2], intArray[index-1],intArray[index]);
- //setting pixels
- img.setPixel(w,1,value);
- qDebug()<<"value :"<<value; // let's see if this is working
- }
- img.save("test.png"); // dunno where it saves the file, or even if it saves... It's a mystery!
- }
- else
- {
- //code to add the result of modulo to list, just to protect it from buga
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement