version 1.7, 2000/11/09 02:30:45 |
version 1.8, 2001/08/22 09:19:21 |
|
|
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE, |
* PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE. |
* 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 "ca.h" |
#include "parse.h" |
#include "parse.h" |
Line 88 struct canvas *can; |
|
Line 88 struct canvas *can; |
|
flush(); |
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<width-1; ix++ ) |
|
for(iy=0, px=tab[ix], px1 = tab[ix+1], px2 = px+1; |
|
iy<height-1 ;iy++, px++, px1++, px2++ ) |
|
if ( ((*px >= 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) |
con_print(display,tab,can) |
DISPLAY *display; |
DISPLAY *display; |
double **tab; |
double **tab; |
Line 136 struct canvas *can; |
|
Line 166 struct canvas *can; |
|
count_and_flush(); |
count_and_flush(); |
} |
} |
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<width-1; ix++ ) |
|
for(iy=0, px=tab[ix], px1 = tab[ix+1], px2 = px+1; |
|
iy<height-1 ;iy++, px++, px1++, px2++ ) |
|
if ( ((*px >= 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) |
qif_print(display,tab,can) |