From: hopkins@turing.ac.uk (Don Hopkins)
Newsgroups: comp.sys.sun.apps,comp.windows.open-look,comp.windows.news
Subject: HyperLook virtual flower garden editor
Date: 21 Jul 92 21:43:41 GMT
Organization: The Turing Institute, Ltd.

Here's a new version of the HyperLook "Flowers" stack, a virtual
flower garden editor! I've added a "Photo" button, which copies an EPS
drawing of your current garden onto the clipboard, so you can paste
the flowers into a HyperLook drawing editor!  I also fixed a bug (in
the earlier version I posted) that broke "Copy Stack as Drawing".

You can run it under the free HyperLook runtime system:
Trim this message and put it in the file "~/stacks/Flowers.stack".
Then press "Open" on the system stack, and type the stack name "Flowers".
Press the "Help" key over the garden to see the credits!

The HyperLook runtime system is availiable for free via anonymous ftp,
from the following systems:

turing.com (192.133.90.28)	pub/HyperLook1.5-runtime.tar.Z
ftp.uu.net (137.39.1.9)		graphics/NeWS/HyperLook1.5-runtime.tar.Z

	-Don

-------- Cut Here --------
% HyperLook stack (c)1992 Turing Institute
% Creator: hopkins
1.5 HLBEGIN
/Stack(Flowers)()BO
[1 0 0 1 0 0] 473 330 null null DG
/HelpText null def
/Objects [/Field(StackName)(/OnStack {	% --
	MyStack /ObjectName get SetValue
} def

/OnOpen {	% --
	OnStack
} def)BO
[1 0 0 1 5 295] 170 30 0 #g null DG
/LucidaSans-BoldItalic 18 0 0.6 0 rgbcolor 1 1 1 rgbcolor true false (Flowers) () DC
/HelpText (This is the title of the stack.) def
/FocusNr 100 def
/GlueN true def
/GlueE false def
/GlueS false def
/GlueW true def
/Editable? false def
/EditTrans? true def
/EditBox? false def
/Number? false def
/MaxLength 0 def
/Adjust /Left def
/ScrollColor 0.6 0.6 0.6 rgbcolor def
/ScrollFill 1 1 1 rgbcolor def
/SelectionColor 0 0 0 rgbcolor def
DO /Button(#IconifyButton)(/Action {	% --
	NIL /IconifyStack MyStack Send
} def

/OnMouse {	% --
	NeedsDraw? {
		DrawingData null eq {/OnMouse super send} {
			Path {
				/Value 0 3 -1 roll 
				{1 add} if store Draw
			} TrackMouse {
				/Value 0 store Draw
				[Value] /Action Self Send
			} if
		} ifelse
	} if
} def)BO
[1 0 0 1 440 300] 20 20 0 #g null DG
/Times-Roman 18 0 0 0 rgbcolor 0.8 0.8 1 rgbcolor true false 0 () DC
/HelpText (This is the close button. Press this button to iconify the stack.) def
/GlueN true def
/GlueE true def
/GlueS false def
/GlueW false def
/Round 10 def
/ButtonWidth 14 def
/ButtonType /Drawing def
/DrawingData BD
MX 0 0 17 16 false Bl false Wh 1 DR [
MX 0 0 16 16 false Bl false Wh 1 DR [
MX 4 4 8 8 true Bl false Wh 1 0 LI
MX 8 0 8 8 true Bl false Wh 1 0 LI
MX 4 0 12 12 true Bl false Wh 1 0 LI
MX 0 4 12 12 true Bl false Wh 1 0 LI
MX 0 8 8 8 true Bl false Wh 1 0 LI
]ME
MX 1 0 16 16 false Bl false Wh 1 DR [
MX 1 5 4 2 true Bl true Wh 1 0 LI
MX 11 9 4 2 true Bl true Wh 1 0 LI
MX 11 7 4 -2 true Bl true Wh 1 0 LI
MX 1 11 4 -2 true Bl true Wh 1 0 LI
MX 2 8 3 0 true Bl true Wh 1 0 LI
MX 11 8 3 0 true Bl true Wh 1 0 LI
MX 8 5 0 -3 true Bl true Wh 1 0 LI
MX 8 14 0 -3 true Bl true Wh 1 0 LI
MX 11 15 -2 -4 true Bl true Wh 1 0 LI
MX 7 5 -2 -4 true Bl true Wh 1 0 LI
MX 9 5 2 -4 true Bl true Wh 1 0 LI
MX 5 15 2 -4 true Bl true Wh 1 0 LI
MX 7 9 2 -2 true Bl true Bl 1 OV
MX 10 6 6 -6 true Bl false Wh 1 0 LI
MX 0 16 6 -6 true Bl false Wh 1 0 LI
MX 0 0 6 6 true Bl false Wh 1 0 LI
MX 10 10 6 6 true Bl false Wh 1 0 LI
]ME
]336 472 ME ED def
/Alternating? true def
DO /StackEditor(#StackEditor)()BO
[1 0 0 1 0 0] 10 10 0 #g null DG
/Times-Roman 18 0 0 0 rgbcolor 1 1 1 rgbcolor false false null () DC
/EditInvisible? true def
/EditorGrid 5 def
/EditBorder 10 def
/PasteTo /Card def
DO] def
/CardList [/Card(#5)()BO
[1 0 0 1 0 0] 0 0 /BackGround(#0)()BO
[1 0 0 1 0 0] 0 0 0 #g null DG
/Objects [] def
DO null DG
/HelpText [(This is the flower editor.\nSelect the flower parameters and pres)
(s "Grow" to make more flowers. Press "Weed" to get rid of all th)
(e flowers.\nPoint at the garden and press "Help" for more info.)]MS def
/Objects [/ColorSelect(Color)()BO
[1 0 0 1 35 270] 80 20 29 #g null DG
/LucidaSans-Bold 14 0 0 0 rgbcolor 1 1 1 rgbcolor true false 1 0.87 0.75 rgbcolor (Color) DC
/HelpText [(Press the left mouse button down on this color selector and sele)
(ct from the color menu, to choose a color for the flowers. \n\nYou)
( can put your own colors on the menu with the ColorPallet stack )
(\(available from the "Tools" menu of the system stack\).\n)]MS def
/GlueN false def
/GlueE false def
/GlueS false def
/GlueW false def
DO /PullDown(#2)(/Action {
  cvi [exch] /SetValue /Flowers Send
} def)BO
[1 0 0 1 10 210] 105 20 29 #g null DG
/LucidaSans-Bold 14 0 0 0 rgbcolor 0 0.9 0 rgbcolor true false [(1) (2) (5) (10) (20)] (Flowers) DC
/HelpText [(Press the left button down over this pulldown menu to set the nu)
(mber of flowers, or use the slider to the right. Then press "Gro)
(w" to grow some flowers.)]MS def
/GlueN false def
/GlueE false def
/GlueS false def
/GlueW false def
/ShadowSize 3 def
/ShadowColor 0.6 0.6 0.6 rgbcolor def
/MenuFillColor 1 1 1 rgbcolor def
/SetLabel? false def
/MenuFontName /LucidaSans def
/MenuFontSize 14 def
DO /Slider(Flowers)()BO
[1 0 0 1 125 210] 340 20 29 #g null DG
/LucidaSans-Bold 14 0 0 0 rgbcolor 0.8 0.45 0.41 rgbcolor true false 10 () DC
/HelpText [(Click the left mouse button on this slider to set the number of )
(flowers, or use the pulldown menu to the left. Then press "Grow")
( to grow some flowers.)]MS def
/GlueN false def
/GlueE true def
/GlueS true def
/GlueW true def
/SliderType /Bar def
/Box? false def
/ShowValue? true def
/Vertical? false def
/Editable? true def
/MinValue 1 def
/MaxValue 20 def
/ValueColor 0 0.9 0 rgbcolor def
DO /Button(#7)(/Action {
  [ /Value MyStack /Flowers FindObject send
    /Value MyStack /Petals FindObject send
    /Value MyStack /Color FindObject send
  ] /Grow /Garden Send
} def)BO
[1 0 0 1 125 270] 70 20 29 #g null DG
/LucidaSans-Bold 14 0 0 0 rgbcolor 0 0.9 0 rgbcolor true false 0 (Grow) DC
/HelpText (Click the left mouse button on this button to grow some flowers, according to the current settings.) def
/GlueN false def
/GlueE false def
/GlueS false def
/GlueW false def
/Round 25 def
/ButtonWidth 14 def
/ButtonType /Push def
/DrawingData null def
DO /PullDown(#8)(/Action {
  cvi [exch] /SetValue /Petals Send
} def)BO
[1 0 0 1 10 240] 105 20 29 #g null DG
/LucidaSans-Bold 14 0 0 0 rgbcolor 0 0.9 0 rgbcolor true false [(4) (8) (12) (16) (32)] (Petals) DC
/HelpText [(Press the left button down over this pulldown menu to set the nu)
(mber of flower petals, or use the slider to the right. Then pres)
(s "Grow" to grow some flowers.)]MS def
/GlueN false def
/GlueE false def
/GlueS false def
/GlueW false def
/ShadowSize 3 def
/ShadowColor 0.6 0.6 0.6 rgbcolor def
/MenuFillColor 1 1 1 rgbcolor def
/SetLabel? false def
/MenuFontName /LucidaSans def
/MenuFontSize 14 def
DO /Slider(Petals)()BO
[1 0 0 1 125 240] 340 20 29 #g null DG
/LucidaSans-Bold 14 0 0 0 rgbcolor 0.8 0.45 0.41 rgbcolor true false 8 () DC
/HelpText [(Click the left mouse button on this slider to set the number of )
(flower petals, or use the pulldown menu to the left. Then press )
("Grow" to grow some flowers.)]MS def
/GlueN false def
/GlueE true def
/GlueS true def
/GlueW true def
/SliderType /Bar def
/Box? false def
/ShowValue? true def
/Vertical? false def
/Editable? true def
/MinValue 3 def
/MaxValue 32 def
/ValueColor 0 0.9 0 rgbcolor def
DO /Button(#10)(/Action {
  NIL /Weed /Garden Send
} def)BO
[1 0 0 1 205 270] 70 20 29 #g null DG
/LucidaSans-Bold 14 0 0 0 rgbcolor 0.8 0.45 0.41 rgbcolor true false 0 (Weed) DC
/HelpText (Click the left mouse button on this button to weed out all the flowers and start with a fresh garden.) def
/GlueN false def
/GlueE false def
/GlueS false def
/GlueW false def
/Round 25 def
/ButtonWidth 14 def
/ButtonType /Push def
/DrawingData null def
DO /Button(#1)(/Action {
  NIL /Photograph /Garden Send
} def)BO
[1 0 0 1 285 270] 70 20 29 #g null DG
/LucidaSans-Bold 14 0 0 0 rgbcolor 1 1 1 rgbcolor true false 0 (Photo) DC
/HelpText [(Click the left mouse button on this button to take a photograph )
(of the garden and copy it to the Clipboard as a drawing. It take)
(s a moment to develop the film. Then you can paste it into a dra)
(wing editor!)]MS def
/GlueN false def
/GlueE false def
/GlueS false def
/GlueW false def
/Round 25 def
/ButtonWidth 14 def
/ButtonType /Push def
/DrawingData null def
DO /Button(Garden)(  /OnMouse {
    OnHelp
  } def

  /ReSeed {
    /StartSeed currenttime 1 get def
    /EndSeed StartSeed def
  } def
  
  /StartSeed currenttime 1 get pers def
  /EndSeed StartSeed pers def

  /NumberOfFlowers 1 def
  /FlowerColor 1 0 0 rgbcolor def
  /Petals 4 def

  /Flowers [] pers def

  /PetAngle 90 def
  /PetLength 55 def

  /background ColorDict /LightBlue get def
  /black ColorDict /Black get def
  /yellow ColorDict /Yellow get def
  /green ColorDict /Green get def

  /Flower { % - => -
    pause
    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
      0 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
      0 setlinewidth
      stroke
      %petals 
      gsave
        12 183 translate
        1 0.7 scale
        0 setlinewidth
        /dy PetAngle sin PetLength mul def PetAngle 2 div rotate
        Petals {
          newpath 0 0 moveto
          PetLength dy PetLength dy neg 0 0 curveto
          gsave
            FlowerColor 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
  } def

  /FlowerBed { % - => -
    gsave
      newpath 0 0 Width Height rectpath clip newpath
      /PetAngle 360 Petals div def
      Width NumberOfFlowers 25 mul sub 2 div 0 moveto
      50 50 scale
      NumberOfFlowers {
        gsave
          random .2 add 2 mul random .2 add 2 mul scale
          Flower
        grestore
        random 0 rmoveto
      } repeat
    grestore
  } def

  /Weed {
    /Flowers nullarray def
    ReSeed
    Update
  } def 

  /Grow { % flowers petals color => -
    EndSeed srand
    /FlowerColor exch def /Petals exch def /NumberOfFlowers exch def
    gsave
      SetCanvas
      FlowerBed
    grestore
    /Flowers
      Flowers [ [NumberOfFlowers Petals FlowerColor] ] append
    def
    /EndSeed rrand def
  } def

  /Draw {
    NeedsDraw? {
      StartSeed srand
      Flowers {
        aload pop
        /FlowerColor exch def /Petals exch def /NumberOfFlowers exch def
        FlowerBed
      } forall
      /EndSeed rrand def
    } if
  } def
 
   /Photograph {
     [\(Please wait while the film develops ...\)] ShowMessage
     CopyAsDrawing
     /Clipboard ShowStack
     [\(The picture is now on the Clipboard, which you can paste into a drawing editor.\)] ShowMessage
   } def
   )BO
[1 0 0 1 10 10] 455 190 29 #g null DG
/LucidaSans-Bold 14 0 0 0 rgbcolor 1 1 1 rgbcolor true false 0 (Grow) DC
/HelpText [(This is the virtual garden and you are the gardener.\n\nThe origin)
(al flower program was written by Brian Reid \(April '85\), then Ri)
(ch Hess added more fun to it \(May '88\). It scattered randomly si)
(zed black and white flowers along the bottom of the screen. They)
( were about an inch tall.  I adapted it to large colorful flower)
(s. Then I got ambitious because I liked too many different varia)
(tions and I made one where I could change my garden interactivel)
(y, rather than rewriting the code every time I wanted a new colo)
(r. \n\nFeel free to distribute, but give the authors credit.\n\nElai)
(ne "booter" Richards - June 28, 1988\n        Wrote interactive f)
(lower editor for NeWS.\n\nDimitri.Theulings@UK.Sun.COM - July 17, )
(1992\n        Rewritten for OpenWindows v3.\n        Also added a )
('Weed' option to clear the garden.\n\nDon Hopkins, hopkins@turing.)
(com - July 21, 1992\n        Rewritten for HyperLook. \n)]MS def
/GlueN false def
/GlueE false def
/GlueS false def
/GlueW false def
/Round 25 def
/ButtonWidth 14 def
/ButtonType /Push def
/DrawingData null def
/StartSeed 285311 def
/EndSeed -2088676008 def
/Flowers [[5 8 1 1 0 rgbcolor] [5 8 1 1 0 rgbcolor] [5 4 1 0 0 rgbcolor] [2 12 0.75 0 1 rgbcolor]] def
DO] def
DO] def
/Creator (hopkins) def
/Cdate (Tue 21 Jul 1992 2:53) def
/TrashDelay 10 def
/StackShape BD
MX 0 0 472 328 false Bl false Wh 1 DR [
MX 0 0 472 328 true Bl true 0.8 0.8 1 1 RE
]120 296 ME ED def
/StackPath {0 0 moveto 0 329 lineto 473 329 lineto 473 0 lineto closepath} def
/SaveBehind false def
/Retained false def
/Drag true def
/Resizable? false def
/ScreenX 668 def
/ScreenY 3 def
/MinWidth 400 def
/MinHeight 300 def
DO HLEND