-
Notifications
You must be signed in to change notification settings - Fork 3
/
ImpressionistDoc.h
101 lines (81 loc) · 2.34 KB
/
ImpressionistDoc.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//
// impressionistDoc.h
//
// header file for Doc
//
#ifndef ImpressionistDoc_h
#define ImpressionistDoc_h
#include "impressionist.h"
#include "bitmap.h"
#include "ImageUtils.h"
class ImpressionistUI;
class Bayesian;
class ImpressionistDoc
{
public:
ImpressionistDoc();
void setUI(ImpressionistUI* ui); // Assign the UI to use
int loadImage(char* iname); // called by the UI to load image
int loadImageFromData(unsigned char* dataPtr, int width, int height);
int loadAnotherImage(char* iname);
int loadMuralImage(char* iname);
int loadAlphaMap(char* iname);
int saveImage(char* iname); // called by the UI to save image
int clearCanvas(); // called by the UI to clear the drawing canvas
void setBrushType(int type); // called by the UI to set the brushType
int getSize(); // get the UI size
void setSize(int size); // set the UI size
int getLineWidth();
int getLineAngle();
double getAlpha();
char* getImageName(); // get the current image name
void setDirectionType(int type);
void undo();
void swapContent();
void recordHistory();
void autoFill();
int getEdgeThreshold();
void runBayesian();
// Attributes
public:
// Dimensions of original window.
int m_nWidth,
m_nHeight;
// Dimensions of the paint window.
int m_nPaintWidth,
m_nPaintHeight;
// Bitmaps for original image and painting.
unsigned char* m_ucBitmap;
unsigned char* m_ucOriginal;
unsigned char* m_ucPainting;
unsigned char* m_ucEdge;
unsigned char* m_ucAlphaMap;
ImageWrapper<unsigned char> viewport{ nullptr, {0,0} };
static double viewportTracerRatio;
// The current active brush.
ImpBrush* m_pCurrentBrush;
// Size of the brush.
int m_nSize;
ImpressionistUI* m_pUI;
Bayesian* m_bayesian;
unsigned char* m_ucHistory; //for undo
unsigned char* m_ucAnother; //for another image
unsigned char *m_ucBackup = NULL;
int m_alphaMapWidth;
int m_alphaMapHeight;
// Operations
public:
// Get the color of the original picture at the specified coord
GLubyte* GetOriginalPixel(int x, int y);
double GetAlpha(int x, int y);
GLubyte* GetAnotherPixel(int x, int y);
bool IsEdge(int x, int y);
// Get the color of the original picture at the specified point
GLubyte* GetOriginalPixel(const Point p);
GLubyte* GetAnotherPixel(const Point p);
bool IsEdge(const Point p);
private:
char m_imageName[256];
};
extern void MessageBox(char* message);
#endif