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

Comparing ray/src/px/macbethcal.c (file contents):
Revision 2.15 by greg, Thu Feb 6 11:36:53 1997 UTC vs.
Revision 2.16 by gwlarson, Fri Jul 16 16:12:20 1999 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1997 Regents of the University of California */
1 > /* Copyright (c) 1999 Regents of the University of California */
2  
3   #ifndef lint
4 < static char SCCSid[] = "$SunId$ LBL";
4 > static char SCCSid[] = "$SunId$ SGI";
5   #endif
6  
7   /*
# Line 100 | Line 100 | short  mbneu[NMBNEU] = {Black,Neutral35,Neutral5,Neutra
100   #define  RG_ORIG        02      /* original color region */
101   #define  RG_CORR        04      /* corrected color region */
102  
103 + #ifndef  DISPCOM
104 + #define  DISPCOM        "ximage -op %s"
105 + #endif
106 +
107   int     scanning = 1;           /* scanned input (or recorded output)? */
108   double  irrad = 1.0;            /* irradiance multiplication factor */
109   int     rawmap = 0;             /* put out raw color mapping? */
# Line 160 | Line 164 | char   **argv;
164                          bounds[3][1] = atoi(argv[++i]);
165                          scanning = 2;
166                          break;
167 +                case 'P':                               /* pick position */
168 +                        scanning = 3;
169 +                        break;
170                  case 'i':                               /* irradiance factor */
171                          i++;
172                          if (badarg(argc-i, argv+i, "f"))
# Line 193 | Line 200 | char   **argv;
200                          fprintf(stderr, "%s: bad input picture\n", progname);
201                          exit(1);
202                  }
203 +                if (scanning == 3) {
204 +                        if (i >= argc)
205 +                                goto userr;
206 +                        pickchartpos(argv[i]);
207 +                        scanning = 2;
208 +                }
209          } else {                        /* else set default xmax and ymax */
210                  xmax = 512;
211                  ymax = 2*512/3;
# Line 245 | Line 258 | char   **argv;
258          exit(0);
259   userr:
260          fprintf(stderr,
261 < "Usage: %s [-d dbg.pic][-p xul yul xur yur xll yll xlr ylr][-i irrad][-m] input.pic [output.{cal|cwp}]\n",
261 > "Usage: %s [-d dbg.pic][-P | -p xul yul xur yur xll yll xlr ylr][-i irrad][-m] input.pic [output.{cal|cwp}]\n",
262                          progname);
263          fprintf(stderr, "   or: %s [-d dbg.pic][-i irrad][-m] -c [xyY.dat [output.{cal|cwp}]]\n",
264                          progname);
# Line 770 | Line 783 | clrdebug()                     /* put out debug picture from color input
783                                                  /* clean up */
784          fclose(debugfp);
785          free((char *)scan);
786 + }
787 +
788 +
789 + getpos(name, bnds, fp)          /* get boundary position */
790 + char    *name;
791 + int     bnds[2];
792 + FILE    *fp;
793 + {
794 +        char    buf[64];
795 +
796 +        fprintf(stderr, "\tSelect corner: %s\n", name);
797 +        if (fgets(buf, sizeof(buf), fp) == NULL ||
798 +                        sscanf(buf, "%d %d", &bnds[0], &bnds[1]) != 2) {
799 +                fprintf(stderr, "%s: read error from display process\n",
800 +                                progname);
801 +                exit(1);
802 +        }
803 + }
804 +
805 +
806 + pickchartpos(pfn)               /* display picture and pick chart location */
807 + char    *pfn;
808 + {
809 +        char    combuf[512];
810 +        FILE    *pfp;
811 +
812 +        sprintf(combuf, DISPCOM, pfn);
813 +        if ((pfp = popen(combuf, "r")) == NULL) {
814 +                perror(combuf);
815 +                exit(1);
816 +        }
817 +        fputs("Use middle mouse button to select chart corners:\n", stderr);
818 +        getpos("upper left (dark skin)", bounds[0], pfp);
819 +        getpos("upper right (bluish green)", bounds[1], pfp);
820 +        getpos("lower left (white)", bounds[2], pfp);
821 +        getpos("lower right (black)", bounds[3], pfp);
822 +        fputs("Got it -- quit display program.\n", stderr);
823 +        pclose(pfp);
824   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines