-
Notifications
You must be signed in to change notification settings - Fork 1
/
BREAKER.PS
executable file
·146 lines (128 loc) · 3.75 KB
/
BREAKER.PS
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
%!PS-Adobe-2.0
%%Title: breaker.ps
%%Creator: Rhea Myers
%%EndComments
%Basic variables and operations for redefining drawing commands
/break 5 def % lengh of line segments
/modify { %def
dup 1 lt { pop 1 } if
rand 42949672940 div .975 add mul %multiplies integer by 5%
} bind def
/2modify { %def
2 { modify 1 2 roll } repeat %modifies top 2 numbers on stack
} bind def
/5modify { %def
5 { modify 1 5 roll } repeat %modifies top 5 numbers on stack
} bind def
/6modify { %def
6 { modify 1 6 roll } repeat %modifies top 6 numbers on stack
} bind def
%Rename drawing functions
/*moveto /moveto load def
/*lineto /lineto load def
/*arcto /arcto load def
/*curveto /curveto load def
/*arc /arc load def
/*rmoveto /rmoveto load def
/*rlineto /rlineto load def
/*rcurveto /rcurveto load def
/*arcn /arcn load def
%level 2 /*arct /arct load def
%Redefine drawing functions
/moveto { %def
/newy exch def
/newx exch def
newx newy *moveto
} bind def
/lineto { %def
/oldy newy def
/oldx newx def
/newy exch def
/newx exch def
/xdis newx oldx sub def
/ydis newy oldy sub def
/dist xdis dup mul ydis dup mul add abs sqrt def
dist break gt { %if
/reps dist break idiv def
/xdis xdis reps div def
/ydis ydis reps div def
1 1 reps { %repeat
dup
xdis modify mul oldx add exch
ydis modify mul oldy add
*lineto
} repeat
} if
newx modify newy modify *lineto
} bind def
/arcto { %def
6modify
*arcto
}bind def
/curveto { %def
/newy exch def
/newx exch def
newx newy
2modify
*curveto
} bind def
/arc { %def
5modify
*curveto
} bind def
/rmoveto { %def
2modify
*rmoveto
} bind def
/rlineto { %def
2modify
*rlineto
} bind def
/rcurveto { %def
6modify
*rcurveto
} bind def
/arcn { %def
5modify
*arcn
} bind def
%level 2 /arct { %def
% 5modify
% *arct
% } bind def
%Rename text commands
/*show /show load def %rename show
%Redefine text commands
/show { %def %redefine show for filled characters only
{ %forall
/charcode exch def
/thischar ( ) dup 0 charcode put def
gsave
currentpoint %save starting point
/currenty exch def
/currentx exch def
thischar false charpath %get character outline
/thispath [
{ /moveto cvx } { /lineto cvx } { /curveto cvx }
{ /closepath cvx } pathforall
] cvx def
newpath
currentx currenty *moveto
thispath
currentfont begin
PaintType 2 eq { %ifelse
stroke
}{ %else
fill
} ifelse
end
grestore
thischar stringwidth pop 0 *rmoveto
currentpoint pop currenty *moveto
} forall
} bind def
%%EndProlog
/Helvetica findfont 90 scalefont setfont
100 500 *moveto
(viral) show
showpage