127 |
|
int landscape = 0; |
128 |
|
double pwidth, pheight; |
129 |
|
double iwidth, iheight; |
130 |
< |
|
131 |
< |
printf("%%!\n"); |
130 |
> |
/* EPS comments */ |
131 |
> |
puts("%%!PS-Adobe-2.0 EPSF-2.0"); |
132 |
|
printf("%%%%Title: %s\n", name); |
133 |
< |
printf("%%%%Creator: %s\n", progname); |
133 |
> |
printf("%%%%Creator: %s = %s\n", progname, SCCSid); |
134 |
|
printf("%%%%Pages: %d\n", ncopies); |
135 |
|
if (landscape = xmax > pixaspect*ymax) |
136 |
< |
printf("%%%%Landscape\n"); |
136 |
> |
puts("%%Orientation: Landscape"); |
137 |
|
else |
138 |
< |
printf("%%%%Portrait\n"); |
139 |
< |
printf("%%%%EndComments\n"); |
140 |
< |
printf("64 dict begin\n"); |
141 |
< |
/* define image reader */ |
142 |
< |
PSprocdef("read6bitRLE"); |
143 |
< |
/* set up transformation matrix */ |
144 |
< |
printf("%f %f translate\n", HMARGIN, VMARGIN); |
138 |
> |
puts("%%Orientation: Portrait"); |
139 |
|
if (PWIDTH > PHEIGHT ^ landscape) { |
146 |
– |
printf("0 %f translate\n", PHEIGHT); |
147 |
– |
printf("-90 rotate\n"); |
140 |
|
pwidth = PHEIGHT; |
141 |
|
pheight = PWIDTH; |
142 |
|
} else { |
150 |
|
iheight = pheight; |
151 |
|
iwidth = pheight*xmax/(pixaspect*ymax); |
152 |
|
} |
153 |
+ |
if (pwidth == PHEIGHT) |
154 |
+ |
printf("%%%%BoundingBox: %.0f %.0f %.0f %.0f\n", |
155 |
+ |
HMARGIN+(pheight-iheight)*.5, |
156 |
+ |
VMARGIN+(pwidth-iwidth)*.5, |
157 |
+ |
HMARGIN+(pheight-iheight)*.5+iheight, |
158 |
+ |
VMARGIN+(pwidth-iwidth)*.5+iwidth); |
159 |
+ |
else |
160 |
+ |
printf("%%%%BoundingBox: %.0f %.0f %.0f %.0f\n", |
161 |
+ |
HMARGIN+(pwidth-iwidth)*.5, |
162 |
+ |
VMARGIN+(pheight-iheight)*.5, |
163 |
+ |
HMARGIN+(pwidth-iwidth)*.5+iwidth, |
164 |
+ |
VMARGIN+(pheight-iheight)*.5+iheight); |
165 |
+ |
puts("%%EndComments"); |
166 |
+ |
puts("save"); |
167 |
+ |
puts("64 dict begin"); |
168 |
+ |
/* define image reader */ |
169 |
+ |
PSprocdef("read6bitRLE"); |
170 |
+ |
/* set up transformation matrix */ |
171 |
+ |
printf("%f %f translate\n", HMARGIN, VMARGIN); |
172 |
+ |
if (pwidth == PHEIGHT) { |
173 |
+ |
printf("0 %f translate\n", PHEIGHT); |
174 |
+ |
puts("-90 rotate"); |
175 |
+ |
} |
176 |
|
printf("%f %f translate\n", (pwidth-iwidth)*.5, (pheight-iheight)*.5); |
177 |
|
printf("%f %f scale\n", iwidth, iheight); |
178 |
< |
printf("%%%%EndProlog\n"); |
178 |
> |
puts("%%%%EndProlog"); |
179 |
|
/* start image procedure */ |
180 |
|
printf("%d %d 8 [%d 0 0 %d 0 %d] {read6bitRLE} image\n", xmax, ymax, |
181 |
|
xmax, -ymax, ymax); |
189 |
|
printf("/#copies %d def\n", ncopies); |
190 |
|
puts("showpage"); |
191 |
|
puts("end"); |
192 |
+ |
puts("restore"); |
193 |
|
puts("%%EOF"); |
194 |
|
} |
195 |
|
|