#ifndef IMAGEINFO_H #define IMAGEINFO_H #define FOUR_BYTES long // The convention is that ImageInfo does not own the pixels, so // does not delete this memory. Its just a pointer to the real data. class ImageInfo { public: FOUR_BYTES *pixels; short xsize; short ysize; public: ImageInfo(); ImageInfo(FOUR_BYTES *pixels, short xsize, short ysize); inline char &r(int x, int y) { return *(((char *)(pixels+xsize*y+x))+3); } inline char &g(int x, int y) { return *(((char *)(pixels+xsize*y+x))+2); } inline char &b(int x, int y) { return *(((char *)(pixels+xsize*y+x))+1); } inline char &a(int x, int y) { return *(((char *)(pixels+xsize*y+x))+0); } inline FOUR_BYTES &pix(int x, int y) { return *(pixels+xsize*y+x); } }; #endif