4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
5 |
|
#endif |
6 |
|
|
7 |
– |
/* Copyright (c) 1992 Regents of the University of California */ |
8 |
– |
|
9 |
– |
#ifndef lint |
10 |
– |
static char SCCSid[] = "$SunId$ LBL"; |
11 |
– |
#endif |
12 |
– |
|
7 |
|
/* |
8 |
|
* Radiance picture to PostScript file translator -- one way! |
9 |
|
*/ |
110 |
|
{ |
111 |
|
int landscape = 0; |
112 |
|
double pwidth, pheight; |
113 |
+ |
double iwidth, iheight; |
114 |
|
|
115 |
|
printf("%%!\n"); |
116 |
|
printf("%%%%Title: %s\n", name); |
123 |
|
printf("%%%%EndComments\n"); |
124 |
|
printf("gsave\n"); |
125 |
|
printf("64 dict begin\n"); |
126 |
+ |
/* define image reader */ |
127 |
+ |
PSprocdef("read6bit"); |
128 |
|
/* set up transformation matrix */ |
129 |
< |
printf("%f %f translate 1 -1 scale\n", HMARGIN, VMARGIN+PHEIGHT); |
129 |
> |
printf("%f %f translate\n", HMARGIN, VMARGIN); |
130 |
|
if (PWIDTH > PHEIGHT ^ landscape) { |
131 |
|
printf("0 %f translate\n", PHEIGHT); |
132 |
< |
printf("90 rotate\n"); |
132 |
> |
printf("-90 rotate\n"); |
133 |
|
pwidth = PHEIGHT; |
134 |
|
pheight = PWIDTH; |
135 |
|
} else { |
137 |
|
pheight = PHEIGHT; |
138 |
|
} |
139 |
|
if (pheight/pwidth > pixaspect*ymax/xmax) { |
140 |
< |
printf("%f %f matrix scale\n", pwidth/xmax, |
141 |
< |
pixaspect*pwidth/xmax); |
145 |
< |
printf("0 %f matrix translate\n", |
146 |
< |
.5*(pheight-pwidth*pixaspect*ymax/xmax)); |
140 |
> |
iwidth = pwidth; |
141 |
> |
iheight = pwidth*pixaspect*ymax/xmax; |
142 |
|
} else { |
143 |
< |
printf("%f %f matrix scale\n", pheight/(ymax*pixaspect), |
144 |
< |
pheight/ymax); |
150 |
< |
printf("%f 0 matrix translate\n", |
151 |
< |
.5*(pwidth-pheight*xmax/(ymax*pixaspect))); |
143 |
> |
iheight = pheight; |
144 |
> |
iwidth = pheight*xmax/(pixaspect*ymax); |
145 |
|
} |
146 |
< |
printf("matrix concatmatrix /imat exch def\n"); |
147 |
< |
PSprocdef("read6bit"); |
146 |
> |
printf("%f %f translate\n", (pwidth-iwidth)*.5, (pheight-iheight)*.5); |
147 |
> |
printf("%f %f scale\n", iwidth, iheight); |
148 |
|
printf("%%%%EndProlog\n"); |
149 |
< |
printf("%d %d 8 imat {read6bit} image", xmax, ymax); |
149 |
> |
/* start image procedure */ |
150 |
> |
printf("%d %d 8 [%d 0 0 %d 0 %d] {read6bit} image", xmax, ymax, |
151 |
> |
xmax, -ymax, ymax); |
152 |
|
} |
153 |
|
|
154 |
|
|