goat3dgfx

view src/image.h @ 0:1873dfd13f2d

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Thu, 14 Nov 2013 05:27:09 +0200
parents
children 3d96734fd477
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 x, int y, void *pixels, Format fmt = FMT_RGBA);
32 void *get_pixels() const;
34 bool load(const char *fname);
35 bool save(const char *fname) const;
36 };
38 #endif // IMAGE_H_