We have presented a simple model for expressing structured graphics in a functional language. The Picture type was introduced, providing a concrete representation of two-dimensional graphical scenes to the functional programmer. As an example of the Picture model in action, a set of basic graph drawing combinators were developed on top of the model.
The Picture type offers yet another demonstration of how straightforward it is to define and use `little languages' in a functional language. By defining a data type Picture containing the core primitives and operators for pictures, full use could be made of the first-class property that values enjoy in a functional language. Using standard combining forms such as foldr and map, the repertoire of Picture combinators could then be readily extended. This ability to create such new abstractions via a little data type is not news to a functional programmer, but the graphics model presented hopefully provides a simple abstraction that will make it easier to use graphics from within a functional program.
An interesting area of future work is how to make the Pictures come alive. In Haggis See section Bibliography[FinnePJ95], layout combinators exist for interactive widgets, that perform operations similar to the tiling Picture combinators used in this paper, and, ideally, we would like to be able to provide a common set of such combinators, covering both static pictures and interactive objects. We are currently experimenting with a basic mechanism for tagging parts of a picture, and through a Painter (see Section See section Rendering pictures) that instead of generating drawing output, tests and records the picking of tagged parts of a Picture, we're able to reuse the generic renderer to perform picking as well as drawing.
Another area for future work would be to try and apply the techniques used here for two dimensional graphics to three dimensions. Promising results have already been achieved by the TBAG system See section Bibliography[Schechter94], which uses a functional model for building three-dimensional interactive worlds.