00001 #ifndef POLYGON_H_ 00002 #define POLYGON_H_ 00003 00004 #include <string.h> 00005 00006 template<typename Pixel> 00007 class Bitmap 00008 { 00009 public: 00010 int width, height, extra; 00011 Pixel *data; 00012 00013 Bitmap(int e = 0) : width(0), height(0), extra(e), data(NULL) { } 00014 ~Bitmap() { delete[] data; } 00015 00016 void size(int w,int h) 00017 { 00018 delete[] data; 00019 width = w; 00020 height = h; 00021 data = new Pixel[w*h+extra]; 00022 clear(); 00023 } 00024 00025 void clear() 00026 { 00027 memset(data,0,sizeof(Pixel)*(width*height+extra)); 00028 } 00029 }; 00030 #endif