% arrowdemo.jam
% try to show off some fancy borders and arrows
% Rick Beach, July 2, 1982 3:59 pm
%Ken Pier, July 16, 1982 1:17 pm
%Maureen Stone, October 14, 1982 11:00 am
%Rick Beach, November 28, 1982 1:11 pm

% some prerequisites

(graphics.jam) .run

(quiver) .dup 100 .dict .def .load .begin
(arrows.jam).run
(border.jam).run
(candycane.jam).run
(conf.jam) .run
conf

(demolist) {"The following setup commands exist:
   colorviewersetup - set up for color viewer

The following demos illustrate drawing
arrows, borders and thick lines:
   arrowdemo - make a collage of different styles of arrows
   lettering - write the word arrows with arrows
   arrowsampler - collection of several arrows styles 
   arrowspiral - spiral of many styles of arrows
   bordersampler - collection of several border styles
   candycane - write the word candy using a candy cane style
   <width> arrow - draw arrow given 4 mouse touches
" .print} .cvx .def

(colorviewersetup) {
(white) (.white).load .store
(black) (.red).load .store
(gray12) (.cyan).cvx .def
(gray15) (.yellow).cvx .def
}.cvx .def

% arrowspray - sprays a bunch of arrows that look neat
% <width> <x0> <y0> <dx> <dy> <slope> <repeats> arrowspray

(arrowspray) {(!!repeats) .exch .def (!!slope) .exch .def (dy) .exch .def (dx) .exch .def (y0) .exch .def (x0) .exch .def (!lw) .exch .def
(x) dx !!slope dy .mul .add .def
(y) dy .def
conformal
.pushdc x0 y0 .translate
!!repeats{(bx) 0 .def 0 y  dx y  x !!slope y .div .sub y  x 0 .cubicmapper !lw !lw .cubicscale (!al) .getarc !lw .div .def arrowpattern (x) x dy .add .def (y) y dy .add .def }.cvx .rept
.popdc}.cvx .def

% arrowdemo - makes a collage of four sets of arrowsprays
(arrowdemo) {.true .setfat .pushdc 72 0 .translate .8 .8 .scale
.pushdc
90 350 .translate 1 1 .scale
(arrowpattern) {4 2 arrowhead1 arrowfeather2 drawarea}.cvx .def
9 0 0 10 20 5 10 arrowspray
.popdc .pushdc
490 350 .translate -1 1 .scale
(arrowpattern) {3.3 3.3 arrowhead2 arrowfeather2 drawarea}.cvx .def
5 0 0 10 20 5 10 arrowspray
.popdc .pushdc
90 350 .translate 1 -1 .scale
(arrowpattern) {3.3 3.3 arrowhead3 arrowfeather2 drawarea}.cvx .def
5 0 0 10 20 5 10 arrowspray
.popdc .pushdc
490 350 .translate -1 -1 .scale
(arrowpattern) {4 2 arrowhead1 arrowfeather2 drawarea}.cvx .def
9 0 0 10 20 5 10 arrowspray
.popdc
.popdc
}.cvx .def

% arrows - write the letters of the word using arrows - of course!
(lettering) {
(arrowpattern) {4 2 arrowhead1 arrowfeather2 drawarea}.cvx .def
% down stroke of the a
84 24 62.92578 45.65007 95.88354 84.56023 93 106 9 givenarrow
% curve of the a
72 33 -22.55696 -9.992447e-1 33.00793 114.7349 93 104 9 givenarrow
% down stroke of the r
140.0 105.0 140.4781 82.12138 131.7007 57.07667 121 24 9 givenarrow
% tip of the r
199.0 105.0 178.3352 106.0428 162.7091 94.9213 144 78 9 givenarrow
% down stroke of the r
216.0 105.0 215.3069 81.54932 210.6195 54.75323 199 20 9 givenarrow
% tip of the r
276.0 105.0 255.3348 104.2391 239.8445 90.98495 220 80 9 givenarrow
% top left of the o
274.0 53.99998 272.434 86.36429 304.3405 118.5293 337.0 105.0 9 givenarrow
% bottom of the o
336.0 46.0 333.2176 17.92616 276.9123 10.84226 274 50 9 givenarrow
% top right of the o
338 48 347.8518 69.40497 348.6786 85.68069 339 104 9 givenarrow
% left down stroke of the w
384 20 351.5127 42.99549 375.6834 80.72176 381.0 104.0 9 givenarrow
% middle up stroke of the w
418.0 79.0 410.2983 62.15568 410.7856 39.36324 385 20 9 givenarrow
% middle down stroke of the w
436 24 416.4068 25.30781 412.6137 40.48064 413.0 51.0 9 givenarrow
% right down stroke of the w
437.9999 25.99999 458.9349 46.06149 463.1223 76.59815 460.0 104.0 9 givenarrow
% top stroke of the s
538.0 88.00002 530.7708 105.4534 503.82 108.2691 487 97 9 givenarrow
% middle stroke of the s
526.0 51.0 509.2034 57.52851 477.2826 68.58773 486.0 93.0 9 givenarrow
% bottom stroke of the s
529.0 46.0 470.9999 44.0 474.4907 15.592 542.6355 8.356247 528 51 9 givenarrow}.cvx .def

% selection of all our arrow styles
(arrowspiral) {
0 -120 .translate
a1 
339 369
323 431
230 417
224 351
25 givenarrow 
a2 
224 355
220 268
288 236
368 319
15 givenarrow 
a3
370 321
425 355
368 478
245 456
10 givenarrow 
a4 
245 457
167 443
133 284
224 217
10 givenarrow 
a5 
224 217
317 179
456 246
473 358
20 givenarrow 
a6 
472 358
490 470
337 586
199 533
20 givenarrow 
a7 
190 530
80 493
66 249
174 153
40 givenarrow 
a8 
174 151
277 93
538 193
548 365
40 givenarrow 
a9 
549 370
560 526
370 654
201 622
20 givenarrow
}.cvx .def

% arrow sampler
(arrowsampler) {
.pushdc .true .setfat 100 100 .translate
(arrowpattern) {4 2 arrowhead1 arrowfeather2 drawarea}.cvx .def
172 41 73 41 106 1 1 1 10 givenarrow
204 0 .translate
1 41 91 41 61 1 156 1 10 givenarrow
-204 48 .translate
(arrowpattern) {4 4 arrowhead2 arrowfeather1 drawarea}.cvx .def
172 41 73 41 106 1 1 1 10 givenarrow
204 0 .translate
1 41 91 41 61 1 156 1 10 givenarrow
-204 48 .translate
(arrowpattern) {3 3 arrowhead3 8 2 arrowfeather5 drawarea}.cvx .def
172 41 73 41 106 1 1 1 10 givenarrow
204 0 .translate
1 41 91 41 61 1 156 1 10 givenarrow
-204 48 .translate
(arrowpattern) {4 4 arrowhead2 8 2 arrowfeather4 drawarea}.cvx .def
172 41 73 41 106 1 1 1 10 givenarrow
204 0 .translate
1 41 91 41 61 1 156 1 10 givenarrow
-204 48 .translate
(arrowpattern) {4 2 arrowhead1 12 2 arrowfeather3 drawarea}.cvx .def
172 41 73 41 106 1 1 1 10 givenarrow
204 0 .translate
1 41 91 41 61 1 156 1 10 givenarrow
-204 48 .translate
(arrowpattern) {6 2.5 arrowhead4 2 arrowfeather6 drawarea}.cvx .def
172 41 73 41 106 1 1 1 10 givenarrow
204 0 .translate
1 41 91 41 61 1 156 1 10 givenarrow
.popdc
}.cvx .def

% border sampler
(bordersampler) {.pushdc 170 400 .translate
(borderpattern) (border1).cvx .def 0 0 50 20 250 20 300 1  20 20 givenborder
0 -40 .translate
(borderpattern) (border2).cvx .def 0 0 50 20 250 20 300 0  30 15  givenborder
0 -40 .translate
(borderpattern) (border4).cvx .def 0 0 50 20 250 20 300 1  30 15 givenborder
0 -40 .translate
(borderpattern) (border6).cvx .def 0 0 50 20 250 20 300 0  20 10 givenborder
0 -40 .translate
(borderpattern) (border7).cvx .def 0 0 50 20 250 20 300 1  20 10 givenborder
0 -40 .translate
(borderpattern) (border8).cvx .def 0 0 50 20 250 20 300 0  20 20 givenborder
0 -40 .translate
(borderpattern) (leafpattern).cvx .def 0 0 50 20 250 20 300 1  20 20 givenborder
0 -60 .translate
(borderpattern) (border3).cvx .def 0 0 50 20 250 20 300 0  10 30 givenborder
0 -20 .translate
(borderpattern) (dashed1).cvx .def 0 0 50 20 250 20 300 1  20 10 givenborder
0 -40 .translate
(borderpattern) (blackout).cvx .def 0 0 50 20 250 20 300 0  10 10 givenborder
0 -40 .translate

.popdc}.cvx .def

% begin the demo!!!
demolist

(blackbox) {black .touch .touch .drawbox}.cvx .def
.getviewer