#ifndef _GImageComponent_H #define _GImageComponent_H /* Class which describes a single colour channel of an image in a generalized * way allowing for easy and accurate scaling to any size. * * Written by: Chris Studholme * Last Update: 10-January-2000 * Copyright: GPL (http://www.fsf.org/copyleft/gpl.html) */ #include class GImageComponent { /* * General function is piecewise quasi-linear function with pieces of: * f(x,y) = alpha*x + beta*y + gamma*x*y + omega, x,y e [0,1] * * The image coordinate system is (x,y) for x,y e [0,1], where (0,0) is top * left. * * This class is abstract. Only instanciate a derived class. */ protected: int w,h; short *tl; float maxerror; double totalerror; public: GImageComponent(int width, int height, float maxerror=0); virtual ~GImageComponent() { delete[] tl; } inline double getTotalError() { return totalerror; } int getWidth() { return w; } int getHeight() { return h; } const short* getPointArray() { return tl; } /* x1tl[i]) result=tl[i]; return 128+((float)result)/128; } float getMeanValue() { float result=0; for (int i=0; i