tavli

view src/image.h @ 18:986c0b76513f

shadows, not completed
author John Tsiombikas <nuclear@member.fsf.org>
date Mon, 29 Jun 2015 01:29:36 +0300
parents
children c2a2069a49ec
line source
1 #ifndef IMAGE_H_
2 #define IMAGE_H_
4 class Image {
5 private:
6 mutable int tex_width, tex_height;
7 mutable unsigned int tex;
8 mutable bool tex_valid;
10 public:
11 int width, height;
12 unsigned char *pixels;
14 Image();
15 ~Image();
17 Image(const Image &img);
18 Image &operator =(const Image &img);
20 bool create(int width, int height, unsigned char *pixels = 0);
21 void destroy();
23 bool load(const char *fname);
25 unsigned int texture() const;
26 int texture_width() const;
27 int texture_height() const;
29 void invalidate_texture();
30 };
32 void clear_image(Image *img);
33 void clear_image(Image *img, float r, float g, float b);
35 enum ImgCombine {
36 IMG_OP_ADD,
37 IMG_OP_SUB,
38 IMG_OP_MUL,
39 IMG_OP_LERP
40 };
42 bool combine_image(Image *dest, const Image *aimg, const Image *bimg, ImgCombine op = IMG_OP_LERP, float t = 0.5);
44 #endif // IMAGE_H_