vrshoot
view src/image.h @ 3:c179c72369be
rename candy->vr
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Mon, 03 Feb 2014 08:52:13 +0200 |
parents | |
children |
line source
1 #ifndef IMAGE_H_
2 #define IMAGE_H_
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 };
15 private:
16 Format fmt;
17 int width, height;
18 void *pixels;
20 public:
21 Image();
22 ~Image();
24 int get_width() const;
25 int get_height() const;
27 Format get_format() const;
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;
35 void flip_horizontal();
36 void flip_vertical();
37 void rotate_180();
39 bool load(const char *fname);
40 bool save(const char *fname) const;
41 };
43 #endif // IMAGE_H_