% Date: Sat, 21 May 88 23:11:56 EDT % To: NeWS-makers@brillig.umd.edu % Subject: Garden... [ NeWS ] % From: voder!mas1!rhess@ucbvax.Berkeley.EDU (Rich Hess) % % The following NeWS file, garden.ps, was created using the flower routine % previously submitted by reid@decwrl.dec.com (Brian Reid). When you run this % file thru psh, it will create a simple "garden" of what seems to be a variety % of flowers across the bottom of the NeWS root window. The variety is % generated by using random scaling (both x & y) of the flowers and random % jumps to the next flower location. Run the file several times to create % denser looking "gardens". % [ garden.ps ] % original: rhess [ 5-5-88 ] [ NeWS 1.1 ] % ----------------------------------------------------------------------------- % draw a 1-unit-high flower rooted at the current point % (Brian Reid, April 1985) /flower { gsave 1 200 div dup scale currentpoint translate % stem 0 10 moveto -6 7 -7 70 2 95 curveto 6 105 17 152 12 183 curveto gsave 1 setgray 9 setlinewidth stroke grestore 7 setlinewidth stroke % right leaf newpath -20 0 moveto 10 0 lineto 13 35 43 90 71 120 curveto 40 105 -3 40 -20 0 curveto gsave 1 setgray fill grestore 2 setlinewidth stroke % left leaf -20 0 moveto 10 0 lineto 0 40 -30 96 -55 140 curveto -35 85 -19 35 -20 0 curveto gsave 1 setgray fill grestore 2 setlinewidth stroke % petals gsave 12 183 translate 1 0.7 scale /npetals 4 def /petalangle 360 npetals div def 1 setlinewidth /petlength 55 def /dy petalangle sin petlength mul def petalangle 2 div rotate npetals {newpath 0 0 moveto petlength dy petlength dy neg 0 0 curveto gsave 1 setgray fill grestore stroke petalangle rotate} repeat newpath 0 0 12 0 360 arc fill grestore grestore } bind def % ----------------------------------------------------------------------------- /garden { % - => - % create a garden of flowers... [rhess] gsave 100 0 moveto % starting point... 30 30 scale % default scaling... gsave framebuffer setcanvas clippath pathbbox pop exch pop exch pop % width of the framebuffer... grestore 100 sub % stop 100 pixels from right edge... 30 div % scaled stop point... { dup % save a copy of the stop point... currentpoint pop exch gt % is x beyond the stop point?... { pop exit } % [yes] exit... { gsave % [no] random 2 mul random 2 mul scale % scale both x & y...(random) pick-color % pick a random color flower % draw the flower... grestore random 0 rmoveto } % jump to next point...(random) ifelse pause pause pause pause } loop grestore } def ColorDisplay? { /pick-color { random random random setrgbcolor } def } { /pick-color {} def } ifelse % do it... -------------------------------------------------------------------- garden % ------------------------------------------------------------------------