2008-06-29 04:33:47 +08:00
|
|
|
#ifndef MANDELBROT_H
|
|
|
|
#define MANDELBROT_H
|
|
|
|
|
|
|
|
#include <Eigen/Array>
|
|
|
|
#include <QtGui/QApplication>
|
|
|
|
#include <QtGui/QWidget>
|
|
|
|
|
|
|
|
class MandelbrotWidget : public QWidget
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
2008-06-29 20:04:00 +08:00
|
|
|
Eigen::Vector2f center;
|
|
|
|
float xradius;
|
2008-06-29 04:33:47 +08:00
|
|
|
int size;
|
|
|
|
unsigned char *buffer;
|
|
|
|
QPoint lastpos;
|
2008-06-29 20:04:00 +08:00
|
|
|
int draft;
|
2008-06-29 04:33:47 +08:00
|
|
|
|
|
|
|
protected:
|
|
|
|
void resizeEvent(QResizeEvent *);
|
|
|
|
void paintEvent(QPaintEvent *);
|
|
|
|
void mousePressEvent(QMouseEvent *event);
|
|
|
|
void mouseMoveEvent(QMouseEvent *event);
|
2008-06-29 20:04:00 +08:00
|
|
|
template<typename Real> int render(int max_iter, int resx, int resy);
|
2008-06-29 04:33:47 +08:00
|
|
|
|
|
|
|
public:
|
2008-06-29 20:04:00 +08:00
|
|
|
MandelbrotWidget() : QWidget(), center(0,0), xradius(2),
|
|
|
|
size(0), buffer(0), draft(16)
|
2008-06-29 04:33:47 +08:00
|
|
|
{
|
|
|
|
setAutoFillBackground(false);
|
|
|
|
}
|
|
|
|
~MandelbrotWidget() { if(buffer) delete[]buffer; }
|
|
|
|
};
|
|
|
|
|
2008-06-29 20:04:00 +08:00
|
|
|
#endif // MANDELBROT_H
|