Glimmr Drawing Commands

version 2/101030 by Erik Temple

  • Home page
  • Beginning
  • Previous
  • Next



  • Section: Direct image-maps

    As with bitmaps, we supply an origin point (upper left corner), and in addition, we must supply the dimensions of the tiles. All tiles in the image-map will be rendered at the same size, though the images themselves can be of different sizes. If an image has a different aspect ratio from the tile, the image will be stretched to fit.

    The list that specifies the image-map must use only figure names that have already been defined in the source code before the listing takes place, or compilation errors will occur (define figures at the beginning of the story file, not the end). To specify an empty cell, use Figure of Null; nothing will be drawn for that tile.

    If we like, we may supply a background color, which will draw a rectangle of the specified color before drawing the image-map tiles. For the short form, the "current background-color" global provides the color of the background rectangle ("current foreground-color" has no effect).

        display an image-map in <window> at <origin> using <list of figure names> with tile-size <width> by <height> pixels

        display an image-map in <window> at <origin> using <list of figure names> with tile-size <width> by <height> pixels and background <color>

    Long forms:

        display an image-map in the graphics-window at {25, 25} using {
            { Figure of Red, Figure of Blue },
            { Figure of Blue, Figure of Red },
            { Figure of Red, Figure of Blue } } with tile-size 20 by 20 pixels.

        display an image-map in the graphics-window at 25 by 25 using Checkerboard-definition with tile-size 20 by 20 pixels.

        display an image-map in the graphics-window at {20, 20} using Checkerboard-definition with tile-size 20 by 20 pixels and background (color g-AntiqueWhite).

    Short forms:

        image-map {
            { Figure of Red, Figure of Blue },
            { Figure of Blue, Figure of Red },
            { Figure of Red, Figure of Blue } } at {25, 25} size 20 x 20.

        image-map Checkerboard-definition at {25, 25} size 20 x 20, backgrounded.

    Speed notes:

        Image-maps must display a number of images every time they are redrawn. Their speed is likely faster than drawing the images individually using the "draw image" command. They are likely to perform well in any interpreter that draws images quickly. Direct image-maps should theoretically draw slightly faster than tileset maps, but in practice the extra table-lookup required for tileset maps seems to make little noticeable difference.

        The same speed optimization techniques described for images (see above) apply also to image-maps.