Designing Games with Xconq - Image Families

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

## Image Families

The `imf` form defines graphical images in a platform-independent way. An image family is a named collection of images of varying sizes and depths.

Form: `imf` name [ properties ] [ images ]

This form declares an image family to exist, with the name name and properties, and consisting of the specified images. Each image has the form

    ((w h special) [ properties ] (type data...) ...)

where w and h are its width and height, respectively, special indicates special characteristics of the image, the type may be one of `color`, `mono`, `mask`, or `file`, and the data consists of strings of hexadecimal digits. The data strings may include slashes, which have no effect on interpretation, but are useful to indicate each row of an image. Color images may also have additional properties, which come between the type and the data.

The family's name may consist only of alphabetic characters, decimal digits, and hyphens or underscores. Upper- and lower-case characters are equivalent, as are hyphens and underscores. The canonical form of the name is lowercase with hyphens.

Multiple forms with the same name may occur, and each adds to the family, overwriting individual image parts that are of the same size and depth.

Symbol: `tile`

If this symbol appears following the dimensions of an image, it indicates that the image is a pattern tile rather than a single image.

Symbol: `border`

If this symbol appears following the dimensions of an image, it indicates that the image is a set of images for border terrain. Borders have 16 subimages, each showing a different sort of junction between cells.

Symbol: `connection`

If this symbol appears following the dimensions of an image, it indicates that the image is a set of images for connection terrain. Connections have 64 subimages, each for a different pattern of connectons to adjacent cells.

Symbol: `transition`

This symbol indicates that the terrain is a transition pattern used to blend two types of terrain. Transitions consist of at least 4 subimages, and may have several variants that can be chosen randomly.

ImageProperty: `actual` w h

This property is the actual size of the image data.

ImageProperty: `embed` name

This property specifies that another image, similar to the image family named by name, is already embedded within the image, and so Xconq need not superimpose such an image itself. This may occur when an image has a "builtin" side emblem, or is readily identifiable as belonging to a particular side, and it would be redundant for Xconq to add an emblem when displaying a unit.

ImageProperty: `embed-at` x y

This property specifies that the area of the image at x,y is suitable for the display of an emblem.

ImageProperty: `embed-size` w h

This property specifies the dimensions of the area available for an emblem.

ImageProperty: `x` n [ x y ]

This property specifies that the image includes n variant subimages, any of which may be randomly chosen by an interface. The optional numbers x and y indicate the offset of each subimage, so for instance an x of 32 and a y of 0 indicates a horizontal strip of images, each 32 pixels apart. Their values default to the width of the image and 0, respectively.

ImageProperty: `notes` list

This property is for designer notes about the image.

ImageProperty: `mono` data ...

This property indicates that the data represents a monochrome image.

ImageProperty: `mask` data ...

This property indicates that the data represents a mask.

ImageProperty: `color` [ properties ] data ...

This property indicates that the data represents a color image.

ColorImageProperty: `pixel-size` n

This property is the number of bits used to encode each pixel.

ColorImageProperty: `palette` [ (index r g b) ... ]

This property is the color palette that should be used with the image.

ImageProperty: `file` filename [ `std` ] [ x y ]

This property indicates that the image data is in a file named filename. filename must contain a recognized type of image (GIF only, at present). The optional x and y indicate the position of the upper left corner of the image within the larger picture contained in the file.

If the optional symbol `std` precedes the position values, then the numbers are relative positions in a file image that is assumed to be a grid of images all the same size. It is also assumed that images are separated by two pixels on all sides, so the pixel position is `2 + (x * (img_width + 2))`.

File images do not have explicit masks, but may instead have key colors that will be used to compute the mask. Key colors are indicated by 2x2 pixel blocks in the upper left corner of the file image. Any number of key colors may be defined; the end of the list is indicated by a block of the same color as the first block. (See ``images/river44x48.gif'` for an example with many key colors.)

Symbol: `std`

This symbol, when in a `file` property, indicates that the file image is laid out in a standard grid pattern. (see above)

Note that for the purposes of stability and change tracking, tools that generate image families use a more restricted format. This format requires a separate imf form for each size of image, the size is on the same line as the imf name, and each image/mask is on a separate line, indented by 2. (See the existing library imf files for further detail.)

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