9 |
|
*/ |
10 |
|
|
11 |
|
#include <stdio.h> |
12 |
+ |
#ifdef MSDOS |
13 |
+ |
#include <fcntl.h> |
14 |
+ |
#endif |
15 |
|
#include "color.h" |
16 |
|
#include "random.h" |
17 |
|
|
24 |
|
"0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ@+"; |
25 |
|
|
26 |
|
int wrongformat = 0; /* input in wrong format? */ |
27 |
< |
double pixaspect = 1.0; /* pixel aspect ratio */ |
27 |
> |
double pixaspect = 1.0; /* pixel aspect ratio */ |
28 |
|
|
29 |
|
int bradj = 0; /* brightness adjustment */ |
30 |
|
int ncopies = 1; /* number of copies */ |
33 |
|
|
34 |
|
int xmax, ymax; |
35 |
|
|
36 |
+ |
extern char *malloc(); |
37 |
|
|
38 |
+ |
|
39 |
|
headline(s) /* check header line */ |
40 |
|
char *s; |
41 |
|
{ |
82 |
|
exit(1); |
83 |
|
} |
84 |
|
if (i == argc-2 && freopen(argv[i+1], "w", stdout) == NULL) { |
85 |
< |
fprintf(stderr, "can't open output \"%s\"\n", |
85 |
> |
fprintf(stderr, "%s: can't open output \"%s\"\n", |
86 |
|
progname, argv[i+1]); |
87 |
|
exit(1); |
88 |
|
} |
89 |
+ |
#ifdef MSDOS |
90 |
+ |
setmode(fileno(stdin), O_BINARY); |
91 |
+ |
#endif |
92 |
|
/* get our header */ |
93 |
|
getheader(stdin, headline, NULL); |
94 |
|
if (wrongformat || fgetresolu(&xmax, &ymax, stdin) < 0) |
121 |
|
char *name; |
122 |
|
{ |
123 |
|
int landscape = 0; |
124 |
< |
double pwidth, pheight; |
125 |
< |
double iwidth, iheight; |
124 |
> |
double pwidth, pheight; |
125 |
> |
double iwidth, iheight; |
126 |
|
|
127 |
|
printf("%%!\n"); |
128 |
|
printf("%%%%Title: %s\n", name); |
198 |
|
printf("\t{ 0 1 %d { scanline exch\n", xmax-1); |
199 |
|
printf("\t\t{ decode currentfile read not {stop} if get\n"); |
200 |
|
printf("\tdup 0 lt {pop} {exit} ifelse } loop put } for\n"); |
201 |
< |
printf("} stopped {pop pop pop 0 string} {scanline} ifelse } def\n"); |
201 |
> |
printf("\t} stopped {pop pop pop 0 string} {scanline} ifelse\n"); |
202 |
> |
printf("} bind def\n"); |
203 |
|
} |
204 |
|
|
205 |
|
|
218 |
|
for (y = ymax-1; y >= 0; y--) { |
219 |
|
if (freadcolrs(scanin, xmax, stdin) < 0) |
220 |
|
quiterr("error reading Radiance picture"); |
221 |
< |
normcolrs(scanin, xmax, bradj); /* normalize */ |
221 |
> |
normcolrs(scanin, xmax, bradj); /* normalize */ |
222 |
|
for (x = 0; x < xmax; x++) { |
223 |
|
if (!(col++ & 0x3f)) |
224 |
|
putchar('\n'); |