goat3dgfx

annotate src/image.h @ 34:3eb6c8f89fe1

merge
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 02 Mar 2014 17:41:10 +0200
parents 3d96734fd477
children
rev   line source
nuclear@0 1 #ifndef IMAGE_H_
nuclear@0 2 #define IMAGE_H_
nuclear@0 3
nuclear@15 4 namespace goatgfx {
nuclear@0 5
nuclear@0 6 class Image {
nuclear@0 7 public:
nuclear@0 8 enum Format {
nuclear@0 9 FMT_GREY,
nuclear@0 10 FMT_RGB,
nuclear@0 11 FMT_RGBA,
nuclear@0 12 FMT_GREY_FLOAT,
nuclear@0 13 FMT_RGB_FLOAT,
nuclear@0 14 FMT_RGBA_FLOAT
nuclear@0 15 };
nuclear@0 16
nuclear@0 17 private:
nuclear@0 18 Format fmt;
nuclear@0 19 int width, height;
nuclear@0 20 void *pixels;
nuclear@0 21
nuclear@0 22 public:
nuclear@0 23 Image();
nuclear@0 24 ~Image();
nuclear@0 25
nuclear@0 26 int get_width() const;
nuclear@0 27 int get_height() const;
nuclear@0 28
nuclear@0 29 Format get_format() const;
nuclear@0 30
nuclear@0 31 bool create(int x, int y, Format fmt = FMT_RGBA);
nuclear@6 32 bool set_pixels(int xsz, int ysz, void *pixels, Format fmt = FMT_RGBA);
nuclear@6 33 bool set_pixels(int xsz, int ysz, void *pixels, int scan_width, Format fmt = FMT_RGBA);
nuclear@6 34 bool set_pixels(int xsz, int ysz, void *pixels, int x, int y, int scan_width = -1, Format fmt = FMT_RGBA);
nuclear@0 35 void *get_pixels() const;
nuclear@0 36
nuclear@6 37 void flip_horizontal();
nuclear@6 38 void flip_vertical();
nuclear@6 39 void rotate_180();
nuclear@6 40
nuclear@0 41 bool load(const char *fname);
nuclear@0 42 bool save(const char *fname) const;
nuclear@0 43 };
nuclear@0 44
nuclear@15 45 } // namespace goatgfx
nuclear@15 46
nuclear@0 47 #endif // IMAGE_H_