// allocate the memory for the input picture
unsigned char* Orig_Image = NULL;
Orig_Image = new unsigned char[Nb_Lines * Nb_Pixels];
memset(Orig_Image, 0, Nb_Lines * Nb_Pixels);
// create a B/W color table for the image
QVector<QRgb> colorTable;
for (int i = 0; i < 256; i++)
colorTable.
push_back(QColor(i, i, i
).
rgb());
.... edit the data array here
Image
= QImage(Orig_Image,Nb_Pixels,Nb_Lines,Nb_Pixels,
QImage::Format_Indexed8);
Image.setColorTable(colorTable);
if(!Image.
isNull()) Image.
save(QFileDialog::getSaveFileName(this,
"Load a picture or file",
QString(),
"BMP"));
delete(Orig_Image);
// allocate the memory for the input picture
unsigned char* Orig_Image = NULL;
QImage Image;
Orig_Image = new unsigned char[Nb_Lines * Nb_Pixels];
memset(Orig_Image, 0, Nb_Lines * Nb_Pixels);
// create a B/W color table for the image
QVector<QRgb> colorTable;
for (int i = 0; i < 256; i++)
colorTable.push_back(QColor(i, i, i).rgb());
.... edit the data array here
Image = QImage(Orig_Image,Nb_Pixels,Nb_Lines,Nb_Pixels,QImage::Format_Indexed8);
Image.setColorTable(colorTable);
if(!Image.isNull()) Image.save(QFileDialog::getSaveFileName(this, "Load a picture or file", QString(), "BMP"));
delete(Orig_Image);
To copy to clipboard, switch view to plain text mode
Bookmarks