goat3dgfx

annotate 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
rev   line source
nuclear@0 1 #ifndef IMAGE_H_
nuclear@0 2 #define IMAGE_H_
nuclear@0 3
nuclear@0 4
nuclear@0 5 class Image {
nuclear@0 6 public:
nuclear@0 7 enum Format {
nuclear@0 8 FMT_GREY,
nuclear@0 9 FMT_RGB,
nuclear@0 10 FMT_RGBA,
nuclear@0 11 FMT_GREY_FLOAT,
nuclear@0 12 FMT_RGB_FLOAT,
nuclear@0 13 FMT_RGBA_FLOAT
nuclear@0 14 };
nuclear@0 15
nuclear@0 16 private:
nuclear@0 17 Format fmt;
nuclear@0 18 int width, height;
nuclear@0 19 void *pixels;
nuclear@0 20
nuclear@0 21 public:
nuclear@0 22 Image();
nuclear@0 23 ~Image();
nuclear@0 24
nuclear@0 25 int get_width() const;
nuclear@0 26 int get_height() const;
nuclear@0 27
nuclear@0 28 Format get_format() const;
nuclear@0 29
nuclear@0 30 bool create(int x, int y, Format fmt = FMT_RGBA);
nuclear@0 31 bool set_pixels(int x, int y, void *pixels, Format fmt = FMT_RGBA);
nuclear@0 32 void *get_pixels() const;
nuclear@0 33
nuclear@0 34 bool load(const char *fname);
nuclear@0 35 bool save(const char *fname) const;
nuclear@0 36 };
nuclear@0 37
nuclear@0 38 #endif // IMAGE_H_