-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathflimage.h
53 lines (33 loc) · 1.16 KB
/
flimage.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
// Authors: Unknown. Please, if you are the author of this file, or if you
// know who are the authors of this file, let us know, so we can give the
// adequate credits and/or get the adequate authorizations.
#ifndef _FLIMAGE_H_
#define _FLIMAGE_H_
#include <iostream>
#include <string>
class flimage {
private:
int width, height; // image size
float* p; // array of color levels: level of pixel (x,y) is p[y*width+x]
public:
//// Construction
flimage();
flimage(int w, int h);
flimage(int w, int h, float v);
flimage(int w, int h, float* v);
flimage(const flimage& im);
flimage& operator= (const flimage& im);
void create(int w, int h);
void create(int w, int h, float *v);
//// Destruction
void erase();
~flimage();
//// Get Basic Data
int nwidth() const {return width;} // image size
int nheight() const {return height;}
/// Access values
float* getPlane() {return p;} // return the adress of the array of values
float operator()(int x, int y) const {return p[ y*width + x ];} // acces to the (x,y) value
float& operator()(int x, int y) {return p[ y*width + x ];} // by value (for const images) and by reference
};
#endif