Glimmr Canvas-Based Drawing

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Chapter - Image-map base class

    An image-map is a kind of g-element.

    The specification of an image-map is "An image-map element draws a rectangular image composed of individual images arranged in a strict grid. The author specifies the grid of images in the form of a list of lists (multi-dimensional array).

    An image-map can be specified with 'background tint', a glulx color value (see Basic Screen Effects) that will appear wherever the array of the image-map has a null value, and/or it will show through transparent PNG images.

    Like other g-elements, an image-map can have a graphic hyperlink specified using the 'linked replacement command'. However, the tiles of an image-map grid can also be individually hyperlinked. To do this, we must specify the 'tiled graphlink status' of an image-map to be 'g-active'. More critically, we must also specify a separate array (the 'linked command array,' a list of lists of texts), the same size as the array of images defining the image-map, that provides the command for each figure. The creation of these lists can be largely automated using conversion tables and special phrases--it is almost never necessary to specify them by hand.

    There are two types of image-map, distinguished by the kind of data used to define the list array. In a 'tileset image-map', the array is called the 'tile-array' and consists of a list of numbers that are keyed to a tileset. The tileset is simply a translation table that specifies which numbers in the array correspond to which figure names. The arrays of tileset image-maps are concise and generally human-readable; that is, they can be arranged in a grid in source code and graphically resemble the final map.

    In a direct image-map, the figure names of the images are specified directly; there is no tileset. Direct image-maps are more verbose and generally more difficult to create and read by hand; for anything larger than a few grid squares, most users will want to specify direct image-maps using an automated process rather than type them in by hand."

    An image-map has a glulx color value called the background tint. The background tint of an image-map is g-PlaceNullCol.

    An image-map has a list of lists of texts called the linked command array. The linked command array of an image-map is {}.

    An image-map has a g-activity called tiled graphlink status. The tiled graphlink status of an image-map is g-inactive.

    Definition: An image-map (called the item) is tile-graphlinked if the tiled graphlink status of the item is g-active.

    To activate tiled graphlink/graphlinks to/for/of (element - an image-map):
        now the tiled graphlink status of the element is g-active.

    To remove/deactivate tiled graphlink/graphlinks of/from/for (element - an image-map):
        now the tiled graphlink status of the element is g-inactive.

    [The grid-tile-width and grid-tile-height are set automatically by the extension. Authors should not need to refer to them.]

    An image-map has a number called the scaled tile-width. The scaled tile-width of an image-map is 0.

    An image-map has a number called the scaled tile-height. The scaled tile-height of an image-map is 0.