Graphic file formats

From Ninerpedia
Revision as of 12:49, 20 February 2013 by Mizapf (talk | contribs) (→‎MyArt format)
Jump to navigation Jump to search

TI ARTIST format

The TI ARTIST file format actually involves two files, a pattern and a color file. Both are stored on the file system as a file ending with "_P" and "_C", respectively.

This is just a dump of the pattern table and the color table as used in the bitmap mode of the Video Display Processor. Accordingly, each file is 6144 bytes long.

MyArt format

Images for MyArt (Geneve painting program) are saved in the following format:

0 1 2 3 4 5 6 7
0x00 Background Flags Color 0 Color 1 Color 2
0x08 Color 3 Color 4 Color 5 Color 6
0x10 Color 7 Color 8 Color 9 Color 10
0x18 Color 11 Color 12 Color 13 Color 14
0x20 Color 15 Line Line Line
... ... ... ... ...

The flag byte in position 1 varies between different programs (MyArt, YAPP etc.).

For the G7 graphics mode (256 columns, 256 colors) the line segments immediately start with byte 2. The 512 column mode (G6) uses an indexed color mode, so the file starts with a sequence of palette color definitions before the line segments.

Common values for the flag byte are 0x9E and 0xFA as used in MyArt (both G6), possibly as a version indicator. MyArt does not use a header for G7 files (picture data begin right at the start) and does not use interlace.

Barry Boone's MyArt loader considers 0xFF as indication for the G6 mode.

According to the documentation of the XHi program (A. Hulpke), the Austrian MYLOAD tool uses bits 4-6 for the mode bits M5, M4, M3 of video register 0, i.e. for 512 columns (G6) it is expected to be xxxx1010, and for 256 columns (G7) it is xxxx1110.

Color palette definition

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 Red 0 Blue 0 0 0 0 0 Green

Although only 3 bits are available for color definition, MyArt sometimes creates seemingly meaningless bits at positions 8-12.

Line entries

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Color 0 0 Length

where length can be any value from 0x001 - 0x200 (1-512). Each line element is a sequence of pixels of the given color and the given length, extending to the right. The next line element is painted one position to the right of the end of the previous one. Each screen line must have a list of line elements that add up to its length exactly, so they must not reach beyond the right border of the screen. This allows the painting program to know when a line is complete and the painting continues in the next screen row.

YAPP format

YAPP is a painting program written by Alexander Hulpke, compatible to MyArt but adding some more features, including double vertical resolution by interlacing.

The YAPP format is similar to the MyArt format. The flag byte has the following definition:

0 1 2 3 4 5 6 7
Inter- laced OM 1 1 1 G7 1 0

OM should be set to 1. According to the YAPP documentation, when reset, the picture is stored in the wrong mode in order to save disk space.

Interlaced pictures are stored in line order of the screen, not separated as two frames (like in memory).

FRACTALS! format

This is a special file format as used in my own FRACTALS! program. It is derived from the MyArt format but has some special adaptations for use with fractal pictures:

  • Contains metadata like viewport parameters and plain text description of the image.
  • Supports two modes of pixel storage: Run-length encoding (like MyArt) and direct encoding (for small run lengths).

The file format is DIS/FIX 255, and the flag byte is always 0x43 ("C").

First record

0 1 2 3 4 5 6 7
0x00 Background "C" Color 0 Color 1 Color 2
0x08 Color 3 Color 4 Color 5 Color 6
0x10 Color 7 Color 8 Color 9 Color 10
0x18 Color 11 Color 12 Color 13 Color 14
0x20 Color 15 XMIN
0x28 XMIN (low word) XMAX
0x30 XMAX (low word) YMIN
0x38 YMIN (low word) YMAX
0x40 YMAX (low word) Iterations 0 0 0 0
0x48 Comments
... Comments
0xf8 Comments

Later records

Each record contains a sequence of specifications of the following two formats:

  1. Run-length encoding: Defines the pixel color (first 4 bits) and the number of repetitions (remaining 12 bits).
  2. Direct encoding: Defines one pixel per half-byte.

The number of screen rows is 212, the number of columns is 512. From the format, the number of repetitions could be 4095 at most, but this is never used since all length encodings must finish at the end of the screen line. Accordingly, we will never find repetitions higher than 0x200.

Format 1

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Color 0 0 0 Number of pixels of this color


Format 2

First word:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Color 1 0 0 Number of pixels for this specification

Following words:

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
Color Color Color Color

When all pixels have been used, either a format 1 word or a new format 2 word will follow. This file formats greatly improves the unwanted overhead for pictures with pixel noise or alternating colors. For instance, if there were a sequence "123456789abcd" of pixel colors, the RLE format (format 1) requires 13 words (one word for each pixel), while format 2 merely requires 4 words (180d 2345 6789 abcd).

Pictures of fractals usually contain areas with a lot of color changes, so this format allows to significantly lower the RLE overhead without information loss.