Debian Codegraph @

tests/graphs/dice.ps

raw
1 %!PS-Adobe-3.0
2 %%Page: 1 1
3 %%PageBoundingBox: 175 316 437 579
4 %%BoundingBox: 175 316 437 579
5
6 /strdimensions {
7 gsave
8 newpath
9 0 0 moveto
10 false charpath flattenpath pathbbox
11 exch 4 -1 roll sub
12 3 1 roll exch sub
13 grestore
14 } def
15
16 /die1_data [
17 % [50 33 33 48 67 67 50]
18 % [27 7 31 34 30 5 0]
19 [50 33 33 48 67 67 50]
20 [27 7 31 34 30 5 0]
21 [
22 [50 30 2 1 0]
23 [54 21 1.2 2 0]
24 [63 11 1.2 2 0]
25 [46 21 1.2 2 0]
26 [46 7 1.2 2 0]
27 ]
28 ]def
29
30 /die2_data [
31 % [15 0 0 19 40 40 15]
32 % [25 9 31 33 27 2 0]
33 [15 0 0 19 40 40 15]
34 [25 7 31 33 27 0 -3]
35 [
36 [18 29 2 1 0]
37 [28 12 2 2 0]
38 [21 4 2 2 0]
39 [21 19 2 2 0]
40 [35 5 2 2 0]
41 [35 20 2 2 0]
42 [4 10 1.2 2 0]
43 [11.5 20.5 1.4 2 0]
44 ]
45 ] def
46
47 % cx cy rx ry ang mk_ellipse -
48 /mk_ellipse {
49 /ang exch def
50 /ry exch def
51 /rx exch def
52 /cy exch def
53 /cx exch def
54
55 gsave
56 newpath
57 cx cy translate
58 ang rotate
59 rx ry scale
60 0 0 1 0 360 arc
61 fill
62 grestore
63 } def
64
65 /fill_die {
66 1 setgray
67 newpath
68 xval 1 get yval 1 get moveto
69 xval 2 get yval 2 get lineto
70 xval 3 get yval 3 get lineto
71 xval 4 get yval 4 get lineto
72 xval 5 get yval 5 get lineto
73 xval 6 get yval 6 get lineto
74 closepath
75 fill
76 } def
77
78 /outline_die {
79 0 setgray
80 newpath
81 xval 1 get yval 1 get moveto
82 xval 2 get yval 2 get lineto
83 xval 3 get yval 3 get lineto
84 xval 4 get yval 4 get lineto
85 xval 5 get yval 5 get lineto
86 xval 6 get yval 6 get lineto
87 closepath
88 xval 0 get yval 0 get moveto
89 xval 2 get yval 2 get lineto
90 xval 0 get yval 0 get moveto
91 xval 4 get yval 4 get lineto
92 xval 0 get yval 0 get moveto
93 xval 6 get yval 6 get lineto
94 stroke
95 } def
96
97 /do_spot {
98 aload pop
99 mk_ellipse
100 } def
101
102 /spot_die {
103 spots {
104 do_spot
105 } forall
106
107 } def
108
109 /do_die {
110 dup 0 get /xval exch def
111 dup 1 get /yval exch def
112 2 get /spots exch def
113 fill_die
114 outline_die
115 spot_die
116 } def
117
118 /dicedict 32 dict def
119
120 /do_dice {
121 save
122 mark
123 -94 -45 translate
124 2.8 2.8 scale
125 dicedict begin
126 die1_data do_die
127 die2_data do_die
128 end
129 cleartomark
130 restore
131 } def
132
133 /outsidecircletext
134 { circtextdict begin
135 /radius exch def
136 /centerangle exch def
137 /ptsize exch def
138 /str exch def
139 /xradius radius ptsize 4 div add def
140
141 gsave
142 centerangle str findhalfangle add rotate
143
144 str
145 { /charcode exch def
146 (A) dup 0 charcode put outsideplacechar
147 } forall
148
149 grestore
150 end
151 } def
152
153
154 /insidecircletext
155 { circtextdict begin
156 /radius exch def
157 /centerangle exch def
158 /ptsize exch def
159 /str exch def
160 /xradius radius ptsize 4 div add def
161
162 /radius radius charheight add def
163
164 gsave
165 centerangle str findhalfangle sub rotate
166
167 str
168 { /charcode exch def
169 (A) dup 0 charcode put insideplacechar
170 } forall
171
172 grestore
173 end
174 } def
175
176 /circtextdict 16 dict def
177 circtextdict begin
178 /findhalfangle
179 { stringwidth pop 2 div
180 2 xradius mul pi mul div 360 mul
181 } def
182
183 /outsideplacechar
184 { /char exch def
185 /halfangle char findhalfangle def
186 gsave
187 halfangle neg rotate
188 radius 0 translate
189 -90 rotate
190 char stringwidth pop 2 div neg 0 moveto
191 char show
192 grestore
193 halfangle 2 mul neg rotate
194 } def
195
196 /insideplacechar
197 { /char exch def
198 /halfangle char findhalfangle def
199 gsave
200 halfangle rotate
201 radius 0 translate
202 90 rotate
203 char stringwidth pop 2 div neg 0 moveto
204 char show
205 grestore
206 halfangle 2 mul rotate
207 } def
208
209 /charheight
210 {
211 newpath
212 0 0 moveto
213 (A) true charpath flattenpath pathbbox
214 exch 4 -1 roll pop pop
215 exch sub
216 } def
217
218 /pi 3.1415923 def
219 end
220
221 /makecircle {
222 /crad exch def
223 /cy exch def
224 /cx exch def
225 newpath
226 cx cy crad 0 360 arc stroke
227 } def
228
229 /centertext {
230 /str exch def
231
232 str strdimensions
233 2 div exch 2 div
234 4 -1 roll exch sub
235 3 1 roll sub
236 moveto str show
237 } def
238
239 /ptSize 31 def
240 /Radius 108 def
241
242 /Helvetica-Bold findfont ptSize scalefont setfont
243
244 306 448 translate
245
246 % 0 0 Radius makecircle
247 % 0 0 1 makecircle
248
249 (REUSABLE CODE) ptSize 90 Radius outsidecircletext
250
251 (BETTER PROGRAMS NOW) ptSize 270 Radius insidecircletext
252
253 do_dice
254
255 /Helvetica-Bold findfont 70 scalefont setfont
256
257 gsave
258 1 setgray
259 2 -52 (C++) centertext
260 grestore
261 gsave
262 1 setgray
263 -2 -52 (C++) centertext
264 grestore
265 gsave
266 1 setgray
267 -2 -48 (C++) centertext
268 grestore
269 gsave
270 1 setgray
271 2 -48 (C++) centertext
272 grestore
273 0 setgray
274 0 -50 (C++) centertext
275
276 showpage
277