This repository has been archived by the owner on Apr 17, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
PaintView.h
83 lines (61 loc) · 1.63 KB
/
PaintView.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
//
// paintview.h
//
// The header file for painting view of the input images
//
#ifndef PAINTVIEW_H
#define PAINTVIEW_H
#include <FL/Fl.H>
#include <FL/Fl_Gl_Window.H>
#include <FL/gl.h>
#if defined(__APPLE__)
#include <OpenGL/glu.h>
#else
#include <GL/glu.h>
#endif
#include "Image.hpp"
#include "ImageUtils.hpp"
#include "ImpBrush.h"
#include <stdlib.h>
extern int irand(int max);
extern float frand();
class ImpressionistDoc;
class PaintView : public Fl_Gl_Window {
public:
Point line_start;
Point line_end;
bool auto_paint_flag = false;
bool multires_paint_flag = false;
bool finish_painting_flag = true;
/**
* @brief The image generated by last user painting.
*
*/
Image prev;
/**
* @brief The current image generated by user painting.
*/
Image cur;
Image overlay_image;
Image black_image;
PaintView(int x, int y, int w, int h, const char *l);
void draw();
int handle(int event);
void refresh();
void resizeWindow(int width, int height);
void save_content(GLvoid *ptr);
void save_to_cur();
void restore_content(GLvoid *ptr);
void draw_line(GLubyte r, GLubyte g, GLubyte b, GLubyte a);
void abort_event(int &e, Point &p);
void set_current_img(Image &img);
void auto_paint(int s = 0, short res = 0); // s: spacing, res: resolution
void multires_paint();
void paint_layer(Image &reference, int radius);
ImpressionistDoc *m_pDoc;
private:
GLvoid *m_pPaintBitstart;
int m_nDrawWidth, m_nDrawHeight, m_nStartRow, m_nEndRow, m_nStartCol,
m_nEndCol, m_nWindowWidth, m_nWindowHeight;
};
#endif