forked from tux3/Evolve
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwidget.h
59 lines (48 loc) · 1.19 KB
/
widget.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#ifndef WIDGET_H
#define WIDGET_H
#include <QWidget>
#include <QImage>
#include <QVector>
#include <QMenuBar>
#include "poly.h"
extern QApplication* app;
namespace Ui {
class Widget;
}
class Widget : public QWidget
{
Q_OBJECT
public:
explicit Widget();
~Widget();
int computeFitness(QImage& target, QRect box=QRect());
Poly genPoly(); // Creates a new random polygon
static void drawPoly(QImage& target, Poly& poly);
void redraw(QImage& target);
QColor optimizeColors(QImage& target, Poly& poly, bool redraw=false);
void updateGuiFitness();
void run(); // Run the vectorizer's main loop
protected:
void closeEvent(QCloseEvent *event);
private slots:
void openImageClicked();
void saveImageClicked();
void saveSVGClicked();
void importDnaClicked();
void exportDnaClicked();
void cleanDnaClicked();
void optimizeDnaClicked();
void startClicked();
void settingsClicked();
private:
Ui::Widget *ui;
QMenuBar *menuBar;
QAction* startStopAction;
QImage pic;
QImage generated;
bool running;
QVector<Poly> polys;
static unsigned height, width;
int fitness, generation;
};
#endif // WIDGET_H