19 |
|
#define UPPER(c) ((c)&~0x20) /* ASCII trick */ |
20 |
|
|
21 |
|
#define CODE6GAM 1.47 /* gamma for 6-bit codes */ |
22 |
< |
#define DEFDGAM 1.0 /* default device gamma */ |
22 |
> |
#define DEFGGAM 1.0 /* greyscale device gamma */ |
23 |
> |
#define DEFCGAM 1.8 /* color device gamma */ |
24 |
|
|
25 |
|
#define GRY -1 /* artificial index for grey */ |
26 |
|
|
43 |
|
int wrongformat = 0; /* input in wrong format? */ |
44 |
|
double pixaspect = 1.0; /* pixel aspect ratio */ |
45 |
|
|
46 |
< |
double devgam = DEFDGAM; /* device gamma response */ |
46 |
> |
double devgam = 0.; /* device gamma response */ |
47 |
|
double hmarg = DEFMARG, |
48 |
|
vmarg = DEFMARG; /* horizontal and vertical margins */ |
49 |
|
double width = DEFWIDTH, |
50 |
|
height = DEFHEIGHT; /* default paper width and height */ |
51 |
|
double dpi = 0; /* print density (0 if unknown) */ |
52 |
< |
int docolor = 0; /* produce color image? */ |
52 |
> |
int docolor = 1; /* produce color image? */ |
53 |
|
int bradj = 0; /* brightness adjustment */ |
54 |
|
int ncopies = 1; /* number of copies */ |
55 |
|
|
166 |
|
if (wrongformat || fgetresolu(&xmax, &ymax, stdin) < 0) |
167 |
|
quiterr("bad picture format"); |
168 |
|
/* gamma compression */ |
169 |
+ |
if (devgam <= 0.05) |
170 |
+ |
devgam = docolor ? DEFCGAM : DEFGGAM; |
171 |
|
if (putprim == Cputprim) |
172 |
|
setcolrgam(CODE6GAM); |
173 |
|
else if (devgam != 1.) |
174 |
|
setcolrgam(devgam); |
175 |
|
/* write header */ |
176 |
< |
PSheader(i <= argc-1 ? argv[i] : "<stdin>"); |
176 |
> |
PSheader(argc, argv); |
177 |
|
/* convert file */ |
178 |
|
ra2ps(); |
179 |
|
/* write trailer */ |
292 |
|
} |
293 |
|
|
294 |
|
|
295 |
< |
PSheader(name) /* print PostScript header */ |
296 |
< |
char *name; |
295 |
> |
PSheader(ac, av) /* print PostScript header */ |
296 |
> |
int ac; |
297 |
> |
char **av; |
298 |
|
{ |
299 |
|
char *rstr; |
300 |
|
int landscape, rotate, n; |
302 |
|
double iwidth, iheight; |
303 |
|
/* EPS comments */ |
304 |
|
puts("%!PS-Adobe-2.0 EPSF-2.0"); |
305 |
< |
printf("%%%%Title: %s\n", name); |
306 |
< |
printf("%%%%Creator: %s = %s\n", progname, SCCSid); |
305 |
> |
printf("%%%%Title: "); printargs(ac, av, stdout); |
306 |
> |
printf("%%%%Creator: %s\n", SCCSid); |
307 |
|
printf("%%%%Pages: %d\n", ncopies); |
308 |
|
if (landscape = xmax > pixaspect*ymax) |
309 |
|
puts("%%Orientation: Landscape"); |