-
Notifications
You must be signed in to change notification settings - Fork 5
TileShop PatternCodecs
Pattern codecs are defined in XML and allows extremely fine control over remapping pixel locations. However, due to the explicit positioning in pixel remapping, they can never be resized. Patterns are fully reversible, so a single XML description is sufficient to describe both the encoding and decoding process. Pattern codecs are strongly based off of Feidian although there are some subtle differences.
The root element of a pattern 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 |
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] |
| <layout> | Specifies if the format can have many elements per arranger |
tiled or single
|
| <height> | The default height for each element | 1 or larger |
| <width> | The default width for each element | 1 or larger |
| <packing> | Specifies if the image data for a single pixel is contiguous or not |
chunky for contiguous, planar for non-contiguous |
| <mergepriority> | Priority of each image plane's data when merging to form a pixel color | A string containing all numbers from [0, colordepth - 1]. |
| <rowpixelpattern> | Reorders the pixels within a row | 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 or 0, 1 for normal ordering) |
| Attribute | Description | Valid Values |
|---|---|---|
| size | Size of all patterns in bits | [1, 512] and must be an even multiple for the total element size (height * width * colordepth) |
Pattern codecs of packing planar can contain one or more <pattern> items. chunky packing defines a pixel as having contiguous image data, so only one pattern is supported in that case.
Contains a character string describing the layout of pixels. For planar packing, each character must be used 8 times. For chunky packing, they can be used Floor(8 / colordepth) times. Patterns also support repeat filling like Feidian does, so it is not always necessary to specify the entire image.
The valid characters are the same as in Feidian and with the same priority. Note the lack of 0 and 1.
ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz23456789!?@*
<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.