ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/util/pictool.c
(Generate patch)

Comparing ray/src/util/pictool.c (file contents):
Revision 2.5 by greg, Wed Jan 24 04:39:52 2018 UTC vs.
Revision 2.8 by greg, Tue Jun 30 15:57:30 2020 UTC

# Line 4 | Line 4 | static const char RCSid[] = "$Id$";
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  
# Line 277 | Line 277 | int            pict_read_fp(pict* p,FILE* fp)
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   {
# Line 314 | Line 357 | int            pict_read(pict* p,char* fn)
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;
# Line 689 | Line 748 | int            pict_locate(pict* p,FVECT pt,int* x,int* y)
748                  return 0;
749          }
750  
751 <        if (viewloc(pp,&(p->view),pt) <= 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];

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines