00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00027 #ifndef H__ImageCalculator_H
00028 #define H__ImageCalculator_H
00029
00030 #include <QtGui/QImage>
00031 #include <QtCore/QVector>
00032 #include <QtGui>
00033
00034 #include "fractale.h"
00035 #include "ImageTiler.h"
00036
00037
00038 class ImageCalculator : public QObject
00039 {
00040 Q_OBJECT
00041
00042 public :
00043 ImageCalculator(int nb, QImage *d, QRectF w, QSize r, fractale &f, char e, bool anim);
00044 ~ImageCalculator();
00045
00046 void run();
00047 long maxValue;
00048
00049 long inline getMaxValue(){
00050 return maxValue;
00051 }
00052
00056 static long inline RGBAToInt(QRgb r){
00057 int red = qRed(r);
00058 int green = qGreen(r);
00059 int blue = qBlue(r);
00060 int alpha = 255-qAlpha(r);
00061 return (alpha << 24) + (red<<16) + (green<<8) + blue;
00062 }
00063
00067 static QRgb inline intToRGBA(long r){
00068 int alpha = r >> 24;
00069 r -= (alpha << 24);
00070 int red = r >> 16;
00071 r -= (red << 16);
00072 int green = r >> 8;
00073 r -= (green << 8);
00074 int blue = r;
00075
00076 return QColor(red, green, blue, 255-alpha).rgb();
00077 }
00078
00079 signals:
00080 void progress(int x);
00081 void render();
00082
00083 public slots :
00084 void s_processing();
00085 private:
00086 int nbThreads;
00087 QImage *destination;
00088 QRectF window;
00089 QSize size;
00090 fractale &frac;
00091 char exhaustivite;
00092 bool animate;
00093 bool shortcuts;
00094
00095 int nbProcessedRows;
00096
00097
00098 QVector<QImage*> imageParts;
00099 void sumImagesIntoDestination();
00100 void applyGamma();
00101 };
00102
00103 #endif