28 |
|
int nrows = 0; /* number of rows for output */ |
29 |
|
int ncols = 0; /* number of columns for output */ |
30 |
|
|
31 |
< |
double xrat = 1.0; /* ratio of input x size to output */ |
32 |
< |
double yrat = 1.0; /* ratio of input y size to output */ |
31 |
> |
double x_c = 1.0; /* ratio of output x size to input */ |
32 |
> |
double y_r = 1.0; /* ratio of output y size to input */ |
33 |
|
|
34 |
|
int singlepass = 0; /* true means skip first pass */ |
35 |
|
|
47 |
|
|
48 |
|
int xres, yres; /* resolution of input */ |
49 |
|
|
50 |
– |
double x_c, y_r; /* conversion factors */ |
51 |
– |
|
50 |
|
int xrad; /* x window size */ |
51 |
|
int yrad; /* y window size */ |
52 |
|
|
87 |
|
if (argv[i][0] == '-') |
88 |
|
switch (argv[i][1]) { |
89 |
|
case 'x': |
90 |
< |
if (argv[i][2] == '/') |
91 |
< |
xrat = atof(argv[++i]); |
92 |
< |
else |
93 |
< |
ncols = atoi(argv[++i]); |
90 |
> |
i++; |
91 |
> |
if (argv[i][0] == '/') { |
92 |
> |
x_c = 1.0/atof(argv[i]+1); |
93 |
> |
ncols = 0; |
94 |
> |
} else |
95 |
> |
ncols = atoi(argv[i]); |
96 |
|
break; |
97 |
|
case 'y': |
98 |
< |
if (argv[i][2] == '/') |
99 |
< |
yrat = atof(argv[++i]); |
100 |
< |
else |
101 |
< |
nrows = atoi(argv[++i]); |
98 |
> |
i++; |
99 |
> |
if (argv[i][0] == '/') { |
100 |
> |
y_r = 1.0/atof(argv[i]+1); |
101 |
> |
nrows = 0; |
102 |
> |
} else |
103 |
> |
nrows = atoi(argv[i]); |
104 |
|
break; |
105 |
|
case 'e': |
106 |
|
if (argv[i+1][0] == '+' || argv[i+1][0] == '-') |
192 |
|
quit(1); |
193 |
|
} |
194 |
|
if (ncols > 0) |
195 |
< |
xrat = (double)xres/ncols; |
195 |
> |
x_c = (double)ncols/xres; |
196 |
|
else |
197 |
< |
ncols = xres/xrat + .5; |
197 |
> |
ncols = x_c*xres + .5; |
198 |
|
if (nrows > 0) |
199 |
< |
yrat = (double)yres/nrows; |
199 |
> |
y_r = (double)nrows/yres; |
200 |
|
else |
201 |
< |
nrows = yres/yrat + .5; |
201 |
> |
nrows = y_r*yres + .5; |
202 |
|
|
203 |
|
if (singlepass) { |
204 |
|
/* skip exposure, etc. */ |
311 |
|
{ |
312 |
|
double e; |
313 |
|
register int i; |
312 |
– |
|
313 |
– |
x_c = (double)ncols/xres; |
314 |
– |
y_r = (double)nrows/yres; |
314 |
|
|
315 |
|
if (rad <= 0.0) { |
316 |
|
xrad = xres/ncols/2 + 1; |