Dr. Halo

Also Known As: CUT, PAL


Type Bitmap
Colors 8-bit maximum
Compression RLE, uncompressed
Maximum Image Size 64Kx64K pixels
Multiple Images Per File No
Numerical Format Little-endian
Originator Media Cybernetics
Platform MS-DOS
Supporting Applications Dr. Halo
See Also None

Usage
Used in device independent file interchange

Comments
A well-defined, well-documented format in wide use, which is quick and easy to read and decompress. It lacks, however, a superior compression scheme, making it unsuited for the storage of deep-pixel images.

Vendor specifications are available for this format.

Sample images are available for this format.


The Dr. Halo file format is a device-independent interchange format used for transporting image data from one hardware environment or operating system to another. This format is associated with the HALO Image File Format Library, the Dr. Halo III paint program, and other software applications written and marketed by Media Cybernetics.

Contents:
File Organization
File Details
For Further Information

Dr. Halo images may contain up to 256 colors, selectable from an 8-bit palette. Only one image may be stored per file. The Dr. Halo format is unusual in that it is divided into two separate files. The first file has the extension .CUT and contains the image data; the second has the extension .PAL and contains the color palette information for the image.

File Organization

The Dr. Halo header is shown below:

typedef struct _HaloHeader
{
  WORD   Width;          /* 00h   Image Width in Pixels */
  WORD   Height;         /* 02h   Image Height in Scan Lines */
  WORD   Reserved;       /* 04h   Reserved Field (set to 0) */
} HALOHEAD;

Width and Height represent the size of the image data.

Reserved is set to zero to allow for possible future expansion of the header.

Following the header is the image data. Each scan line is always encoded using a simple byte-wise run length encoding (RLE) scheme.

File Details

The .CUT file contains image data in the form of a series of scan lines. The first two bytes of each encoded scan line form a Run Count value, indicating the number of bytes in the encoded line. Each encoded run begins with a one-byte Run Count value. The number of pixels in the run is the seven least significant bits of the Run Count byte and ranges in value from 1 to 127. If the most significant bit of the Run Count is 1, then the next byte is the Run Value and should be repeated Run Count times. If the most significant bit is zero, then the next Run Count bytes are read as a literal run. The end of every scan line is marked by a Run Count byte, which may be 00h or 80h.

The following pseudocode illustrates the decoding process:


ReadScanLine:  
    Read a WORD value of the number of encoded bytes in this scan line  
ReadRunCount:  
    Read a BYTE value as the Run Count  
        If the value of the seven Least Significant Bits (LSB)
            If the Most Significant Bit (MSB)
                Read the next byte as the Run Value and repeat it Run 
                    Count times
        else
	If the MSB of the Run Count is 0  
            Read the next Run Count bytes  
        Goto ReadRunCount:  
    else  
    If the value of the seven LSB of the Run Count is 0
        The end of the scan line has been reached  
        Goto ReadScanLine:

The second Dr. Halo image file usually has the extension .PAL and contains the color palette information for the image. Having a separate color palette file offers the advantage of being able to change the stored colors of an image without re-encoding the image data. The PAL file header is 40 bytes in length and has the following format:

typedef struct _HaloPalette
{
BYTE  FileId[2];          /* 00h   File Identifier - always "AH" */
WORD  Version;            /* 02h   File Version */
WORD  Size;               /* 04h   File Size in Bytes minus header */
CHAR  FileType;           /* 06h   Palette File Identifier   */
CHAR  SubType;            /* 07h   Palette File Subtype   */
WORD  BoardId;            /* 08h   Board ID Code */
WORD  GraphicsMode;       /* 0Ah   Graphics Mode of Stored Image   */
WORD  MaxIndex;           /* 0Ch   Maximum Color Palette Index   */
WORD  MaxRed;             /* 0Eh   Maximum Red Palette Value   */
WORD  MaxGreen;           /* 10h   Maximum Green Palette Value   */
WORD  MaxBlue;            /* 12h   Maximum Blue Color Value   */
CHAR  PaletteId[20];      /* 14h   Identifier String "Dr. Halo" */
 
} HALOPAL;

There are actually two types of .PAL files: generic and video hardware-specific. The header shown above is for the generic type. A hardware-specific palette file may contain additional information in the header.

FileId always contains the byte values 41h and 48h.

Version indicates the version of the HALO format to which the palette file conforms.

Size is the total size of the file minus the header. This gives the total size of the palette data in bytes.

FileType, the palette file identifier, is always set to 0Ah.

Subtype, the palette file subtype, is set to 00h for a generic palette file and to 01h for hardware-specific.

BoardId and GraphicsMode indicate the type of hardware and the mode that created and displayed the palette data.

MaxIndex, MaxRed, MaxGreen, and MaxBlue describe the palette data.

PaletteId contains up to a 20-byte string with an ASCII identifier. Unused string elements are set to 00h.

Palette data is written as a sequence of three-byte triplets of red, green, and blue values in 512-byte blocks. If a triplet does not fit at the end of a block, the block is padded and the triplet used to start the next block. All RGB values are in the range of 0 to 255.

For Further Information

For further information about the Dr. Halo format, see the specification included on the CD-ROM. For additional information, contact:

Media Cybernetics
Attn: Bill Shotts
Technical Support Manager
8484 Georgia Avenue
Silver Spring MD 20910
Voice: 301-495-3305, extension 235
FAX: 301-495-5964
WWW: http://www.mediacy.com/


[Previous] [Next] [Up] [Index]
Contents | Glossary | Main | Formats | Software | Internet | Book

Copyright © 1996, 1994 O'Reilly & Associates, Inc. All Rights Reserved.