| 16 |
|
|
| 17 |
|
#include "color.h" |
| 18 |
|
|
| 19 |
+ |
#include "resolu.h" |
| 20 |
+ |
|
| 21 |
|
extern char *malloc(); |
| 22 |
|
extern float *matchlamp(); |
| 23 |
|
|
| 51 |
|
|
| 52 |
|
char *lampdat = "lamp.tab"; /* lamp data file */ |
| 53 |
|
|
| 54 |
+ |
int order; /* scanline ordering of input */ |
| 55 |
|
int xres, yres; /* resolution of input */ |
| 56 |
|
double inpaspect = 1.0; /* pixel aspect ratio of input */ |
| 57 |
|
int correctaspect = 0; /* aspect ratio correction? */ |
| 241 |
|
/* add new header info. */ |
| 242 |
|
printargs(i, argv, stdout); |
| 243 |
|
/* get picture size */ |
| 244 |
< |
if (fgetresolu(&xres, &yres, fin) != (YMAJOR|YDECR)) { |
| 244 |
> |
if ((order = fgetresolu(&xres, &yres, fin)) < 0) { |
| 245 |
|
fprintf(stderr, "%s: bad picture size\n", progname); |
| 246 |
|
quit(1); |
| 247 |
|
} |
| 248 |
+ |
if (!(order & YMAJOR)) |
| 249 |
+ |
inpaspect = 1.0/inpaspect; |
| 250 |
|
/* compute output resolution */ |
| 251 |
|
if (ncols <= 0) |
| 252 |
|
ncols = x_c*xres + .5; |
| 424 |
|
} |
| 425 |
|
/* record pixel aspect ratio */ |
| 426 |
|
if (!correctaspect) { |
| 427 |
< |
d = x_c / y_r; |
| 427 |
> |
d = order & YMAJOR ? x_c/y_r : y_r/x_c ; |
| 428 |
|
if (!FEQ(d,1.0)) |
| 429 |
|
fputaspect(d, stdout); |
| 430 |
|
} |
| 440 |
|
fputcolcor(ctmp, stdout); |
| 441 |
|
printf("\n"); |
| 442 |
|
/* write out resolution */ |
| 443 |
< |
fputresolu(YMAJOR|YDECR, ncols, nrows, stdout); |
| 443 |
> |
fputresolu(order, ncols, nrows, stdout); |
| 444 |
|
} |
| 445 |
|
|
| 446 |
|
|