goat3dgfx

view src/image.h @ 10:b4c9a24c946e

wrote an awesome configure script added "main" 3d engine source file with global init/cleanup
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 24 Nov 2013 13:30:44 +0200
parents 1873dfd13f2d
children 7d6b667821cf
line source
1 #ifndef IMAGE_H_
2 #define IMAGE_H_
5 class Image {
6 public:
7 enum Format {
8 FMT_GREY,
9 FMT_RGB,
10 FMT_RGBA,
11 FMT_GREY_FLOAT,
12 FMT_RGB_FLOAT,
13 FMT_RGBA_FLOAT
14 };
16 private:
17 Format fmt;
18 int width, height;
19 void *pixels;
21 public:
22 Image();
23 ~Image();
25 int get_width() const;
26 int get_height() const;
28 Format get_format() const;
30 bool create(int x, int y, Format fmt = FMT_RGBA);
31 bool set_pixels(int xsz, int ysz, void *pixels, Format fmt = FMT_RGBA);
32 bool set_pixels(int xsz, int ysz, void *pixels, int scan_width, Format fmt = FMT_RGBA);
33 bool set_pixels(int xsz, int ysz, void *pixels, int x, int y, int scan_width = -1, Format fmt = FMT_RGBA);
34 void *get_pixels() const;
36 void flip_horizontal();
37 void flip_vertical();
38 void rotate_180();
40 bool load(const char *fname);
41 bool save(const char *fname) const;
42 };
44 #endif // IMAGE_H_