48 |
|
return(-1); |
49 |
|
} |
50 |
|
/* discard header */ |
51 |
< |
getheader(input, NULL); |
51 |
> |
if (checkheader(input, COLRFMT, NULL) < 0) { |
52 |
> |
fprintf(stderr, "%s: not a Radiance picture\n", fname); |
53 |
> |
return(-1); |
54 |
> |
} |
55 |
|
/* get picture dimensions */ |
56 |
|
if (fgetresolu(&xres, &yres, input) != (YMAJOR|YDECR)) { |
57 |
|
fprintf(stderr, "%s: bad picture size\n", fname); |
70 |
|
for (i = yres-1; i >= 0; i--) { |
71 |
|
if (freadcolrs(scanline, xres, input) < 0) |
72 |
|
return(-1); |
73 |
< |
normscan(scanline, xres); |
73 |
> |
normcolrs(scanline, xres, 0); |
74 |
|
plotscan(scanline, xres, i); |
75 |
|
} |
76 |
|
|
79 |
|
fclose(input); |
80 |
|
|
81 |
|
return(0); |
79 |
– |
} |
80 |
– |
|
81 |
– |
|
82 |
– |
normscan(scan, len) /* normalize a scanline */ |
83 |
– |
register COLR scan[]; |
84 |
– |
int len; |
85 |
– |
{ |
86 |
– |
register int i; |
87 |
– |
|
88 |
– |
for (i = 0; i < len; i++) |
89 |
– |
colr_norm(scan[i], scan[i]); |
82 |
|
} |
83 |
|
|
84 |
|
|