#include template struct Bitmap { Pixel *data; int width, height; Bitmap() : data(0) { }; ~Bitmap() { delete[] data; }; void size(int w,int h) { delete[] data; width = w; height = h; data = new Pixel[w*h+extra]; clear(); } void clear() { memset(data,0,sizeof(Pixel)*(width*height+extra)); } }; template struct PolygonEngine : public Bitmap { #define super (1<= height) return; if (x < 0) x = 0; if (x > width) x = width; data[x+y*width] += color; } /* Color is char[layers] */ // zwoosh, yknow, it goes... zwoosh an all these bars and lines and // crap intersect. Pixel colorTable[2][super+1]; void pen(Pixel color) { for(int i=0;i>16)&(super-1))], x>>(16+superSampleShift),y>>superSampleShift); add(colors[(x>>16)&(super-1)], 1+(x>>(16+superSampleShift)),y>>superSampleShift); x += slope; y++; } } void icon(double icon[][4],Pixel color,double x,double y, double scaleX, double scaleY) { pen(color); x *= super; y *= super; scaleX *= super; scaleY *= super; for(int i=0;icon[i][1] != icon[i][3];i++) line(int(icon[i][0]*scaleX+x),int(icon[i][1]*scaleY+y), int(icon[i][2]*scaleX+x),int(icon[i][3]*scaleY+y)); } #undef super };