-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.h
64 lines (60 loc) · 1.29 KB
/
image.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
#ifndef IMAGE_H
#define IMAGE_H
#include <string.h>
#include <vector>
#include "polmap.h"
#include "pdistribn.h"
using namespace std;
#define EDGE -1
struct edge {
int x;
int y;
int max_max, max_min, min_min, min_max;
};
class Image {
friend class YUVImage;
public:
int getMaxValue() { return 255; }
int getWidth() { return width; }
int getHeight() { return height; }
// size%2==1
int get(Point p);
int get(int x, int y);
int getDir(int *x, int *y, int dir);
int getPointDir(int x, int y, int dir);
void set(Point p, int v);
void set(int x, int y, int v);
// PolMap *getPM() { return polmap; }
void getBlock(int x, int y, Image *block);
vector<edge> find_edges();
Image():/* polmap(0),*/ width(0), height(0), data(0) { }
Image(int _width, int _height, bool gen_polmap = false)
:// polmap(0),
width(_width),
height(_height)
{
data = new int[width*height];
memset(data, 0, sizeof(*data)*width*height);
// if (gen_polmap)
// polmap = new PolMap(this);
PDs = new PDistrib *[width*height];
}
~Image()
{
delete []data;
}
void setPD(int x, int y, PDistrib *pd)
{
PDs[y*width+x] = pd;
}
PDistrib *getPD(int x, int y)
{
return PDs[y*width+x];
}
private:
int width, height;
int *data;
// PolMap *polmap;
PDistrib **PDs;
};
#endif