1 | 1 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,31 @@ |
1 |
+/xdef {exch def} bind def |
|
2 |
+/DFDbox { |
|
3 |
+ 10 dict begin |
|
4 |
+ /fflag xdef |
|
5 |
+ /sides xdef |
|
6 |
+ dup |
|
7 |
+ aload pop |
|
8 |
+ % draw the sides |
|
9 |
+ newpath |
|
10 |
+ moveto |
|
11 |
+ 1 1 sides { |
|
12 |
+ 2 mod 0 ne |
|
13 |
+ {moveto} % even sides |
|
14 |
+ {lineto currentpoint stroke moveto} % odd sides |
|
15 |
+ ifelse |
|
16 |
+ } for |
|
17 |
+ fflag % if shape is filled |
|
18 |
+ { |
|
19 |
+ aload pop |
|
20 |
+ newpath |
|
21 |
+ moveto |
|
22 |
+ /y1 xdef |
|
23 |
+ /x1 xdef |
|
24 |
+ lineto stroke newpath |
|
25 |
+ x1 y1 moveto lineto stroke |
|
26 |
+ pop pop |
|
27 |
+ } |
|
28 |
+ {pop} |
|
29 |
+ ifelse |
|
30 |
+ end |
|
31 |
+} bind def |