-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpixmap.h
87 lines (72 loc) · 2.21 KB
/
pixmap.h
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* $Id: pixmap.h,v 1.6 2002/07/17 07:29:59 inou Exp $
*/
#ifndef PIXMAP_H
#define PIXMAP_H
#include <boost/thread.hpp>
#include <qimage.h>
#include <qpoint.h>
#include <qobject.h>
#include "double.h"
#include "colormap.h"
#include "config.h"
using namespace boost;
namespace QFract {
class Canvas;
//class Pixmap //: public QPixmap
class Pixmap : public QObject
{
Q_OBJECT
public:
Pixmap( Canvas* c, int w, int h,
double xl, double yt, double xr, double yb, int m,
int (*f)( Point, Parameter, int ), void (*pi)( Parameter ),
Parameter p );
Pixmap( const Pixmap& d );
int paramNum() { return param.Num(); }
void setRegion(double xl, double yt, double xr, double yb)
{ region.setValue(xl,yt,xr,yb); setDiff(); }
void setRegion(Point tl, Point br) { region.setValue(tl, br); setDiff(); }
void setFunc( int (*f)(Point, Parameter, int ) ) { iter=f; }
void setParamInitFunc( void (*pi)( Parameter ) ) { paraminit=pi; }
void setRegion( Rect r ) { region=r; setDiff();}
void setParamNum( int n ) { param.setNum(n);}
void setParam( Parameter p )
{ param.setNum(p.Num()); param.set(p);
if (paraminit!=NULL) paraminit(param); }
void setMaxIter( int m ) { max=m; }
void loadColorMap( const char *filename ) { colormap.open(filename); }
void setColorMap( ColorMap c ) { colormap=c; }
int maxIter() { return max; }
Rect Region() { return region; }
ColorMap colorMap() { return colormap; }
int width() { return image->width(); }
int height() { return image->height(); }
double dWidth() { return region.width(); }
double dHeight() { return region.height(); }
Point getPoint(int ix, int iy);
QPoint getPos(Point z);
void draw();
void do_draw(int xs, int xe, int ys, int ye, int j);
void progress(int max);
void resize( int w, int h, bool redrawEnabled=true );
QImage* getImage() { return image; }
signals:
void haveDrawn();
private:
QImage *image;
Rect region;
double diff;
int max; // max iteration time
Parameter param;
int (*iter)(Point, Parameter , int); // calculation function
void (*paraminit)( Parameter );
ColorMap colormap;
Canvas* parent;
void setDiff();
int p[NUM_THREADS];
thread_group thr_grp;
boost::mutex mtx_;
};
}
#endif // PIXMAP_H