50 |
|
static long ncall = 0L; /* number of calls to getpictscan */ |
51 |
|
static long nread = 0L; /* number of scanlines read */ |
52 |
|
|
53 |
+ |
static int wrongformat = 0; |
54 |
+ |
|
55 |
|
SCAN *scanretire(); |
56 |
|
|
57 |
|
extern long ftell(); |
179 |
|
|
180 |
|
|
181 |
|
double |
182 |
< |
getviewpix(vh, vv) /* compute single view pixel */ |
182 |
> |
getviewpix(vh, vv, se) /* compute single view pixel */ |
183 |
|
int vh, vv; |
184 |
+ |
SPANERR *se; |
185 |
|
{ |
186 |
|
FVECT dir; |
187 |
|
float rt_buf[6]; |
188 |
|
double res; |
189 |
|
|
190 |
< |
if (compdir(dir, vh, vv) < 0) |
190 |
> |
if (compdir(dir, vh, vv, se) < 0) |
191 |
|
return(-1.0); |
192 |
|
npixinvw++; |
193 |
|
if ((res = pict_val(dir)) >= 0.0) |
214 |
|
float rt_buf[6*MAXPIX]; /* rtrace send/receive buffer */ |
215 |
|
register int n; /* number of pixels in buffer */ |
216 |
|
short buf_vh[MAXPIX]; /* pixel positions */ |
217 |
+ |
SPANERR sperr; |
218 |
|
FVECT dir; |
219 |
|
register int vh; |
220 |
|
|
223 |
|
fprintf(stderr, "%s: computing view span at %d...\n", |
224 |
|
progname, vv); |
225 |
|
#endif |
226 |
+ |
setspanerr(&sperr, vv); |
227 |
|
n = 0; |
228 |
|
for (vh = -hsize; vh <= hsize; vh++) { |
229 |
< |
if (compdir(dir, vh, vv) < 0) { /* off viewable region */ |
229 |
> |
if (compdir(dir, vh, vv, &sperr) < 0) { /* not in view */ |
230 |
|
vb[vh+hsize] = -1.0; |
231 |
|
continue; |
232 |
|
} |
292 |
|
getexpos(s) /* get exposure from header line */ |
293 |
|
char *s; |
294 |
|
{ |
295 |
+ |
char fmt[32]; |
296 |
+ |
|
297 |
|
if (isexpos(s)) |
298 |
|
exposure *= exposval(s); |
299 |
+ |
else if (isformat(s)) { |
300 |
+ |
formatval(fmt, s); |
301 |
+ |
wrongformat = strcmp(fmt, COLRFMT); |
302 |
+ |
} |
303 |
|
} |
304 |
|
|
305 |
|
|
306 |
|
open_pict(fn) /* open picture file */ |
307 |
|
char *fn; |
308 |
|
{ |
298 |
– |
register int i; |
299 |
– |
|
309 |
|
if ((pictfp = fopen(fn, "r")) == NULL) { |
310 |
|
fprintf("%s: cannot open\n", fn); |
311 |
|
exit(1); |
312 |
|
} |
313 |
|
exposure = 1.0; |
314 |
< |
getheader(pictfp, getexpos); |
315 |
< |
if (fgetresolu(&pxsiz, &pysiz, pictfp) != (YMAJOR|YDECR)) { |
316 |
< |
fprintf("%s: bad picture resolution\n", fn); |
314 |
> |
getheader(pictfp, getexpos, NULL); |
315 |
> |
if (wrongformat || |
316 |
> |
fgetresolu(&pxsiz, &pysiz, pictfp) != (YMAJOR|YDECR)) { |
317 |
> |
fprintf("%s: bad picture format\n", fn); |
318 |
|
exit(1); |
319 |
|
} |
320 |
|
initscans(); |
323 |
|
|
324 |
|
close_pict() /* done with picture */ |
325 |
|
{ |
316 |
– |
register int i; |
317 |
– |
|
326 |
|
if (pictfp == NULL) |
327 |
|
return; |
328 |
|
fclose(pictfp); |