Image Decoding

The image decoding library lets you take incoming queries generated by the offset of the mouse click in an image (using certain browsers like NCSA Mosaic 1.1 or later) and translate them to different documents.

There are currently two methods supported for image decoding, bitmasks and rectangles (it would be great if someone did an interface for WAIS spatial indexing :-).

Bitmasks require that you edit bitmaps and set the pixels in each bitmask corrisponding to each object (one bitmask per object). I use xv to convert the image to an X11 bitmap (using B&W dithering) then edit each file with bitmap setting the bits in the image that corrispond to the object. Then you must convert the xbm files to raw data (by writing the resulting filename_bits[] array to a file using a C wrapper and the write() system call).

For rectangles you simply need to know all the bounding boxes of the various objects.

The server reads a configuration file specified by $MAP_CONFIG_FILE in the config file. It consists of lines like:

walk config-file server/walk/walk.map
...
walk default server/walk/default.html
walk bitmask server/walk/astronaut.mask 106 110 server/walk/astronaut.html
walk bitmask server/walk/camera.mask 106 110 server/walk/camera.html
walk bitmask server/walk/earth.mask 106 110 server/walk/earth.html
walk bitmask server/walk/pack.mask 106 110 server/walk/pack.html
walk rect 0 0 106 110 server/walk/space.html
The first item on the line is the thing that is being mapped. This is the logical name you assign when you map the decoder in the main config file (e.g., $map{'walk'} = '&do_decode($_, $query);';). The second item (default, bitmask, rect, config-file) determines the action taken for each line. 'default' is the action used if there was no $query. 'bitmask' tests for the bit in the mask file, if it's set it returns the specified file (Note the width and height must currently be specified for mask files). 'rect' tests to see if the selection occured in the rectangle specifed by the x, y, width, height data specifed, if so the it returns the document. 'config-file' loads the specified file as another map configuration file and searches it again. Notice that the last line ("walk rect...") is used as a catch all, but differs from 'default'. 'default' is used if there was no query sent from the browser which is the case with old browsers that don't support the ISMAP flag. See the walk example source and the demo that uses it.

Thanks to Chris McRae <mcrae@ckm.ucsf.edu> who made configuration files for the image decoding stuff and added the rectangle decoding. Before you had to write special perl code for each one, now it's easy to add hotspots in images.

________________________________________

Tony Sanders