{ (define LIBNAME "An Imperative Drawing Library (HtDC)") (include "head.tinc") }
Add
import idraw.*
at the top of your Definitions Window to import this library.
This idraw
package provides stateful classes and imperative methods
for a visual world. Here is its class diagram of public fields and methods:
import colors.*;
import geometry.*;
+---------------------------------+
| abstract World |
+---------------------------------+ +------------------------------------+
| Canvas theCanvas |------>| Canvas |
+---------------------------------+ +------------------------------------+
| void bigBang(int,int,double) | +------------------------------------+
| World endOfTime(String) | | void show() |
| World endOfWorld(String) | | void close() |
| abstract void onTick() | | void drawCircle(Posn,int,IColor) |
| abstract void onKeyEvent(String)| | void drawDisk(Posn,int,IColor) |
| abstract void draw() | | void drawRect(Posn,int,int,IColor) |
+---------------------------------+ | void drawLine(Posn,Posn,IColor) |
| void drawString(Posn,String) |
+------------------------------------+
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
.