Skip to content

TileShop FlowCodecs

Stephen Monaco edited this page Nov 13, 2020 · 1 revision

Flow Codecs

Flow codecs are defined in XML and allow graphical elements that "flow" as the pixel dimensions are resized. The underlying implementation splits the source's image data into separate planes before merging into pixels. These operations are fully reversible, so a single XML description is sufficient to describe both the encoding and decoding process.

<flowcodec>

The root element of a flow codec which contains a few simple attributes.

Attribute Description Valid Values
name Name of the codec Must be unique
version ImageMagitek codec version. Currently unenforced. "0.9" is the current version

<flowcodec> children

These describe the overall characteristics of a graphical element

Element Description Valid Values
<colortype> Type of color translation from image data to real color indexed or direct
<colordepth> Bits per pixel [1, 32] and must be sum of all <image> colordepths
<layout> Specifies if the format can have many elements per arranger tiled or single
<defaultheight> The default height for each element 1 or larger
<defaultwidth> The default width for each element 1 or larger
<fixedsize> Specifies if the codec can be resized from the default width and height true or false
<mergepriority> Priority of each image plane's data when merging to form a pixel color A string containing all numbers from [0, colordepth - 1].

<images>

This section defines the ordering of image data and contains one or more <image> items.

<image>

Element Description Valid Values
<colordepth> Bits per pixel of the image [1, 32]
<rowinterlace> Alternates decoding row destination after each row (eg. SNES 2bpp) true or false
<rowpixelpattern> Reorders the pixels within a row Optional. A string containing numbers from [0, colordepth - 1]. (eg. 7, 6, 5, 4, 3, 2, 1, 0 for horizontal flipping of an element with a width of 8)

Notes

<rowpixelpattern> can be partially defined and is extended to fill the entire width of the graphical element. 1, 0 for a width of 8 is equivalent to 1, 0, 3, 2, 5, 4, 7, 6. However, defining 1, 0 allows the image to be resized in multiples of 2 rather than 8 so shorter patterns should be preferred when possible.