14 |
|
#include "color.h" |
15 |
|
|
16 |
|
int xres, yres; /* input resolution */ |
17 |
+ |
double inpaspect = 1.0; /* input aspect ratio */ |
18 |
|
|
19 |
|
char buf[1<<20]; /* output buffer */ |
20 |
|
|
25 |
|
char *progname; |
26 |
|
|
27 |
|
|
28 |
+ |
headline(s) /* process line from header */ |
29 |
+ |
char *s; |
30 |
+ |
{ |
31 |
+ |
fputs(s, stdout); |
32 |
+ |
if (isaspect(s)) |
33 |
+ |
inpaspect *= aspectval(s); |
34 |
+ |
} |
35 |
+ |
|
36 |
+ |
|
37 |
|
main(argc, argv) |
38 |
|
int argc; |
39 |
|
char *argv[]; |
54 |
|
fprintf(stderr, "%s: cannot open\n", argv[2]); |
55 |
|
exit(1); |
56 |
|
} |
57 |
< |
/* copy header */ |
58 |
< |
copyheader(fin, stdout); |
57 |
> |
/* transfer header */ |
58 |
> |
getheader(fin, headline); |
59 |
|
/* add new header info. */ |
60 |
+ |
if (inpaspect < .99 || inpaspect > 1.01) |
61 |
+ |
fputaspect(1./inpaspect/inpaspect, stdout); |
62 |
|
printf("%s\n\n", progname); |
63 |
|
/* get picture size */ |
64 |
|
if (fgetresolu(&xres, &yres, fin) != (YMAJOR|YDECR)) { |