2013-12-09 21:16:00 +00:00
|
|
|
#include "PictureWriter.h"
|
|
|
|
|
|
|
|
#include <QImage>
|
|
|
|
|
2015-12-15 23:31:07 +00:00
|
|
|
PictureWriter::PictureWriter() {
|
|
|
|
}
|
|
|
|
|
|
|
|
PictureWriter::~PictureWriter() {
|
|
|
|
}
|
|
|
|
|
2015-12-10 23:36:50 +00:00
|
|
|
bool PictureWriter::save(const string &filepath, int width, int height) {
|
2013-12-09 21:16:00 +00:00
|
|
|
QImage result(width, height, QImage::Format_ARGB32);
|
|
|
|
|
2015-11-09 21:30:46 +00:00
|
|
|
for (int y = 0; y < height; y++) {
|
|
|
|
for (int x = 0; x < width; x++) {
|
2013-12-09 21:16:00 +00:00
|
|
|
result.setPixel(x, height - 1 - y, getPixel(x, y));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return result.save(QString::fromStdString(filepath));
|
|
|
|
}
|