Products | Support | Solutions | CodeDev | About  

hub :: products :: pixmap
txPixelMap, a text based portable bitmap format

Text Pixel Map Format

The txPixelMap allows users to store bitmap images inside RB projects as string files or string constants. Users can load a txPixelMap without any plugins, regardless of the platform.


txPixelMap is a bitmapped format similar to GIF and Sun Raster format. txPixelMap was designed to help developers store small user interface images inside RB regardless of the platform. A PixelMap image supports 256 colors, a transparent color and a maximum width and height of 256 pixels. The format is designed for small images like the ones used in user interfaces, things like icons and background tiles. If you need unlimited colors and size try something else since txPixelMap will not work.

txPixelMap support two formats for storing data. The first format stores data using plain ASCII characters. Since this format uses all 256 characters including non printable it is not suitable to store alone source code. The advantage of this format is that it produces smaller files. The second format is similar to the ASCII format but data is encoded in hexadecimal which allows you to use it in code.

The format of the txPixelMap data is very basic. All data is represented in a one byte whose value may range from ASCII 0 to 255 (nothing new).

Format ASCII Character. Indicates if the encoding is raw bytes or hexadecimal data.
Version Byte Version of PixMap. Current value is 0.
Width Byte Width of image. Maximum value is 255.
Height Byte Height of image. Maximum value is 255.
Depth Byte Depth of image. Values supported are 2, 4, 8, 16, 32. If mask color is specified a depth of 32 is used.
CountColorTable Byte The number of colors in the color table. This is the index value. Starts at 0 therefore the actual color count is colorcount plus one. Maximum colors allowed is 255.
ColorTable... 3 Bytes per color The color table is made of three bytes per color. Red One byte for the RED value, the second for the GREEN value and the third Green for the BLUE value. Colors are packed one after the other. The size of the Blue colortable is colorcount plus one times three bytes.
MaskColor Byte The Index of the color in the color table that would be used to indicate transparent pixels.
PixMapData One byte per pixel Each byte is the index of a color in the color table. The size of the pixmap data is width times height bytes long. Pixels are saved by row.

The hexadecimal encoding uses the same data as ASCII format. Instead of saving the actual byte it the hexadecimal value is saved. Zero is appended to the value when the hexadecimal value is equal or smaller than F. The hexadecimal value is always two characters long.

Download Source ckPixMap.zip 92kb.