void Screen::shrink(int reduc)
{
if((reduc<height)&&(reduc<width))
{
height=height/reduc;
width=width/reduc;
char *newpixels=new char[height*width];
//iterate the old block line by line
for ( int i = 0; i < width; i++)
{
memcpy( newpixels + (i*width), pixels + (i*width),width); //copy only the required amount of data
}
//delete the old data
delete []pixels;
pixels = newpixels;
}
}