diff --git a/teachpack/htdc/Docs/draw.thtml b/teachpack/htdc/Docs/draw.thtml index 984812c36c..9da6301966 100644 --- a/teachpack/htdc/Docs/draw.thtml +++ b/teachpack/htdc/Docs/draw.thtml @@ -1,7 +1,7 @@ { (define LIBNAME "A Functional Drawing Library (HtDC)") (include "head.tinc") } -This `draw' package provides classes and methods for a visual +This draw package provides classes and methods for a visual world. Here is its class diagram of public fields and methods:
 
@@ -11,9 +11,9 @@ world. Here is its class diagram of public fields and methods:
  | Canvas theCanvas                  |------>| Canvas                                |
  +-----------------------------------+       +---------------------------------------+
  | boolean bigBang(int,int,double)   |       +---------------------------------------+
- | boolean endOfTime()               |       | boolean start(int,int)                |
- | boolean endOfWorld()              |       | boolean stop()                        |
- | World lastWorld()                 |       | boolean drawCircle(Posn,int,Color)    |
+ | boolean endOfTime()               |       | boolean show()                        |
+ | World endOfWorld()                |       | boolean close()                       |
+ |                                   |       | boolean drawCircle(Posn,int,Color)    |
  |                                   |       | boolean drawDisk(Posn,int,Color)      |
  | abstract World onTick()           |       | boolean drawRect(Posn,int,int,Color)  |
  | abstract World onKeyEvent(String) |       | boolean drawLine(Posn,Posn,Color)     |
@@ -46,4 +46,125 @@ world. Here is its class diagram of public fields and methods:
 
 
+ +

The abstract World class exports the following methods: +

+The methods may fail due to the unavailability of the physical devices, +inappropriate uses, etc. In those cases, they fail with an exception.

+ +

A derived concrete class must supply definitions for the following methods: +

+A program may, in principle, start several instances of (subclasses of) +World. If it does, the event handlers are called in a unpredictable +order.

+ + +

To create an instance of the Canvas class, a program must supply +two int values: one for the width of the canvas and one for its +height. The canvas is a rectangle, whose borders are parallel to the computer +screen's borders. A program can use the following methods on instances of +Canvas: +

+The methods may fail due to the unavailability of the physical devices, +inappropriate uses, etc. In those cases, they fail with an exception.

+

+ +

To create an instance of the Posn class, a program must supply +two int values: one for its x coordinate of the canvas and the +second for its y coordinate.

+ +

The Color class is abstract. Its variants (subclasses) are +created with no arguments. +

+ {(include "foot.tinc")} diff --git a/teachpack/htdc/Docs/idraw.thtml b/teachpack/htdc/Docs/idraw.thtml index 2c667900d8..cf04d0bee0 100644 --- a/teachpack/htdc/Docs/idraw.thtml +++ b/teachpack/htdc/Docs/idraw.thtml @@ -2,11 +2,14 @@ (include "head.tinc") } -This `idraw' package provides classes and imperative methods for -a visual world. Here is its class diagram of public fields and methods: +This idraw package provides stateful classes and imperative methods +for a visual world. Here is its class diagram of public fields and methods:
 
+import draw.Color; 
+import draw.Posn; 
+
   +---------------------------------+     
   | abstract World                  |
   +---------------------------------+       +------------------------------------+
@@ -25,28 +28,18 @@ a visual world. Here is its class diagram of public fields and methods:
                                             | void clearRect(Posn,int,int,Color) |
                                             | void clearLine(Posn,Posn,Color)    |
                                             +------------------------------------+
-
-                      +----------+
-                      | Posn     |
-                      +----------+
-                      | int x    |
-                      | int y    |
-                      +----------+
-
-                              +-------+
-                              | Color |
-                              +-------+
-                                  |
-                                 / \
-                                 ---
-                                  |
-             ------------------------------------------
-             |          |         |         |         |     
-         +-------+  +-------+ +-------+ +-------+ +-------+  
-         | Blue  |  | Green | | Red   | | White | | Yellow| 
-         +-------+  +-------+ +-------+ +-------+ +-------+ 
-
 
 
+

The abstract World class in idraw provides the same +methods as the World class in the +draw library. Their return values are usually void, +however, except for endOfTime and endOfWorld, which +continue to return the last world.

+ +

In an analogous manner, the methods in the Canvas class export +the same methods as the Canvas class in the draw package. Their return values, +however, are void.

+ {(include "foot.tinc")}