version 1.3, 2000/10/24 01:53:53 |
version 1.4, 2000/11/08 05:49:35 |
|
|
/* $OpenXM: OpenXM_contrib2/asir2000/plot/smoothing.c,v 1.2 2000/10/15 10:58:11 takayama Exp $ */ |
/* $OpenXM: OpenXM_contrib2/asir2000/plot/smoothing.c,v 1.3 2000/10/24 01:53:53 takayama Exp $ */ |
#include "ca.h" |
#include "ca.h" |
#include "parse.h" |
#include "parse.h" |
#include "ox.h" |
#include "ox.h" |
Line 44 static int updatePolyLine(struct polyLine *pl[], int p |
|
Line 44 static int updatePolyLine(struct polyLine *pl[], int p |
|
|
|
static void polyLine_outputPS_dashed_line(int x0,int y0,int x1,int y1); |
static void polyLine_outputPS_dashed_line(int x0,int y0,int x1,int y1); |
static int polyLine_pline(struct canvas *can); |
static int polyLine_pline(struct canvas *can); |
|
static int Strategy_generate_PS = 0; |
|
|
|
|
static void *gcmalloc(a) { |
static void *gcmalloc(a) { |
void *m; |
void *m; |
/* BUG: interruption must be locked. */ |
/* BUG: interruption must be locked. */ |
Line 352 generatePS_from_image(FILE *fp,XImage *image,int xsize |
|
Line 352 generatePS_from_image(FILE *fp,XImage *image,int xsize |
|
int *prev; |
int *prev; |
int *curr; |
int *curr; |
int i,x,y,c; |
int i,x,y,c; |
|
extern int Strategy_generate_PS; |
|
|
Xsize = xsize; |
Xsize = xsize; |
Ysize = ysize; |
Ysize = ysize; |
Line 360 generatePS_from_image(FILE *fp,XImage *image,int xsize |
|
Line 361 generatePS_from_image(FILE *fp,XImage *image,int xsize |
|
curr = (int *)gcmalloc(sizeof(int)*(Ysize+2)); |
curr = (int *)gcmalloc(sizeof(int)*(Ysize+2)); |
Fp = fp; |
Fp = fp; |
polyLine_outputProlog(0,0,Xsize,Ysize); |
polyLine_outputProlog(0,0,Xsize,Ysize); |
for (c=0; c<colorSize; c++) { |
switch(Strategy_generate_PS) { |
/* Set color if necessary */ |
case 1: |
for (i=0; i<= Ysize+1; i++) { |
for (c=0; c<colorSize; c++) { |
prev[i] = -1; |
/* Set color if necessary */ |
|
for (i=0; i<= Ysize+1; i++) { |
|
prev[i] = -1; |
|
} |
|
for (x=0; x<Xsize; x++) { |
|
curr[0] = curr[Ysize+1] = 0; |
|
for (y=0; y<Ysize; y++) { |
|
if ((int) XGetPixel(image,x,y) == color[c]) curr[y+1]=1; |
|
else curr[y+1] = 0; |
|
} |
|
plSize = updatePolyLine(pl,plSize,prev,curr,x); |
|
} |
|
for (y=0; y<Ysize+2; y++) { |
|
curr[y] = 0; |
|
} |
|
plSize = updatePolyLine(pl,plSize,prev,curr,Xsize); |
} |
} |
for (x=0; x<Xsize; x++) { |
break; |
curr[0] = curr[Ysize+1] = 0; |
default: |
for (y=0; y<Ysize; y++) { |
for (c=0; c<colorSize; c++) { |
if ((int) XGetPixel(image,x,y) == color[c]) curr[y+1]=1; |
/* Set color if necessary */ |
else curr[y+1] = 0; |
for (x=0; x<Xsize; x++) { |
|
for (y=0; y<Ysize; y++) { |
|
if ((int) XGetPixel(image,x,y) == color[c]){ |
|
fprintf(Fp," %d %d ", translateX(x),translateY(y) ); |
|
fprintf(Fp," ifplot_putpixel\n"); |
|
} |
|
} |
} |
} |
plSize = updatePolyLine(pl,plSize,prev,curr,x); |
|
} |
} |
for (y=0; y<Ysize+2; y++) { |
break; |
curr[y] = 0; |
|
} |
|
plSize = updatePolyLine(pl,plSize,prev,curr,Xsize); |
|
} |
} |
polyLine_pline(can); |
polyLine_pline(can); |
polyLine_outputEpilog(); |
polyLine_outputEpilog(); |