add xres and yres
implement copyrect and replacerect