#include "makecolors.h" #include MakeColors::MakeColors(const QString nodesTxt, const QString colorsTxt, const QStringList searchPaths, QObject *parent) : QThread(parent) { textureFileFilter << "*.png"; setFileNodesTxt(nodesTxt); setFileColorsTxt(colorsTxt); setTextureSearchDirectorys(searchPaths); abort = false; } MakeColors::MakeColors() { textureFileFilter << "*.png"; abort = false; } MakeColors::~MakeColors() { mutex.lock(); abort = true; mutex.unlock(); wait(); } QColor MakeColors::processImage(QString path) { //create a new image and load from path QImage img(path); QColor color; //convert to RGB32 format img = img.convertToFormat(QImage::Format_ARGB32); int w = img.width(); int h = img.height(); long r,g,b; r=g=b=0; int counter =0; for(int i = 0; iimg.constScanLine(i); //Dont access rowData directly! it depends on platform. always use QRgb() QRgb *rowData = (QRgb*)img.constScanLine(i); for(int j = 0;jfileColorsTxt = value; } void MakeColors::setFileNodesTxt(const QString &value) { fileNodesTxt = value; } bool MakeColors::writeColorsTxt(const QString file) { QFile outputFile(file); output("Writing colors.txt file to "+file ,INFO); if (outputFile.open(QIODevice::WriteOnly| QIODevice::Truncate | QIODevice::Text)) { //QTextStream in(&inputFile); QMapIterator mi(nodeList); QTextStream out(&outputFile); QString lastMod = "";//Used for some nicer formating out << "# Autogenerated colors.txt file from MinetestMapperGui"<