| 732 |
|
default:; |
| 733 |
|
} |
| 734 |
|
fputc('\n', pdfp[0]); // flush picture header + resolution |
| 735 |
– |
fprtresolu(GetWidth(), GetHeight(), pdfp[0]); |
| 735 |
|
if (fflush(pdfp[0]) == EOF) { |
| 736 |
|
sprintf(errmsg, "cannot write header to picture '%s'", pfname); |
| 737 |
|
error(SYSTEM, errmsg); |
| 739 |
|
pdfp[0] = NULL; |
| 740 |
|
return RDTnone; |
| 741 |
|
} |
| 742 |
< |
if (dfname) { |
| 742 |
> |
if (dfname) { // open depth output |
| 743 |
|
if (dfname[0] == '!') |
| 744 |
|
pdfp[1] = popen(dfname+1, "w"); |
| 745 |
|
else |
| 760 |
|
fputs(DEPTHSTR, pdfp[1]); fputs(dunit, pdfp[1]); fputc('\n', pdfp[1]); |
| 761 |
|
fputformat(DEPTH16FMT, pdfp[1]); |
| 762 |
|
fputc('\n', pdfp[1]); // end-of-info |
| 764 |
– |
fprtresolu(GetWidth(), GetHeight(), pdfp[1]); |
| 763 |
|
if (fflush(pdfp[1]) == EOF) { |
| 764 |
|
sprintf(errmsg, "cannot write header to '%s'", dfname); |
| 765 |
|
error(SYSTEM, errmsg); |
| 786 |
|
dt = NewOutput(pdfp, pfname, dt, dfname); |
| 787 |
|
if (dt == RDTnone) |
| 788 |
|
return RDTnone; |
| 789 |
+ |
// add resolution string(s) |
| 790 |
+ |
fprtresolu(GetWidth(), GetHeight(), pdfp[0]); |
| 791 |
+ |
if (RDTdepthT(dt) == RDTdshort) |
| 792 |
+ |
fprtresolu(GetWidth(), GetHeight(), pdfp[1]); |
| 793 |
|
|
| 794 |
|
const int bheight = (psample > 1) ? int(2*psample+.99) : 4; |
| 795 |
|
const int vstep = bheight >> (psample > 1); |
| 1132 |
|
error(WARNING, errmsg); |
| 1133 |
|
} |
| 1134 |
|
long toSkip = 0; |
| 1135 |
< |
switch (RDTdepthT(dt)) { // append depth file, too? |
| 1135 |
> |
switch (RDTdepthT(dt)) { // append depth file, too? |
| 1136 |
|
case RDTdfloat: |
| 1137 |
|
toSkip = sizeof(float)*GetWidth()*doneScans; |
| 1138 |
|
break; |
| 1147 |
|
toSkip = 2L*GetWidth()*doneScans; |
| 1148 |
|
break; |
| 1149 |
|
default:; |
| 1150 |
< |
} |
| 1151 |
< |
if (toSkip && fseek(pdfp[1], toSkip, SEEK_CUR) < 0) { |
| 1150 |
> |
} // fseek() needed for output |
| 1151 |
> |
if (pdfp[1] && fseek(pdfp[1], toSkip, SEEK_CUR) < 0) { |
| 1152 |
|
sprintf(errmsg, "cannot seek on depth file '%s'", dfname); |
| 1153 |
|
error(SYSTEM, errmsg); |
| 1154 |
|
fclose(pdfp[0]); fclose(pdfp[1]); |