1 |
+ |
#ifndef lint |
2 |
+ |
static const char RCSid[] = "$Id$"; |
3 |
+ |
#endif |
4 |
|
#include "pictool.h" |
5 |
|
#include "g3sphere.h" |
6 |
|
#include <math.h> |
7 |
< |
#include <string.h> |
7 |
> |
#include "rtio.h" |
8 |
|
|
9 |
|
#define index strchr |
10 |
|
|
87 |
|
} |
88 |
|
static int exp_headline(char* s,void* exparg) { |
89 |
|
double* exposure; |
90 |
+ |
if(strstr(s, EXPOSSTR) != NULL ) { |
91 |
+ |
fprintf(stderr,"EXP AND tab\n"); |
92 |
+ |
} |
93 |
|
|
94 |
|
exposure = (double*) exparg; |
95 |
|
if (isexpos(s)) { |
216 |
|
void *v |
217 |
|
) |
218 |
|
{ |
219 |
+ |
if(strstr(s, EXPOSSTR) != NULL && strstr(s, "\t") != NULL) { |
220 |
+ |
|
221 |
+ |
fprintf(stderr,"error: header contains invalid exposure entry!!!!\n"); |
222 |
+ |
fprintf(stderr,"check exposure and correct header setting !\n"); |
223 |
+ |
|
224 |
+ |
|
225 |
+ |
fprintf(stderr,"stopping !!!!\n"); |
226 |
+ |
exit(1); |
227 |
+ |
} |
228 |
|
if (isview(s) && sscanview(((struct hinfo*)v)->hv, s) > 0) { |
229 |
|
((struct hinfo*)v)->ok++; |
230 |
|
} else if (isexpos(s)) { |
277 |
|
return 1; |
278 |
|
} |
279 |
|
|
280 |
+ |
int pict_read_fp_noupdate(pict* p,FILE* fp) |
281 |
+ |
{ |
282 |
+ |
struct hinfo hi; |
283 |
+ |
int x,y,yy; |
284 |
+ |
|
285 |
+ |
|
286 |
+ |
hi.hv = &(p->view); |
287 |
+ |
hi.ok = 0; |
288 |
+ |
hi.exposure = 1; |
289 |
+ |
getheader(fp, gethinfo, &hi); |
290 |
+ |
/*fprintf(stderr,"expscale %f\n",hi.exposure); */ |
291 |
+ |
|
292 |
+ |
if (!(pict_update_view(p)) || !(hi.ok)) |
293 |
+ |
p->valid_view = 0; |
294 |
+ |
/* printf("dir %f %f %f\n",p->view.vdir[0],p->view.vdir[1],p->view.vdir[2]); */ |
295 |
+ |
if (fgetsresolu(&(p->resol),fp) < 0) { |
296 |
+ |
fprintf(stderr,"No resolution given\n"); |
297 |
+ |
return 0; |
298 |
+ |
} |
299 |
+ |
if (!(p->resol.rt & YMAJOR)) { |
300 |
+ |
x = p->resol.xr; |
301 |
+ |
p->resol.xr = p->resol.yr; |
302 |
+ |
p->resol.yr = x; |
303 |
+ |
p->resol.rt |= YMAJOR; |
304 |
+ |
} |
305 |
+ |
if (!pict_resize(p,p->resol.xr,p->resol.yr)) |
306 |
+ |
return 0; |
307 |
+ |
for(yy=0;yy<p->resol.yr;yy++) { |
308 |
+ |
y = (p->resol.rt & YDECR) ? p->resol.yr - 1 - yy : yy; |
309 |
+ |
if (freadscan((p->pic + y*p->resol.xr),p->resol.xr,fp) < 0) { |
310 |
+ |
fprintf(stderr,"error reading line %d\n",y); |
311 |
+ |
return 0; |
312 |
+ |
} |
313 |
+ |
for(x=0;x<p->resol.xr;x++) { |
314 |
+ |
scalecolor(pict_get_color(p,x,y),1.0/hi.exposure); |
315 |
+ |
} |
316 |
+ |
} |
317 |
+ |
return 1; |
318 |
+ |
} |
319 |
+ |
|
320 |
+ |
|
321 |
+ |
|
322 |
+ |
|
323 |
|
#ifdef PICT_GLARE |
324 |
|
void pict_update_evalglare_caches(pict* p) |
325 |
|
{ |
357 |
|
return 1; |
358 |
|
} |
359 |
|
|
360 |
+ |
int pict_read_noupdate(pict* p,char* fn) |
361 |
+ |
{ |
362 |
+ |
FILE* fp; |
363 |
+ |
|
364 |
+ |
if (!(fp = fopen(fn,"rb"))) { |
365 |
+ |
fprintf(stderr,"Can't open %s\n",fn); |
366 |
+ |
return 0; |
367 |
+ |
} |
368 |
+ |
if (!(pict_read_fp_noupdate(p,fp))) |
369 |
+ |
return 0; |
370 |
+ |
fclose(fp); |
371 |
+ |
return 1; |
372 |
+ |
} |
373 |
+ |
|
374 |
+ |
|
375 |
+ |
|
376 |
|
static void ch_pct(char* line) |
377 |
|
{ |
378 |
|
char* pct; |
748 |
|
return 0; |
749 |
|
} |
750 |
|
|
751 |
< |
viewloc(pp,&(p->view),pt); |
678 |
< |
if (pp[2] < 0) |
751 |
> |
if (viewloc(pp,&(p->view),pt) != VL_GOOD) |
752 |
|
return 0; |
753 |
|
loc2pix(res,&(p->resol),pp[0],pp[1]); |
754 |
|
*x = res[0]; |