#include typedef unsigned char BYTE; class image { class rgb { public: BYTE r,g,b; /* 0..255 */ rgb(BYTE rr, BYTE gg, BYTE bb) : r(rr),g(gg),b(bb) { } rgb() { } }; void rgbscale(rgb &dest, const rgb &L, const rgb &R, double pos) const { dest.r = BYTE(L.r * (1-pos) + R.r * pos); dest.g = BYTE(L.g * (1-pos) + R.g * pos); dest.b = BYTE(L.b * (1-pos) + R.b * pos); } rgb rgbscale(const rgb &L, const rgb &R, double pos) const { return rgb(L.r * (1-pos) + R.r * pos, L.g * (1-pos) + R.g * pos, L.b * (1-pos) + R.b * pos); } inline double frac(double x) const { return x-(int)x; } public: unsigned Xsize, Ysize; vector pix; image(unsigned x, unsigned y) : Xsize(x), Ysize(y), pix(x*y) { } void Scaleto(unsigned newX, unsigned newY) { image tmp(newX, newY); double Ystep = (double)newY / Ysize; double Xstep = (double)newX / Xsize; double Ys = 0; for(unsigned y=0; y