#ifndef MOSAIC_H #define MOSAIC_H // Basically we just have an image, but then we keep an // Offset, which tells us where to find the coords (0,0) in // the image. This way we can intelligently add something at // (10,10) and (100,100) overlaping as they should. class Mosaic { public: /*private*/ float *red; float *green; float *blue; float *alpha; int xSize, ySize; // number of elements ; xmax-xmin+1 int xmin, xmax, ymin, ymax; // first and last element public: Mosaic(); Mosaic(int xmin, int xmax, int ymin, int ymax); virtual ~Mosaic(); // Convenience for pixel reference inline float &r(long x, long y) { return *(red+xSize*(y-ymin)+x-xmin); } inline float &g(long x, long y) { return *(green+xSize*(y-ymin)+x-xmin); } inline float &b(long x, long y) { return *(blue+xSize*(y-ymin)+x-xmin); } inline float &a(long x, long y) { return *(alpha+xSize*(y-ymin)+x-xmin); } // Other Routines void normalizeAlpha(); // Routines from Matlab void mospad(Mosaic &mos); // Extend the range of a Mosaic void mospad(int xmin, int xmax, int ymin, int ymax); void mosadd(Mosaic &mos); }; #endif