Bitmap::Bitmap(int xsize, int ysize, const PixelFormat& pxf) { assert( xsize > 0 && ysize > 0 ); width = xsize; height = ysize; pitch = width * pxf.GetBytes(); format = pxf; image = new uint8[height*pitch]; }
void Bitmap::SetImage(int xsize, int ysize, const PixelFormat& pxf, void* i) { assert( xsize > 0 && ysize > 0 ); delete[] image; width = xsize; height = ysize; pitch = xsize * pxf.GetBytes(); format = pxf; image = reinterpret_cast<uint8*>(i); }