]>
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 explicit MandelResultCell(size_t iter
, MpzPoint rpos
)
29 : iter(iter
), rpos(rpos
) {}
30 inline const size_t get_iter() const { return iter
; }
31 inline const MpzPoint
get_rpos() const { return rpos
; }
39 mpz_class left
, top
, one
;
42 // required by the MandelSettings constructor
44 explicit MandelParams(
50 MandelParams(const MandelParams
&other
);
51 inline const size_t get_max_iter() const { return max_iter
; }
52 inline void set_max_iter(const size_t max_iter
) { this->max_iter
= max_iter
; }
53 inline const QSize
get_size() const { return size
; }
54 inline const MpzPoint
get_center_f() const { return center_f
; }
55 inline const mpz_class
get_left() const { return left
; }
56 inline const mpz_class
get_top() const { return top
; }
57 inline const mpz_class
get_one() const { return one
; }
59 static MandelParams
from_json(const QJsonObject
&json
);
60 QJsonObject
to_json() const;
65 class MandelSettings
{
68 QVector
<MandelCell
> cells
;
71 explicit MandelSettings(size_t max_iter
, QSize size
);
72 inline QPixmap
get_pixmap() const { return QPixmap::fromImage(*img
); }
73 inline const QVector
<MandelCell
> get_cells() const { return cells
; }
74 inline const MandelParams
&get_params() const { return params
; }
75 inline void set_max_iter(size_t max_iter
) { params
.set_max_iter(max_iter
); }
77 void zoom(const QSize size
, int zoom_factor
, const QPoint pos
);
78 void finished_cell(int num
, const MandelResultCell
&cell
);
79 void save_img(QString file_name
);
80 void reset(size_t max_iter
, QSize size
);
81 void from_json(const QJsonObject
&json
);
82 QJsonObject
to_json();
85 extern QVector
<QColor
> colors
;
88 const MandelParams
*params
;
91 MandelResultCell result
;
94 MandelCell(const MandelParams
*params
);
96 const MandelParams
*params
,
99 const MandelResultCell result
101 MandelCell(const MandelCell
&cell
);
102 inline const QPoint
get_pos() const { return pos
; }
103 inline const MpzPoint
get_rpos0() const { return rpos0
; }
104 inline const QColor
get_color() const {
105 size_t iter
= result
.get_iter();
106 return iter
< params
->get_max_iter()
107 ? colors
[iter
% colors
.size()]
108 : Qt::GlobalColor::black
;
111 void setup(const QPoint pos
);
112 inline void set_result(const MandelResultCell
&result
) {
113 this->result
= result
;
115 MandelResultCell
iterate() const;
116 MandelResultCell
from_json(const QJsonObject
&json
);
117 QJsonObject
to_json() const;