You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

100 lines
2.4 KiB

1 month ago
  1. %!
  2. %% Elizabeth D. Zwicky
  3. %% zwicky@erg.sri.com
  4. %% multiflake
  5. /snowflaksave save def % prevent left over effects
  6. % we make the seed deterministic for testing - the orginal code seeded
  7. % the generator with user time.
  8. /lastseed 0 def
  9. /seed {lastseed dup 1 add /lastseed exch def} def
  10. /newflake
  11. {
  12. seed srand
  13. /strokecolor [rand 99 mod 100 div
  14. rand 99 mod 100 div
  15. 100 rand 22 mod sub 100 div] def
  16. /fillcolor [rand 99 mod 100 div
  17. 100 rand 22 mod sub 100 div
  18. rand 99 mod 100 div] def
  19. /eofillcolor [rand 99 mod 100 div
  20. rand 22 mod 100 div
  21. 100 rand 22 mod sub 100 div] def
  22. /colorfill {fillcolor aload pop setrgbcolor fill } def
  23. /colorstroke {strokecolor aload pop setrgbcolor stroke } def
  24. /eocolorfill {eofillcolor aload pop setrgbcolor eofill } def
  25. /arm {0 0 moveto
  26. 5 {3 {x y x y x y curveto} repeat} repeat
  27. seed srand
  28. 0 0 moveto
  29. 5 {3 {x neg y x neg y x neg y curveto} repeat} repeat
  30. seed srand
  31. } def
  32. newpath
  33. 0 0 moveto boxsize 0 rlineto 0 boxsize rlineto boxsize neg 0 rlineto
  34. 0 0 lineto
  35. rand 99 mod 100 div
  36. 100 rand 22 mod sub 100 div
  37. 100 rand 22 mod sub 100 div
  38. sethsbcolor fill
  39. seed srand
  40. boxsize 2 div boxsize 2 div translate
  41. %% If the device you are using can handle complex fills, replace the
  42. %% next three lines with:
  43. %%
  44. 6 {arm 60 rotate} repeat
  45. gsave colorfill grestore gsave eocolorfill grestore colorstroke
  46. %%
  47. %% This will be not only faster, but prettier. On a LaserWriter or a
  48. %% Tektronix Phaser II PS it gives a limitcheck.
  49. %% 6 {arm 60 rotate colorfill} repeat
  50. %% 6 {arm 60 rotate eocolorfill} repeat
  51. %% 6 {arm 60 rotate} repeat colorstroke
  52. } def
  53. 1 setlinewidth
  54. clippath pathbbox /ury exch def /urx exch def /lly exch def /llx exch def
  55. /minsize 250 def
  56. /pagewidth urx llx sub def
  57. /pageheight ury lly sub def
  58. /inwidth pagewidth minsize div def
  59. /inheight pageheight minsize div def
  60. /boxsize
  61. inwidth inheight gt
  62. {pagewidth inwidth truncate 1 .max div}
  63. {pageheight inheight truncate 1 .max div}
  64. ifelse
  65. def
  66. /inwidth pagewidth boxsize div cvi def
  67. /inheight pageheight boxsize div cvi def
  68. /x {rand 70 mod abs} def
  69. /y {rand 120 mod abs} def
  70. llx lly translate
  71. inheight {
  72. inwidth {
  73. gsave
  74. newflake
  75. grestore
  76. boxsize 0 translate
  77. } repeat
  78. boxsize inwidth mul neg boxsize translate
  79. } repeat
  80. clear cleardictstack
  81. snowflaksave restore
  82. % Per page independence description in the PLRM Section 3.7.3, showpage follows restore
  83. showpage