8 |
|
* 8/22/88 Adapted from ra_pr.c |
9 |
|
*/ |
10 |
|
|
11 |
– |
#include <stdio.h> |
12 |
– |
#include <string.h> |
13 |
– |
#include <time.h> |
11 |
|
#include <math.h> |
15 |
– |
|
12 |
|
#include "platform.h" |
13 |
+ |
#include "rtio.h" |
14 |
|
#include "rtmisc.h" |
15 |
|
#include "color.h" |
16 |
|
#include "resolu.h" |
30 |
|
extern int samplefac; |
31 |
|
double gamv = 2.2; /* gamv correction */ |
32 |
|
int bradj = 0; /* brightness adjustment */ |
36 |
– |
char *progname; |
33 |
|
char errmsg[128]; |
34 |
|
COLR *inl; |
35 |
|
uby8 *tarData; |
60 |
|
int ncolors = 256; |
61 |
|
int greyscale = 0; |
62 |
|
int i; |
63 |
+ |
|
64 |
|
SET_DEFAULT_BINARY(); |
65 |
|
SET_FILE_BINARY(stdin); |
66 |
|
SET_FILE_BINARY(stdout); |
67 |
< |
progname = argv[0]; |
67 |
> |
fixargv0(argv[0]); |
68 |
|
samplefac = 0; |
69 |
|
|
70 |
|
for (i = 1; i < argc; i++) |
151 |
|
|
152 |
|
static int |
153 |
|
getint2( /* get a 2-byte positive integer */ |
154 |
< |
register FILE *fp |
154 |
> |
FILE *fp |
155 |
|
) |
156 |
|
{ |
157 |
< |
register int b1, b2; |
157 |
> |
int b1, b2; |
158 |
|
|
159 |
|
if ((b1 = getc(fp)) == EOF || (b2 = getc(fp)) == EOF) |
160 |
|
quiterr("read error"); |
165 |
|
|
166 |
|
static void |
167 |
|
putint2( /* put a 2-byte positive integer */ |
168 |
< |
register int i, |
169 |
< |
register FILE *fp |
168 |
> |
int i, |
169 |
> |
FILE *fp |
170 |
|
) |
171 |
|
{ |
172 |
|
putc(i&0xff, fp); |
188 |
|
|
189 |
|
|
190 |
|
void |
191 |
< |
eputs(s) |
195 |
< |
char *s; |
191 |
> |
eputs(const char *s) |
192 |
|
{ |
193 |
|
fputs(s, stderr); |
194 |
|
} |
195 |
|
|
196 |
|
|
197 |
|
void |
198 |
< |
quit(code) |
203 |
< |
int code; |
198 |
> |
quit(int code) |
199 |
|
{ |
200 |
|
exit(code); |
201 |
|
} |
205 |
|
getthead( /* read header from input */ |
206 |
|
struct hdStruct *hp, |
207 |
|
char *ip, |
208 |
< |
register FILE *fp |
208 |
> |
FILE *fp |
209 |
|
) |
210 |
|
{ |
211 |
|
int nidbytes; |
240 |
|
putthead( /* write header to output */ |
241 |
|
struct hdStruct *hp, |
242 |
|
char *ip, |
243 |
< |
register FILE *fp |
243 |
> |
FILE *fp |
244 |
|
) |
245 |
|
{ |
246 |
|
if (ip != NULL) |
268 |
|
|
269 |
|
static int |
270 |
|
getrhead( /* load RADIANCE input file header */ |
271 |
< |
register struct hdStruct *h, |
271 |
> |
struct hdStruct *h, |
272 |
|
FILE *fp |
273 |
|
) |
274 |
|
{ |
309 |
|
} map; |
310 |
|
COLR ctab[256]; |
311 |
|
COLR *scanline; |
312 |
< |
register int i, j; |
312 |
> |
int i, j; |
313 |
|
|
314 |
|
/* get color table */ |
315 |
|
if ((hp->CMapBits==24 ? fread((char *)(map.c3+hp->mapOrig), |
356 |
|
) |
357 |
|
{ |
358 |
|
long fpos; |
359 |
< |
register int y; |
359 |
> |
int y; |
360 |
|
|
361 |
|
setcolrgam(gamv); |
362 |
|
fpos = ftell(stdin); |
405 |
|
) |
406 |
|
{ |
407 |
|
int y; |
408 |
< |
register uby8 *dp; |
409 |
< |
register int x; |
408 |
> |
uby8 *dp; |
409 |
> |
int x; |
410 |
|
|
411 |
|
setcolrgam(gamv); |
412 |
|
dp = tarData+xmax*ymax;; |
440 |
|
FILE *fp |
441 |
|
) |
442 |
|
{ |
443 |
< |
register int i, j; |
443 |
> |
int i, j; |
444 |
|
|
445 |
|
for (i = 0; i < h->mapLength; i++) /* write color map */ |
446 |
|
for (j = 2; j >= 0; j--) |
461 |
|
FILE *fp |
462 |
|
) |
463 |
|
{ |
464 |
< |
register int cnt, c; |
465 |
< |
register uby8 *dp; |
464 |
> |
int cnt, c; |
465 |
> |
uby8 *dp; |
466 |
|
|
467 |
|
if (h->dataType == IM_CMAP) { /* uncompressed */ |
468 |
|
if (fread((char *)data,h->x*sizeof(uby8),h->y,fp) != h->y) |