#ifndef IMG_H
#define IMG_H
#include "xmain.h"
typedef struct {
union { struct { unsigned char r, g, b, a; };
struct { unsigned char c[4]; }; };
} Color;
typedef struct {
int w, h;
Color *data;
} Image;
static inline int imgValid(Image img) { return img.data && img.w > 0 && img.h > 0; }
Image imgCreate(int w, int h);
void imgFree(Image *img);
Image imgCopy(Image img);
Image imgSub(Image img, int x, int y, int w, int h);
void imgClear(Image img);
void imgMultA(Image img);
void imgDivA(Image img);
int imgVisible(Image img);
int imgHasPicture(Image img);
Image imgResampleX(Image img, int w);
Image imgResampleY(Image img, int h);
Image imgResample(Image img, int w, int h);
XImage* imgToX(Image *img);
Image imgLoadTga(const char *filename);
#endif