]>
git.mar77i.info Git - bigintmandel/blob - mandel.h
16 MpzPoint() : x(), y() {}
17 explicit MpzPoint(mpz_class x
, mpz_class y
) : x(x
), y(y
) {}
18 MpzPoint(const MpzPoint
&other
) : x(other
.x
), y(other
.y
) {}
19 inline const mpz_class
get_x() const { return x
; }
20 inline const mpz_class
get_y() const { return y
; }
23 class MandelResultCell
{
27 MandelResultCell() : iter(0) {}
28 MandelResultCell(size_t iter
, MpzPoint rpos
) : iter(iter
), rpos(rpos
) {}
29 inline const size_t get_iter() const { return iter
; }
30 inline const MpzPoint
get_rpos() const { return rpos
; }
38 mpz_class left
, top
, one
;
41 // required by the MandelSettings constructor
49 MandelParams(const MandelParams
&other
);
50 inline const size_t get_max_iter() const { return max_iter
; }
51 inline void set_max_iter(const size_t max_iter
) { this->max_iter
= max_iter
; }
52 inline const QSize
get_size() const { return size
; }
53 inline const MpzPoint
get_center_f() const { return center_f
; }
54 inline const mpz_class
get_left() const { return left
; }
55 inline const mpz_class
get_top() const { return top
; }
56 inline const mpz_class
get_one() const { return one
; }
58 static MandelParams
from_json(const QJsonObject
&json
);
59 QJsonObject
to_json() const;
64 class MandelSettings
{
67 QVector
<MandelCell
> cells
;
70 MandelSettings(size_t max_iter
, QSize size
);
71 inline QPixmap
get_pixmap() const { return QPixmap::fromImage(*img
); }
72 inline const QVector
<MandelCell
> get_cells() const { return cells
; }
73 inline const MandelParams
&get_params() const { return params
; }
74 inline void set_max_iter(size_t max_iter
) { params
.set_max_iter(max_iter
); }
76 void zoom(const QSize size
, int zoom_factor
, const QPoint pos
);
77 void finished_cell(int num
, const MandelResultCell
&cell
);
78 void save_img(QString file_name
);
79 void reset(size_t max_iter
, QSize size
);
80 void from_json(const QJsonObject
&json
);
81 QJsonObject
to_json();
84 extern QVector
<QColor
> colors
;
87 const MandelParams
*params
;
90 MandelResultCell result
;
93 MandelCell(const MandelParams
*params
);
95 const MandelParams
*params
,
98 const MandelResultCell result
100 MandelCell(const MandelCell
&cell
);
101 inline const QPoint
get_pos() const { return pos
; }
102 inline const MpzPoint
get_rpos0() const { return rpos0
; }
103 inline const QColor
get_color() const {
104 size_t iter
= result
.get_iter();
105 return iter
< params
->get_max_iter()
106 ? colors
[iter
% colors
.size()]
107 : Qt::GlobalColor::black
;
110 void setup(const QPoint pos
);
111 inline void set_result(const MandelResultCell
&result
) {
112 this->result
= result
;
114 MandelResultCell
iterate() const;
115 MandelResultCell
from_json(const QJsonObject
&json
);
116 QJsonObject
to_json() const;