00001
00002 #include <stdio.h>
00003 #include <stdlib.h>
00004 #include "video.h"
00005 #include "termlib.h"
00006
00007 SBUF *dv_save(int l,int r,int t,int b )
00008 {
00009
00010
00011
00012
00013
00014
00015 int ysize, xsize, x, y ;
00016 IMAGEP p;
00017 SBUF *sbuf;
00018
00019 xsize = (r - l) + 1;
00020 ysize = (b - t) + 1;
00021
00022 if( !(sbuf = (SBUF *) malloc(sizeof(SBUF)) ))
00023 {
00024
00025
00026 }
00027 if( !(p = (IMAGEP) IMALLOC(xsize * ysize * sizeof(WORD))))
00028 {
00029
00030
00031 }
00032
00033 sbuf->left = l;
00034 sbuf->right = r;
00035 sbuf->top = t;
00036 sbuf->bottom = b;
00037 sbuf->image = p;
00038
00039 for( y = 0; y < ysize ; ++y )
00040 for( x = 0; x < xsize ; ++x )
00041 *p++ = *VSCREEN[ y + t ][ x + l ];
00042
00043 return sbuf;
00044 }