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 */ |
33 |
+ |
|
34 |
|
int singlepass = 0; /* true means skip first pass */ |
35 |
|
|
36 |
|
int avghot = 0; /* true means average in bright spots */ |
89 |
|
if (argv[i][0] == '-') |
90 |
|
switch (argv[i][1]) { |
91 |
|
case 'x': |
92 |
< |
ncols = atoi(argv[++i]); |
92 |
> |
if (argv[i][2] == '/') |
93 |
> |
xrat = atof(argv[++i]); |
94 |
> |
else |
95 |
> |
ncols = atoi(argv[++i]); |
96 |
|
break; |
97 |
|
case 'y': |
98 |
< |
nrows = atoi(argv[++i]); |
98 |
> |
if (argv[i][2] == '/') |
99 |
> |
yrat = atof(argv[++i]); |
100 |
> |
else |
101 |
> |
nrows = atoi(argv[++i]); |
102 |
|
break; |
103 |
|
case 'e': |
104 |
|
if (argv[i+1][0] == '+' || argv[i+1][0] == '-') |
189 |
|
fprintf(stderr, "%s: bad picture size\n", progname); |
190 |
|
quit(1); |
191 |
|
} |
192 |
< |
if (ncols <= 0) |
193 |
< |
ncols = xres; |
194 |
< |
if (nrows <= 0) |
195 |
< |
nrows = yres; |
192 |
> |
if (ncols > 0) |
193 |
> |
xrat = (double)xres/ncols; |
194 |
> |
else |
195 |
> |
ncols = xres/xrat + .5; |
196 |
> |
if (nrows > 0) |
197 |
> |
yrat = (double)yres/nrows; |
198 |
> |
else |
199 |
> |
nrows = yres/yrat + .5; |
200 |
|
|
201 |
|
if (singlepass) { |
202 |
|
/* skip exposure, etc. */ |