tavli

annotate 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
rev   line source
nuclear@4 1 #ifndef IMAGE_H_
nuclear@4 2 #define IMAGE_H_
nuclear@4 3
nuclear@4 4 class Image {
nuclear@4 5 private:
nuclear@4 6 mutable int tex_width, tex_height;
nuclear@4 7 mutable unsigned int tex;
nuclear@4 8 mutable bool tex_valid;
nuclear@4 9
nuclear@4 10 public:
nuclear@4 11 int width, height;
nuclear@4 12 unsigned char *pixels;
nuclear@4 13
nuclear@4 14 Image();
nuclear@4 15 ~Image();
nuclear@4 16
nuclear@4 17 Image(const Image &img);
nuclear@4 18 Image &operator =(const Image &img);
nuclear@4 19
nuclear@4 20 bool create(int width, int height, unsigned char *pixels = 0);
nuclear@4 21 void destroy();
nuclear@4 22
nuclear@4 23 bool load(const char *fname);
nuclear@4 24
nuclear@4 25 unsigned int texture() const;
nuclear@4 26 int texture_width() const;
nuclear@4 27 int texture_height() const;
nuclear@4 28
nuclear@4 29 void invalidate_texture();
nuclear@4 30 };
nuclear@4 31
nuclear@4 32 void clear_image(Image *img);
nuclear@22 33 void clear_image(Image *img, float r, float g, float b, float a = 255);
nuclear@22 34 void clear_image_alpha(Image *img, float a);
nuclear@4 35
nuclear@4 36 enum ImgCombine {
nuclear@4 37 IMG_OP_ADD,
nuclear@4 38 IMG_OP_SUB,
nuclear@4 39 IMG_OP_MUL,
nuclear@4 40 IMG_OP_LERP
nuclear@4 41 };
nuclear@4 42
nuclear@4 43 bool combine_image(Image *dest, const Image *aimg, const Image *bimg, ImgCombine op = IMG_OP_LERP, float t = 0.5);
nuclear@4 44
nuclear@23 45 void convolve_horiz_image(Image *dest, float *kern, int ksz, float scale = 0.0);
nuclear@23 46 void convolve_vert_image(Image *dest, float *kern, int ksz, float scale = 0.0);
nuclear@23 47
nuclear@4 48 #endif // IMAGE_H_