Tecgraf Web Format

writer | reader | applet | plug-in | download | file specification | copyright

TWF (Tecgraf Web Format) is a file format designed to represent a drawing that contains lines, regions, text, and images to be sent through the Web for displaying, browsing, and printing. Its main goal is to allow drawings to be coded into small files without converting vector primitives into raster images. Text, lines, and regions retain their scalable nature, and can be directly selected by the user in the browser screen. Special attention is given to drawings that represent maps and finite element meshes.

A TWF file contains one drawing. A drawing is a set of layers, which are given in the file in back to front order. Each layer has a name that allows interaction with the user interface. The layer may be visible or invisible. If a layer is visible, its elements may or may not respond to mouse events (detectability). If a layer is invisible, none of its elements respond to mouse events.

The elements of a layer are primitives which are also given in the file ordered from back to front. Primitives may be semantically joined into objects. An object has a name which is also exported to the user interface. A plug-in or applet may associate the object name with a URL, script or a pre-defined behavior. This behavior is not included in the TWF file.

A map is an approximate representation of the earth’s surface on a plane. It contains geographical objects which are represented mainly by lines, regions bounded by them, and images. A special characteristic of maps is that borders are represented by very complex polygonal lines. The number of vertices in a map may easily amount to hundreds of thousands. A map may also contain many regions and large images. Line simplifications and other cartographic generalizations are necessary but not enough to reduce map drawings.

The TWF writer and the TWF reader are ANSI C libraries that allow developers to create and read TWF files, respectively. Two different approaches have been taken when implementing viewers for TWF files. The TWF Applet is a Java applet based on the Java 2D API. The TWF Netscape Plug-In is a Netscape Navigator plug-in program based on OpenGL.

TWF has been developed at TeCGraf, the Computer Graphics Technology Group of PUC-Rio (the Pontifical Catholic University of Rio de Janeiro in Brazil). TeCGraf is a laboratory of the Department of Computer Science.

The Team TWF: Marcelo Gattass, Carla Cristina Fonseca Ferreira, Alexandre Sieira Vilar, Mark Stroetzel Glasberg. If you need help or want to send comments, critics, suggestions, etc., please, send a mail to