00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00024 #ifndef H__ImageCalculator_H
00025 #define H__ImageCalculator_H
00026
00027 #include <QtGui/QImage>
00028 #include <QtCore/QVector>
00029 #include <QtGui>
00030
00031 #include "fractale.h"
00032 #include "imagetiler.h"
00033 #include "networkimagetiler.h"
00034
00041 class ImageCalculator : public QThread
00042 {
00043 Q_OBJECT
00044
00045 public :
00046 ImageCalculator(int nb, QImage *d, QRectF w, QSize r, fractale &f, bool type, long nbr, bool anim, QStringList &networkList);
00047 ~ImageCalculator();
00048
00049 void run();
00050 long maxValue;
00051
00052 long inline getMaxValue(){
00053 return maxValue;
00054 }
00055
00059 static long inline RGBAToInt(QRgb r){
00060 int red = qRed(r);
00061 int green = qGreen(r);
00062 int blue = qBlue(r);
00063 int alpha = 0;
00064 return (alpha << 24) + (red<<16) + (green<<8) + blue;
00065 }
00066
00070 static QRgb inline intToRGBA(long r){
00071 int alpha = r >> 24;
00072 r -= (alpha << 24);
00073 int red = r >> 16;
00074 r -= (red << 16);
00075 int green = r >> 8;
00076 r -= (green << 8);
00077 int blue = r;
00078
00079 return QColor(red, green, blue, 255-alpha).rgb();
00080 }
00081
00082 signals:
00083 void progress(int x);
00084 void render();
00085
00086 public slots :
00087 void s_processing();
00088 private:
00089 int nbThreads;
00090 QImage *destination;
00091 QRectF window;
00092 QSize size;
00093 fractale &frac;
00094 bool animate;
00095 bool shortcuts;
00096 bool useRandomCalculation;
00097 long nbRandom;
00098 int lastProgression;
00099
00100 long nbProcessedRows;
00101
00102 QMutex mutex;
00103 QVector<QVector<long> > result;
00104 QStringList &networkAdresses;
00105 void sumImagesIntoDestination();
00106
00107 QVector<ImageTiler*> tilers;
00108 QVector<NetworkImageTiler*> networkTilers;
00109 };
00110
00111 #endif