--- ray/src/px/pcomb.c 1991/04/18 10:19:48 1.9 +++ ray/src/px/pcomb.c 1991/04/23 15:49:53 1.12 @@ -48,27 +48,32 @@ int xres=0, yres=0; /* picture resolution */ int xpos, ypos; /* picture position */ +int wrongformat = 0; + tputs(s) /* put out string preceded by a tab */ char *s; { + char fmt[32]; double d; COLOR ctmp; - /* echo header line */ - putchar('\t'); - fputs(s, stdout); - if (!original) - return; - /* check for exposure */ - if (isexpos(s)) { + + if (isformat(s)) { /* check format */ + formatval(fmt, s); + wrongformat = strcmp(fmt, COLRFMT); + } else if (original && isexpos(s)) { /* exposure */ d = 1.0/exposval(s); scalecolor(input[nfiles].coef, d); - } else if (iscolcor(s)) { + } else if (original && iscolcor(s)) { /* color correction */ colcorval(ctmp, s); colval(input[nfiles].coef,RED) /= colval(ctmp,RED); colval(input[nfiles].coef,GRN) /= colval(ctmp,GRN); colval(input[nfiles].coef,BLU) /= colval(ctmp,BLU); + } else { /* echo unaffected line */ + putchar('\t'); + fputs(s, stdout); } + } @@ -80,10 +85,10 @@ char *argv[]; double f; int a; - funset(vcolin[RED], 1, l_redin); - funset(vcolin[GRN], 1, l_grnin); - funset(vcolin[BLU], 1, l_bluin); - funset(vbrtin, 1, l_brtin); + funset(vcolin[RED], 1, '=', l_redin); + funset(vcolin[GRN], 1, '=', l_grnin); + funset(vcolin[BLU], 1, '=', l_bluin); + funset(vbrtin, 1, '=', l_brtin); for (a = 1; a < argc; a++) if (argv[a][0] == '-') @@ -153,7 +158,12 @@ getfiles: } fputs(input[nfiles].name, stdout); fputs(":\n", stdout); - getheader(input[nfiles].fp, tputs); + getheader(input[nfiles].fp, tputs, NULL); + if (wrongformat) { + eputs(input[nfiles].name); + eputs(": not in Radiance picture format\n"); + quit(1); + } if (fgetresolu(&xpos, &ypos, input[nfiles].fp) != (YMAJOR|YDECR)) { eputs(input[nfiles].name); @@ -172,6 +182,7 @@ getfiles: nfiles++; } printargs(argc, argv, stdout); + fputformat(COLRFMT, stdout); putchar('\n'); fputresolu(YMAJOR|YDECR, xres, yres, stdout); combine(); @@ -203,9 +214,9 @@ combine() /* combine pictures */ else brtdef = NULL; /* predefine variables */ - varset(vnfiles, (double)nfiles); - varset(vxres, (double)xres); - varset(vyres, (double)yres); + varset(vnfiles, '=', (double)nfiles); + varset(vxres, '=', (double)xres); + varset(vyres, '=', (double)yres); /* allocate scanline */ scanout = (COLOR *)emalloc(xres*sizeof(COLOR)); /* combine files */ @@ -216,11 +227,11 @@ combine() /* combine pictures */ eputs(": read error\n"); quit(1); } - varset(vypos, (double)ypos); + varset(vypos, '=', (double)ypos); for (xpos = 0; xpos < xres; xpos++) { for (i = 0; i < nfiles; i++) multcolor(input[i].scan[xpos],input[i].coef); - varset(vxpos, (double)xpos); + varset(vxpos, '=', (double)xpos); eclock++; if (brtdef != NULL) { d = evalue(brtdef);