mandelbrot.h
Go to the documentation of this file.
1 // This file is part of Eigen, a lightweight C++ template library
2 // for linear algebra.
3 //
4 // Copyright (C) 2008 Benoit Jacob <jacob.benoit.1@gmail.com>
5 //
6 // This Source Code Form is subject to the terms of the Mozilla
7 // Public License v. 2.0. If a copy of the MPL was not distributed
8 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 
10 #ifndef MANDELBROT_H
11 #define MANDELBROT_H
12 
13 #include <Eigen/Core>
14 #include <QtGui/QApplication>
15 #include <QtGui/QWidget>
16 #include <QtCore/QThread>
17 
18 class MandelbrotWidget;
19 
20 class MandelbrotThread : public QThread
21 {
22  friend class MandelbrotWidget;
24  long long total_iter;
25  int id, max_iter;
27 
28  public:
30  void run();
31  template<typename Real> void render(int img_width, int img_height);
32 };
33 
34 class MandelbrotWidget : public QWidget
35 {
36  Q_OBJECT
37 
38  friend class MandelbrotThread;
39  Eigen::Vector2d center;
40  double xradius;
41  int size;
42  unsigned char *buffer;
43  QPoint lastpos;
44  int draft;
47 
48  protected:
49  void resizeEvent(QResizeEvent *);
50  void paintEvent(QPaintEvent *);
51  void mousePressEvent(QMouseEvent *event);
52  void mouseMoveEvent(QMouseEvent *event);
53 
54  public:
55  MandelbrotWidget() : QWidget(), center(0,0), xradius(2),
56  size(0), buffer(0), draft(16)
57  {
58  setAutoFillBackground(false);
59  threadcount = QThread::idealThreadCount();
61  for(int th = 0; th < threadcount; th++) threads[th] = new MandelbrotThread(this, th);
62  }
64  {
65  if(buffer) delete[]buffer;
66  for(int th = 0; th < threadcount; th++) delete threads[th];
67  delete[] threads;
68  }
69 };
70 
71 #endif // MANDELBROT_H
w
RowVector3d w
Definition: Matrix_resize_int.cpp:3
MandelbrotThread::max_iter
int max_iter
Definition: mandelbrot.h:25
MandelbrotWidget::mousePressEvent
void mousePressEvent(QMouseEvent *event)
Definition: mandelbrot.cpp:173
MandelbrotThread::total_iter
long long total_iter
Definition: mandelbrot.h:24
MandelbrotWidget::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event)
Definition: mandelbrot.cpp:188
MandelbrotWidget::buffer
unsigned char * buffer
Definition: mandelbrot.h:42
MandelbrotWidget::paintEvent
void paintEvent(QPaintEvent *)
Definition: mandelbrot.cpp:127
buffer
Definition: pytypes.h:2270
MandelbrotWidget::~MandelbrotWidget
~MandelbrotWidget()
Definition: mandelbrot.h:63
MandelbrotWidget::resizeEvent
void resizeEvent(QResizeEvent *)
Definition: mandelbrot.cpp:17
MandelbrotThread::id
int id
Definition: mandelbrot.h:25
MandelbrotThread::render
void render(int img_width, int img_height)
Definition: mandelbrot.cpp:31
MandelbrotWidget::MandelbrotThread
friend class MandelbrotThread
Definition: mandelbrot.h:38
MandelbrotWidget::draft
int draft
Definition: mandelbrot.h:44
MandelbrotWidget::threads
MandelbrotThread ** threads
Definition: mandelbrot.h:45
MandelbrotThread::widget
MandelbrotWidget * widget
Definition: mandelbrot.h:23
MandelbrotWidget::size
int size
Definition: mandelbrot.h:41
MandelbrotWidget::threadcount
int threadcount
Definition: mandelbrot.h:46
MandelbrotThread::single_precision
bool single_precision
Definition: mandelbrot.h:26
MandelbrotWidget::center
Eigen::Vector2d center
Definition: mandelbrot.h:39
MandelbrotThread
Definition: mandelbrot.h:20
MandelbrotThread::run
void run()
Definition: mandelbrot.cpp:111
MandelbrotWidget
Definition: mandelbrot.h:34
MandelbrotWidget::MandelbrotWidget
MandelbrotWidget()
Definition: mandelbrot.h:55
MandelbrotThread::MandelbrotThread
MandelbrotThread(MandelbrotWidget *w, int i)
Definition: mandelbrot.h:29
MandelbrotWidget::xradius
double xradius
Definition: mandelbrot.h:40
MandelbrotWidget::lastpos
QPoint lastpos
Definition: mandelbrot.h:43
i
int i
Definition: BiCGSTAB_step_by_step.cpp:9


gtsam
Author(s):
autogenerated on Sat Nov 16 2024 04:02:44