15 |
|
#include "resolu.h" |
16 |
|
|
17 |
|
/* rpict command */ |
18 |
< |
char *rpargv[128] = {"rpict", "-S", "1", "-x", "512", "-y", "512", }; |
19 |
< |
int rpargc = 7; |
18 |
> |
char *rpargv[128] = {"rpict", "-S", "1", "-x", "512", "-y", "512", "-pa", "1"}; |
19 |
> |
int rpargc = 9; |
20 |
|
int rpd[3]; |
21 |
|
FILE *torp, *fromrp; |
22 |
|
COLR *scanline; |
23 |
|
/* our view parameters */ |
24 |
|
VIEW ourview = STDVIEW; |
25 |
< |
double pixaspect = 0.0; |
25 |
> |
double pixaspect = 1.0; |
26 |
|
int hres = 512, vres = 512, hmult = 2, vmult = 2; |
27 |
|
/* output file */ |
28 |
|
char *outfile = NULL; |
112 |
|
int ac; |
113 |
|
char **av; |
114 |
|
{ |
115 |
+ |
extern char VersionID[]; |
116 |
|
char *err; |
117 |
|
FILE *fp; |
118 |
|
int hr, vr; |
127 |
|
if ((fp = fdopen(dup(outfd), "w")) == NULL) |
128 |
|
goto filerr; |
129 |
|
printargs(ac, av, fp); /* write header */ |
130 |
+ |
fprintf(fp, "SOFTWARE= %s\n", VersionID); |
131 |
|
fputs(VIEWSTR, fp); |
132 |
|
fprintview(&ourview, fp); |
133 |
|
putc('\n', fp); |
156 |
|
goto filerr; |
157 |
|
/* start rpict process */ |
158 |
|
if (open_process(rpd, rpargv) <= 0) { |
159 |
< |
fprintf(stderr, "%s: cannot start\n", rpargv[0]); |
159 |
> |
fprintf(stderr, "%s: cannot start %s\n", progname, rpargv[0]); |
160 |
|
exit(1); |
161 |
|
} |
162 |
|
if ((fromrp = fdopen(rpd[0], "r")) == NULL || |
217 |
|
pview.vert = ourview.vert / vmult; |
218 |
|
break; |
219 |
|
case VT_HEM: |
220 |
+ |
pview.horiz = 2.*180./PI*asin( |
221 |
+ |
sin(PI/180./2.*ourview.horiz)/hmult ); |
222 |
+ |
pview.vert = 2.*180./PI*asin( |
223 |
+ |
sin(PI/180./2.*ourview.vert)/vmult ); |
224 |
+ |
break; |
225 |
|
default: |
226 |
|
fprintf(stderr, "%s: unknown view type '-vt%c'\n", |
227 |
|
progname, ourview.type); |
251 |
|
getheader(fromrp, NULL); /* discard header info. */ |
252 |
|
if (fscnresolu(&hr, &vr, fromrp) < 0 || /* check resolution */ |
253 |
|
hr != hres || vr != vres) { |
254 |
< |
fprintf(stderr, "%s: resolution mismatch from rpict\n", |
255 |
< |
progname); |
254 |
> |
fprintf(stderr, "%s: resolution mismatch from %s\n", |
255 |
> |
progname, rpargv[0]); |
256 |
|
exit(1); |
257 |
|
} |
258 |
|
for (y = 0; y < vr; y++) { /* transfer scanlines */ |
259 |
|
if (freadcolrs(scanline, hr, fromrp) < 0) { |
260 |
< |
fprintf(stderr, "%s: read error from rpict\n", |
261 |
< |
progname); |
260 |
> |
fprintf(stderr, "%s: read error from %s\n", |
261 |
> |
progname, rpargv[0]); |
262 |
|
exit(1); |
263 |
|
} |
264 |
|
if ((y == 0 || hmult != 1) && lseek(outfd, |