#!/usr/NeWS/bin/psh % Path: mimsy!eneevax!umd5!ames!zodiac!deimos!booter % From: booter@deimos.ads.com (Elaine Richards) % Newsgroups: comp.lang.postscript % Subject: Summer Gardening % Message-ID: <4631@zodiac.UUCP> % Date: 28 Jun 88 20:48:49 GMT % Sender: news@zodiac.UUCP % Reply-To: booter@ads.com (Elaine Richards) % Organization: The Trenches of CFG % Lines: 188 % % This is the virtual garden and you are the gardener. % % The original flower program was written by Brian Reid (Apr '85),then Rich Hess % added more fun to it (May '88). It scattered randomly sized black and white % flowers along the bottom of the screen. They were about an inch tall. % I adapted it to large colorful flowers. Then I got ambitious because I liked % too many different variations and I made one where I could change my % garden interactively, rather than rewriting the code every time I wanted % a new color.Caveat: Sometimes the window manager times out. Also, I have % never run this on a black and white monitor. % % To execute, crank up NeWS on your Sun and psh the program. There is a menu % in it to change various characteristics of the flowers. You can also add % the poundsign-bang-psh line to just plain run it. % % Elaine "booter" Richards June 28, 1988 % % Feel free to distribute, but give the three authors some credit. % Remember to edit out the headers :-) /red ColorDict /Red get def /blue ColorDict /Blue get def /yellow ColorDict /Yellow get def /green ColorDict /Green get def /lavender ColorDict /Orchid get def /thistle ColorDict /Thistle get def /pink ColorDict /Plum get def /orange ColorDict /Orange get def /background ColorDict /LightBlue get def /black ColorDict /Black get def %Common Bootist typo /pathbox {pathbbox} def /gardenlabel { numberofflowers petangle npetals ( % Petals % Petangle % Flowers )sprintf }def /paintflower { win /FrameLabel gardenlabel put /paint win send } def /npetals 4 def /petangle 360 npetals div def /thecurrentcolor red def /numberofflowers 1 def % /flower { gsave black setcolor 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 black setcolor 9 setlinewidth stroke grestore 5 setlinewidth green setcolor 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 green setcolor fill grestore black setcolor 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 green setcolor fill grestore 2 setlinewidth stroke %petals gsave 12 183 translate 1 0.7 scale 1 setlinewidth /petlength 55 def /dy petangle sin petlength mul def petangle 2 div rotate npetals { newpath 0 0 moveto petlength dy petlength dy neg 0 0 curveto gsave thecurrentcolor setcolor fill grestore black setcolor stroke %cartoony line around flowers petangle rotate } repeat %center of flower yellow setcolor newpath 0 0 12 0 360 arc fill newpath 0 0 12 0 360 arc black setcolor stroke grestore grestore } bind def % /garden{ gsave 100 0 moveto 130 130 scale gsave framebuffer setcanvas clippath pathbbox pop exch pop exch pop grestore 100 sub 130 div %conditional where dup currentpoint pop exch gt %then {pop exit} %else { numberofflowers{ gsave random 2 mul random 2 mul scale flower grestore random 0 rmoveto }repeat } ifelse grestore } def /drawicon{ gsave 50 0 moveto 30 30 scale flower grestore }def /makegarden { gsave background fillcanvas garden clippath grestore } def /Draw { makegarden} def /getmenunumber {/currentkey self send cvi} def /main { % % Submenus % /numberofpetalmenu [ (4) (8) (12) (16) (32) ] [ {/npetals getmenunumber store /petangle 360 npetals div store paintflower}] /new DefaultMenu send def /petanglemenu [ (360) (780) ] [ { /petangle getmenunumber npetals div store paintflower}] /new DefaultMenu send def /numberofflowersmenu [ (1) (2) (5) (10) ] [ { /numberofflowers getmenunumber store paintflower}] /new DefaultMenu send def /colormenu [ (red) {/thecurrentcolor red store paintflower} (blue) {/thecurrentcolor blue store paintflower} (orange) {/thecurrentcolor orange store paintflower} (pink) {/thecurrentcolor pink store paintflower} (thistle) {/thecurrentcolor thistle store paintflower} ] /new DefaultMenu send def % /win framebuffer /new DefaultWindow send def % Create a window { /FrameLabel gardenlabel def /PaintClient {Draw } def /PaintIcon {drawicon} def /ClientMenu [ (Petals => ) numberofpetalmenu (Angle of Petals =>) petanglemenu (Number of Flowers =>) numberofflowersmenu (Colors =>) colormenu (Quit) {currentprocess killprocessgroup} ] /new DefaultMenu send def } win send /reshapefromuser win send /map win send } def main