Go to the first, previous, next, last section, table of contents.

Picture basics

Graphics is an under-used resource in applications. To avoid having to delve into inch-thick manuals to produce the simplest of outputs, textual output is often used, for better or worse. This is a somewhat unfortunate situation, as graphics capabilities aren't made use of by applications to better visualise their output. Simple graphics should be simple to express and make use of in a program See section Bibliography.

We present in this paper a simple structured graphics model for expressing two-dimensional graphical scenes using a functional language. The declarative model is expressed using a data type called `Picture', and the paper presents and explores the expressiveness of the model, comparing and contrasting it with existing techniques for expressing two-dimensional graphics.

The idea of using a functional language to describe graphics is by no means a novel one, see See section Bibliography[Bartlett91,Bec91,LucasZilles87,ChaillouxCousineau92,Hender82,Arya89]. Our design has been influenced by this previous work and builds on it by providing a more abstract account of picture composition. As an example, a basic operator like horizontal tiling of two pictures is not provided as a primitive in our model, instead a mechanism called structured translation is used to abstractly express the horizontal tiling combinator in terms of more primitive constructs. The advantage of providing such abstract glue for writing picture combinators is that the set of composition operators can readily be extended by the programmer if the set already provided doesn't fit the task at hand.

The graphics model presented is independent from a particular graphics system, and a generic renderer that traverses the representation of a picture to perhaps produce graphical output has been implemented. The renderer is parameterised on the low-level commands needed to draw a fixed set of primitives, so to map the picture type to a new graphics system, you just have to provide an instance for each of these drawing methods (See section Rendering pictures.) The functional renderer will then perform the computations required to map the picture description into a sequence of calls to the drawing operations it is given.

The graphics model and accompanying renderer forms the basis for graphical output to both workstation and printer in HaggisSee section Bibliography[FinnePeytonJones95], a user interface framework written in Concurrent HaskellSee section Bibliography[PeytonJonesGordonFinne96]. The figures given in this paper are pictures produced using the system described here, mapping the picture to Encapsulated PostScript\cite{Adobe90}(1) after having first viewed it on a workstation display using Haggis.


Go to the first, previous, next, last section, table of contents.