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

Comparing ray/src/common/image.c (file contents):
Revision 2.15 by gwlarson, Fri Feb 26 12:24:07 1999 UTC vs.
Revision 2.25 by greg, Thu Jan 1 19:47:05 2004 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1996 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   *  image.c - routines for image generation.
6 + *
7 + *  External symbols declared in view.h
8   */
9  
10 < #include  "standard.h"
10 > #include "copyright.h"
11  
12 + #include  "rtio.h"
13   #include  "view.h"
14  
15 #include  "resolu.h"
15  
17 #include  "paths.h"
18
16   #define  FEQ(x,y)       (fabs((x)-(y)) <= FTINY)
17   #define  VEQ(v,w)       (FEQ((v)[0],(w)[0]) && FEQ((v)[1],(w)[1]) \
18                                  && FEQ((v)[2],(w)[2]))
# Line 108 | Line 105 | register VIEW  *v;
105   }
106  
107  
108 + void
109   normaspect(va, ap, xp, yp)              /* fix pixel aspect or resolution */
110   double  va;                     /* view aspect ratio */
111   double  *ap;                    /* pixel aspect in (or out if 0) */
# Line 199 | Line 197 | double  x, y;
197   }
198  
199  
200 + void
201   viewloc(ip, v, p)               /* find image location for point */
202   FVECT  ip;
203   register VIEW  *v;
# Line 268 | Line 267 | FVECT  p;
267   }
268  
269  
270 + void
271   pix2loc(loc, rp, px, py)        /* compute image location from pixel pos. */
272 < FLOAT  loc[2];
272 > RREAL  loc[2];
273   register RESOLU  *rp;
274   int  px, py;
275   {
276          register int  x, y;
277  
278 <        if (rp->or & YMAJOR) {
278 >        if (rp->rt & YMAJOR) {
279                  x = px;
280                  y = py;
281          } else {
282                  x = py;
283                  y = px;
284          }
285 <        if (rp->or & XDECR)
285 >        if (rp->rt & XDECR)
286                  x = rp->xr-1 - x;
287 <        if (rp->or & YDECR)
287 >        if (rp->rt & YDECR)
288                  y = rp->yr-1 - y;
289          loc[0] = (x+.5)/rp->xr;
290          loc[1] = (y+.5)/rp->yr;
291   }
292  
293  
294 + void
295   loc2pix(pp, rp, lx, ly)         /* compute pixel pos. from image location */
296   int  pp[2];
297   register RESOLU  *rp;
# Line 300 | Line 301 | double  lx, ly;
301  
302          x = lx * rp->xr;
303          y = ly * rp->yr;
304 <        if (rp->or & XDECR)
304 >        if (rp->rt & XDECR)
305                  x = rp->xr-1 - x;
306 <        if (rp->or & YDECR)
306 >        if (rp->rt & YDECR)
307                  y = rp->yr-1 - y;
308 <        if (rp->or & YMAJOR) {
308 >        if (rp->rt & YMAJOR) {
309                  pp[0] = x;
310                  pp[1] = y;
311          } else {
# Line 391 | Line 392 | register char  *s;
392          int  na;
393          int  nvopts = 0;
394  
395 +        while (*s == ' ')
396 +                s++;
397          if (*s != '-')
398                  s = sskip2(s,1);
399          while (*s) {
400                  ac = 0;
401                  do {
402 <                        av[ac++] = s;
402 >                        if (ac || *s == '-')
403 >                                av[ac++] = s;
404                          while (*s && *s != ' ')
405                                  s++;
406                          while (*s == ' ')
# Line 413 | Line 417 | register char  *s;
417   }
418  
419  
420 + void
421   fprintview(vp, fp)                      /* write out view parameters */
422   register VIEW  *vp;
423   FILE  *fp;
# Line 485 | Line 490 | int
490   isview(s)                               /* is this a view string? */
491   char  *s;
492   {
493 <        static char  *altname[]={NULL,VIEWSTR,"rpict","rview","pinterp",NULL};
493 >        static char  *altname[]={NULL,VIEWSTR,"rpict","rview","rvu","rpiece","pinterp",NULL};
494          extern char  *progname;
495          register char  *cp;
496          register char  **an;
# Line 536 | Line 541 | RESOLU  *rp;
541          struct myview   mvs;
542          FILE  *fp;
543  
544 <        if ((fp = fopen(fname, "r")) == NULL)
544 >        if (fname == NULL || !strcmp(fname, "-"))
545 >                fp = stdin;
546 >        else if ((fp = fopen(fname, "r")) == NULL)
547                  return(-1);
548  
549          mvs.hv = vp;
550          mvs.ok = 0;
551  
552 <        getheader(fp, gethview, &mvs);
552 >        getheader(fp, (int (*)(char *, char *))&gethview, (char *)&mvs);
553  
554          if (rp != NULL && !fgetsresolu(rp, fp))
555                  mvs.ok = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines