9 |
|
*/ |
10 |
|
|
11 |
|
#include <stdio.h> |
12 |
+ |
#include <math.h> |
13 |
|
#ifdef MSDOS |
14 |
|
#include <fcntl.h> |
15 |
|
#endif |
18 |
|
|
19 |
|
extern char *malloc(); |
20 |
|
|
21 |
< |
double gamma = 2.2; /* gamma correction */ |
21 |
> |
double gamcor = 2.2; /* gamma correction */ |
22 |
|
|
23 |
|
int bradj = 0; /* brightness adjustment */ |
24 |
|
|
31 |
|
int argc; |
32 |
|
char *argv[]; |
33 |
|
{ |
34 |
+ |
extern long getint(); |
35 |
|
int reverse = 0; |
36 |
|
int i; |
37 |
|
|
41 |
|
if (argv[i][0] == '-') |
42 |
|
switch (argv[i][1]) { |
43 |
|
case 'g': /* gamma correction */ |
44 |
< |
gamma = atof(argv[++i]); |
44 |
> |
gamcor = atof(argv[++i]); |
45 |
|
break; |
46 |
|
case 'e': /* exposure adjustment */ |
47 |
|
if (argv[i+1][0] != '+' && argv[i+1][0] != '-') |
73 |
|
setmode(fileno(stdin), O_BINARY); |
74 |
|
setmode(fileno(stdout), O_BINARY); |
75 |
|
#endif |
76 |
< |
setcolrgam(gamma); /* set up gamma correction */ |
76 |
> |
setcolrgam(gamcor); /* set up gamma correction */ |
77 |
|
if (reverse) { |
78 |
|
/* get their image resolution */ |
79 |
< |
fread((char *)&xmax, sizeof(int), 1, stdin); |
80 |
< |
fread((char *)&ymax, sizeof(int), 1, stdin); |
79 |
> |
xmax = getint(4, stdin); |
80 |
> |
ymax = getint(4, stdin); |
81 |
|
/* put our header */ |
82 |
|
printargs(i, argv, stdout); |
83 |
|
fputformat(COLRFMT, stdout); |
91 |
|
fgetresolu(&xmax, &ymax, stdin) < 0) |
92 |
|
quiterr("bad picture format"); |
93 |
|
/* write their header */ |
94 |
< |
fwrite((char *)&xmax, sizeof(int), 1, stdout); |
95 |
< |
fwrite((char *)&ymax, sizeof(int), 1, stdout); |
94 |
> |
putint((long)xmax, 4, stdout); |
95 |
> |
putint((long)ymax, 4, stdout); |
96 |
|
/* convert file */ |
97 |
|
ra2avs(); |
98 |
|
} |