eigen/demos/mandelbrot/mandelbrot.h

36 lines
811 B
C
Raw Normal View History

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
Eigen::Vector2f center;
float xradius;
2008-06-29 04:33:47 +08:00
int size;
unsigned char *buffer;
QPoint lastpos;
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);
template<typename Real> int render(int max_iter, int resx, int resy);
2008-06-29 04:33:47 +08:00
public:
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; }
};
#endif // MANDELBROT_H