added func_coaxial
[antikythera] / src / image.h
1 #ifndef IMAGE_H_
2 #define IMAGE_H_
3
4 class Image {
5 public:
6         enum Format {
7                 FMT_GREY,
8                 FMT_RGB,
9                 FMT_RGBA,
10                 FMT_GREY_FLOAT,
11                 FMT_RGB_FLOAT,
12                 FMT_RGBA_FLOAT
13         };
14
15 private:
16         Format fmt;
17         int width, height;
18         void *pixels;
19
20 public:
21         Image();
22         ~Image();
23
24         int get_width() const;
25         int get_height() const;
26
27         Format get_format() const;
28
29         bool create(int x, int y, Format fmt = FMT_RGBA);
30         bool set_pixels(int xsz, int ysz, void *pixels, Format fmt = FMT_RGBA);
31         bool set_pixels(int xsz, int ysz, void *pixels, int scan_width, Format fmt = FMT_RGBA);
32         bool set_pixels(int xsz, int ysz, void *pixels, int x, int y, int scan_width = -1, Format fmt = FMT_RGBA);
33         void *get_pixels() const;
34
35         void flip_horizontal();
36         void flip_vertical();
37         void rotate_180();
38
39         bool load(const char *fname);
40         bool save(const char *fname) const;
41 };
42
43 #endif  // IMAGE_H_