-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathromdecoderbitimages.cpp
More file actions
58 lines (45 loc) · 1.59 KB
/
romdecoderbitimages.cpp
File metadata and controls
58 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#include <QProgressDialog>
#include "romdecoderbitimages.h"
#include "maskromtool.h"
RomDecoderBitImages::RomDecoderBitImages()
{
}
QString RomDecoderBitImages::preview(MaskRomTool *m){
return "No preview of image exports.";
}
void RomDecoderBitImages::writeFile(MaskRomTool *m, QString filename){
// Create the image with the exact size of the shrunk scene
QImage image=m->background;
//QPainter painter(&image);
//painter.setRenderHint(QPainter::Antialiasing);
//m->scene->render(&painter);
image.save(filename);
QDir dir(filename);
if(!dir.exists()){
qDebug()<<"Needs a directory path, not a file.";
return;
}
/* FIXME: This really ought to be done with a timer callback,
* such that the progressdialog properly renders and the
* operation can be cancelled partway. Until then,
* we'll comment out the progress dialog.
*/
RomBitItem* rowbit = m->markBitTable();
//QProgressDialog progress("Exporting", "Cancel", 0, m->rowcount);
//Iterating by row and column.
while(rowbit /* && !progress.wasCanceled() */ ){
//int r=0;
RomBitItem* bit=rowbit;
while(bit){
QImage image=bit->getImage();
QString fn=dir.filePath(QString::asprintf("bit-%04d-%04d-%d.png", bit->row, bit->col, bit->bitValue()));
if(bit->col==0)
qDebug()<<fn;
image.save(fn);
bit=bit->nexttoright; //Skip down the row.
}
//progress.setValue(++r);
rowbit=rowbit->nextrow; //Skip to the next row.
}
//progress.close();
}