home *** CD-ROM | disk | FTP | other *** search
/ Encyclopedia of Graphics File Formats Companion / GFF_CD.ISO / formats / rix / spec / rix.txt
Text File  |  1994-06-01  |  4KB  |  119 lines

  1. Appendix E
  2. RIX image File Format
  3.  
  4.  
  5. The RIX philosophy for a file format is to provide a simple
  6. structure that can be easily processed. This structure also results
  7. in a format that can be loaded quickly.
  8.  
  9. The internal compression algorithm used by RIX is not published
  10. because it is extremely complicated. RIX provides the RIXLATE
  11. utility software as part of the ColoRIX VGA Paint package to expand
  12. and compress files. Although some compression schemes are more
  13. efficient for some pictures, the RIX compression scheme performs
  14. extremely well with a broad range of picture types.
  15.  
  16.  
  17. Header Format
  18.  
  19. RIX image files begin with a 10-byte Intel (low byte first) format
  20. header that identifies the image as described below:
  21.  
  22.  
  23. Byte Position     Description
  24.     0 - 3         "RIX"
  25.     4 - 5         Image width in pixels
  26.     6 - 7         Image height in lines
  27.       8           Palette Type
  28.       9           Storage Type
  29.  
  30.  
  31. Palette Type
  32.  
  33. The Palette Type byte indicates the presence of a palette and
  34. its format and length in the form:
  35.  
  36. M P RGB PIX
  37.  
  38. where:
  39.  
  40.      M = 80 if palette table (map) is present,
  41.      P = 40 if packed map entry (e.g., TARGA 16) 5 bits x 3 into
  42.        2 bytes.
  43.      RGB = rgb bits minus 1 (EGA is 2 minus 1, VGA is 6 minus 1).
  44.      PIX = bits per pixel minus 1 (i.e., log number of map
  45.        entries). VGA is 7.
  46.  
  47. The Palette Type is thus calculated as:
  48.  
  49.      *   EGA (16/64) = 80 + 40 + 08 + 3 = CB
  50.      *   Extended EGA (16/256K) = 80 + + 28 + 3 = AB
  51.      *   VGA (256/256MK) = 80 + + 28 + 7 = AF
  52.      *   TARGA 16 (256/32K) = 80 + 40 + 20 + 7 = E7
  53.      *   PGA (256/4K) = 80 + + 18 + 7 = 9F
  54.  
  55. If not a mapped file (i.e., no 80) then remainder is bits per
  56. pixel. For example:
  57.  
  58.      *   TARGA 16 is 10
  59.      *   TARGA 24 is 18
  60.      *   TARGA 32 is 20
  61.  
  62.  
  63. Storage Type
  64.  
  65. The Storage Type byte indicates how the pixel data are stored. This
  66. value is calculated as follows:
  67.  
  68.      *   80 = Compressed
  69.      *   40 = Extension block
  70.      *   20 = Encrypted
  71.      *   0 = Linear, one byte per pixel (a la VGA, TGA, PGA)
  72.      *   1 = Planar 0, 2, 1, 3 (a la EGA)
  73.      *   2 = Planar 0, 1, 2, 3 (a la EGA)
  74.      *   3 = Text (char, attr)
  75.      *   4 = Planar lines 0, 1, 2, 3
  76.      *   40 = Extension. Next word is total number of bytes in the
  77.          extension block as described below.
  78.  
  79. Extension blocks are provided to allow additional information to
  80. be added to the image. This information is optional, so that the
  81. file reader may choose to skip the extension block.
  82.  
  83.  
  84. Data Format
  85.  
  86. The palette is either 48 or 768 bytes long, containing one RGB
  87. triple for each color (16 or 256). The image data is either one
  88. byte per pixel (256 colors) or four fines of one bit per pixel
  89. data.
  90.  
  91.  
  92. Extension Format
  93.  
  94. The extension block comprises one or more extensions. Each
  95. extension is prefaced with a byte of type and a byte of length. The
  96. length is three bytes if first byte is zero. Types 0 through 127
  97. are reserved for RIX applications. A few typical extension formats
  98. are shown below.
  99.  
  100.  
  101.      *  00 xx ASCII text for identification field (e.g., creator's
  102.         signature).
  103.  
  104.      *  01 04 xxx yyy defines original image origin.
  105.  
  106.      *  02 04 xxx yyy defines original image screen resolution.
  107.  
  108.      *  03 02 ID (defines encryptor's ID).
  109.  
  110.      *  04 xx bit map of used palettes where xx is 2 or 32 bytes.
  111.  
  112. When processing a screen file, the reader should ignore all
  113. unfamiliar extension types. Other applications are free to create
  114. their own extensions, but should use types starting with 128.
  115. Developers may request from RIX an ID less than 12 to avoid
  116. conflict with other developers. RIX welcomes suggestions for now
  117. extensions.
  118.  
  119.