mirror of
https://gitlab.com/libeigen/eigen.git
synced 2024-12-15 07:10:37 +08:00
97a1038653
- much better coloring - determine max number of iterations and choice between float and double at runtime based on zoom level - do draft renderings with increasing resolution before final rendering
36 lines
811 B
C++
36 lines
811 B
C++
#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;
|
|
int size;
|
|
unsigned char *buffer;
|
|
QPoint lastpos;
|
|
int draft;
|
|
|
|
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);
|
|
|
|
public:
|
|
MandelbrotWidget() : QWidget(), center(0,0), xradius(2),
|
|
size(0), buffer(0), draft(16)
|
|
{
|
|
setAutoFillBackground(false);
|
|
}
|
|
~MandelbrotWidget() { if(buffer) delete[]buffer; }
|
|
};
|
|
|
|
#endif // MANDELBROT_H
|