=================================================================== RCS file: /home/cvs/OpenXM_contrib2/asir2000/plot/plotp.c,v retrieving revision 1.7 retrieving revision 1.8 diff -u -p -r1.7 -r1.8 --- OpenXM_contrib2/asir2000/plot/plotp.c 2000/11/09 02:30:45 1.7 +++ OpenXM_contrib2/asir2000/plot/plotp.c 2001/08/22 09:19:21 1.8 @@ -45,7 +45,7 @@ * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. * - * $OpenXM: OpenXM_contrib2/asir2000/plot/plotp.c,v 1.6 2000/11/09 01:51:13 noro Exp $ + * $OpenXM: OpenXM_contrib2/asir2000/plot/plotp.c,v 1.7 2000/11/09 02:30:45 noro Exp $ */ #include "ca.h" #include "parse.h" @@ -88,6 +88,36 @@ struct canvas *can; flush(); } +#define MEMORY_DRAWPOINT(a,len,x,y) (((a)[(len)*(y)+((x)>>3)]) |= (1<<((x)&7))) + +memory_if_print(tab,can,bytes) +double **tab; +struct canvas *can; +BYTEARRAY *bytes; +{ + int ix,iy,width,height; + double *px,*px1,*px2; + unsigned char *array; + int scan_len; + + if ( can->mode == MODE_CONPLOT ) { + memory_con_print(tab,can,bytes); return; + } + width = can->width; height = can->height; + + /* scan_len = byte length of the scan line */ + scan_len = (width+7)/8; + MKBYTEARRAY(*bytes,scan_len*height); + array = BDY(*bytes); + for( ix=0; ix= 0) && ((*px1 <= 0) || (*px2 <= 0))) || + ((*px <= 0) && ((*px1 >= 0) || (*px2 >= 0))) ) { + MEMORY_DRAWPOINT(array,scan_len,ix,height-iy-1); + } +} + con_print(display,tab,can) DISPLAY *display; double **tab; @@ -136,6 +166,55 @@ struct canvas *can; count_and_flush(); } flush(); +} + +memory_con_print(tab,can,bytes) +double **tab; +struct canvas *can; +BYTEARRAY *bytes; +{ + int ix,iy,iz,width,height,pas,pai,len; + double zstep,z; + double *px,*px1,*px2; + POINT *pa,*pa1; + struct pa *parray; + unsigned char *array; + int scan_len; + + width = can->width; height = can->height; + zstep = (can->zmax-can->zmin)/can->nzstep; + can->pa = (struct pa *)MALLOC((can->nzstep+1)*sizeof(struct pa)); + pas = width; + pa = (POINT *)ALLOCA(pas*sizeof(POINT)); + for ( z = can->zmin, iz = 0; z <= can->zmax; z += zstep, iz++ ) { + pai = 0; + for( ix=0; ix= z) && ((*px1 <= z) || (*px2 <= z))) || + ((*px <= z) && ((*px1 >= z) || (*px2 >= z))) ) { + if ( pai == pas ) { + pa1 = (POINT *)ALLOCA(2*pas*sizeof(POINT)); + bcopy((char *)pa,(char *)pa1,pas*sizeof(POINT)); pa = pa1; + pas += pas; + } + XC(pa[pai]) = ix; YC(pa[pai]) = height-iy-1; pai++; + } + can->pa[iz].length = pai; + if ( pai ) { + pa1 = (POINT *)MALLOC(pai*sizeof(POINT)); + bcopy((char *)pa,(char *)pa1,pai*sizeof(POINT)); + can->pa[iz].pos = pa1; + } + } + /* scan_len = byte length of the scan line */ + scan_len = (width+7)/8; + MKBYTEARRAY(*bytes,scan_len*height); + array = BDY(*bytes); + for ( parray = can->pa, iz = 0; iz <= can->nzstep; iz++, parray++ ) + for ( pa = parray->pos, len = parray->length, ix = 0; ix < len; ix++ ) { + MEMORY_DRAWPOINT(array,scan_len,XC(pa[ix]),YC(pa[ix])); + } } qif_print(display,tab,can)