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