tavli
view src/image.h @ 24:0aadb519b5ee
correct highlighting
author | John Tsiombikas <nuclear@member.fsf.org> |
---|---|
date | Wed, 08 Jul 2015 15:11:58 +0300 |
parents | c2a2069a49ec |
children |
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, float a = 255);
34 void clear_image_alpha(Image *img, float a);
36 enum ImgCombine {
37 IMG_OP_ADD,
38 IMG_OP_SUB,
39 IMG_OP_MUL,
40 IMG_OP_LERP
41 };
43 bool combine_image(Image *dest, const Image *aimg, const Image *bimg, ImgCombine op = IMG_OP_LERP, float t = 0.5);
45 void convolve_horiz_image(Image *dest, float *kern, int ksz, float scale = 0.0);
46 void convolve_vert_image(Image *dest, float *kern, int ksz, float scale = 0.0);
48 #endif // IMAGE_H_