#ifndef __IMAGE_H__ #define __IMAGE_H__ #include #pragma pack(push,1) struct TGA_Header { char idlength; char colormaptype; char datatypecode; short colormaporigin; short colormaplength; char colormapdepth; short x_origin; short y_origin; short width; short height; char bitsperpixel; char imagedescriptor; }; #pragma pack(pop) struct TGAColor { union { struct { unsigned char b, g, r, a; }; unsigned char raw[4]; unsigned int val; }; int bytespp; TGAColor() : val(0), bytespp(1) { } TGAColor(unsigned char R, unsigned char G, unsigned char B, unsigned char A) : b(B), g(G), r(R), a(A), bytespp(4) { } TGAColor(int v, int bpp) : val(v), bytespp(bpp) { } TGAColor(const TGAColor &c) : val(c.val), bytespp(c.bytespp) { } TGAColor(const unsigned char *p, int bpp) : val(0), bytespp(bpp) { for (int i=0; i