Inset PIX

Also Known As: PIX


Type Bitmap
Colors Up to 16
Compression Proprietary, documented
Maximum Image Size 64Kx64K pixels
Multiple Images Per File No
Numerical Format Little-endian
Originator Inset Systems
Platform MS-DOS
Supporting Applications InSet Versions 1 and 2, HiJaak, WordStar, Multimate
See Also None

Usage
Neutral common format for Inset Systems' products. Also used for graphics storage by the WordStar and Multimate word processors.

Comments
A great little format marred by lack of support for more than 16 colors. It would be a good model for a deep-pixel format, however.

Vendor specifications are available for this format.

Sample images are available for this format.


Inset PIX is an intermediate graphic format created by Inset Systems (now part of Quarterdeck), which sells the InSet and HiJaak applications for use on Intel-based PCs. HiJaak is a widely used and highly regarded screen-capture and graphics file conversion utility. Version 2 of the package supports the graphics, printer, and FAX formats listed below:

ASCII Inset IGF
AT&T Group 4 Kofax Group 4
AutoCAD DXF Lotus Picture
CALS raster Macintosh Paint
CGM Macintosh PICT
GIF MathCAD
DataBeam DBX Microsoft Paint
Dr. Halo Microsoft Windows Bitmap
Encapsulated PostScript Microsoft Windows Metafile
FAX formats (various) PCX
GEM raster Presentation Manager Metafile
GEM VDI Tektronix P10
HPPCL TGA
HPGL TIFF
ILBM WordPerfect Graphics Metafile
Inset PIX

Contents:
File Organization
File Details
For Further Information

As you might imagine, Inset has a great deal of experience with graphics file formats. The design of PIX reflects this experience, and is a well thought-out and flexible format. If you need to convert a file from an odd format to one on the above list, you might consider converting to PIX as an intermediate step and then using the application to do the rest. (And, no, we don't have any financial or personal interest in Inset Systems or Quarterdeck!)

PIX was designed as an extensible, device-independent format which would allow random access of portions of a compressed image. Although nominally a bitmap format, the file structure supports the future addition of other data types.

File Organization

Inset documentation describes a PIX file as, "an indexed database of data items." A table of the size and location of data items is included in the beginning of each file. Data items can include information on the following:

File Details

This section describes the header, index table, and different types of image data in a PIX file.

Header

PIX files always have a short header:

typedef struct _PIX_HEADER
{
  WORD RevisionLevel;     /* Currently 3 */
  WORD DataItemsInTable;  /* Number of data items in the index table */
} PIX_HEADER;

RevisionLevel is the version number for the format; this level is currently 3.

DataItemsInTable is the number of items in the PIX file's index table, described in the next section.

Index Table

Following the header is an index table containing an array of data item information structures of the following form:

typedef struct DATA_ITEM_INFO
{
  WORD DataID;         /* Data item ID */
  WORD DataLength;     /* Length of data item */
  LONG DataLocation;   /* Location of data item in file */
} DATA_ITEM_INFO;

DataID values may be any of the following:

00 Image information
11 Printing options
01 Palette
02 Tile information

Empty data items have DataID values of -1.

DataLength is the length of this item in the index table.

DataLocation is the location of the item in the file.

Image Information

The following information is extracted from the specification document supplied by Inset Systems:

The application ID for the image structure is 0. This data item contains information on the overall image size, type, and origin of the image. The structure (in C) of this data item is:

struct mode_data
{
  BYTE    hmode;
  BYTE    htype;
  BYTE    cfore;
  BYTE    cback;
  BYTE    tattr;
  BYTE    tcpr;
  BYTE    trows;
  BYTE    thfnts;
  BYTE    tlfnts;
  BYTE    tcpf;
  BYTE    tfsize[4];
  WORD    gcols;
  WORD    grows;
  BYTE    gfore;
  BYTE    prepal;
  BYTE    lodpal;
  BYTE    lintens;
  BYTE    lred;
  BYTE    lgreen;
  BYTE    lblue;
  BYTE    pages;
  BYTE    haspect;
  BYTE    vaspect;
}

Following is a description of each member of this structure:

hmode

Hardware-specific mode. 0 if not specifically related to a particular hardware mode of a board.

htype

Hardware type. Bit 0 is zero if alphanumeric and 1 if bitmap graphics. Board types are ORed into this byte. Board types include:

8 = CGA
16 = Hercules
24 = EGA

cfore

Text foreground color bits (ignore if graphics) 4 for CGA

tattr

Text background color bits (ignore if graphics) 3 for CGA

tcpr

Text characters per row (ignore if graphics)

trows

Text rows (ignore if graphics)

thfnts

Text hardware fonts (not used)

tlfnts

Text loadable fonts (not used)

tcpf

Text characters per font (not used)

tfsize

Font size (not used)

gcols

Graphics columns

grows

Graphics rows

gfore

Graphics foreground color bits

prepal

Number of preset palettes (default to 0)

lodpal

Number of loadable palettes

lintens

Number of palette bits for intensity

lred

Number of palette bits for red

lgreen

Number of palette bits for green

lblue

Number of palette bits for blue

pages

Number of possible pages (not used)

haspect

Horizontal component of aspect ratio (number of horizontal pixels to fit in a square)

vaspect

Vertical component of aspect ratio (number of vertical pixels to fit in a square)

A sample image structure for a 600-row-by-800-column single-bit plane image might be initialized as follows:

struct mode_data
{
  BYTE   hmode;     /* 0 */
  BYTE   htype;     /* 1 */
  BYTE   cfore;     /* 0 */
  BYTE   cback;     /* 0 */
  BYTE   tattr;     /* 0 */
  BYTE   tcpr;      /* 80 */
  BYTE   trows;     /* 25 */
  BYTE   thfnts;    /* 0 */
  BYTE   tlfnts;    /* 0 */
  BYTE   tcpf;      /* 0 */
  WORD   tfsize[4]; /* 0,0,0,0 */
  WORD   gcols;     /* 800 */
  WORD   grows;     /* 500 */
  BYTE   gfore;     /* 1 */
  BYTE   prepal;    /* 0 */
  BYTE   lodpal;    /* 0 */
  BYTE   lintens;   /* 1 */
  BYTE   lred;      /* 0 */
  BYTE   lgreen;    /* 0 */
  BYTE   lblue;     /* 0 */
  BYTE   pages;     /* 0 */
  BYTE   haspect;   /* 1 */
  BYTE   vaspect;   /* 1 */
}

Printing Options

The application ID for Inset Printing options is 11h. The C structure containing these items follows:

struct prt_options
{
  SHORT pitch;
  SHORT scol;
  SHORT ecol;
  SHORT srow;
  SHORT erow;
  SHORT p_wid;
  SHORT siz;
  SHORT rotat;
  SHORT do_sw;
  SHORT res_1;
  SHORT res_2;
  SHORT pcolor;
  SHORT row_dp;
  SHORT col_dp;
  SHORT flags;
  CHAR  ink_tab[16];
}

Following is a description of each member of this structure:

pitch

Printer Pitch divided by 10 (e.g., 100 = 10 pitch); not required, set to 100

scol

Start column clip boundary

ecol

End column clip boundary

srow

Start row clip boundary

erow

End row clip boundary

p_wid

Printer width (not required, set to 0)

size

Size (not used, set to 0)

rotat

Rotation (0 = horizontal, -1 = left, 1=right)

do_sw

Option bits ORed. Applicable bits to set include:

Double Pass | = 2
Letter Quality | = 4
Border On | = 10 (hex)

res_1

res_2

Internal use (don't use, set to 0)

pcolor

Low-order byte indicates whether the image settings are intended for color printer (true = 1, false = 0)

High-order byte indicates which dither pattern type to use (0 = old, 1 = gray, 2 = contrast).

row_dp

Height of image in decipoints (1/720 inches)

col_dp

Width of image in decipoints (1/720 inches)

flags

Modify flags

Size option bits:

#define INDATA_USE_COL 0x1
#define INDATA_USE_INCH 0x2
#define INDATA_USE_DP 0x3

Modify ink selection:

#define INDATA_INK_INV 0x8
#define INDATA_INK_BW 0x10
#define INDATA_INK_TAB 0x18
#define INDATA_VDISK 0x20
#define INDATA_VSIZE 0x40
#define INDATA_DYNAMIC 0x80

ink_tab

Sixteen-byte table mapping screen colors to printer colors/gray patterns (see the MODIFY/INKS section of the Inset manual for more information on ink tables). If you want to select your own Ink table mapping, the flags variable must have a 0x18 OR'ed in. Preset Inset Ink tables are set as follows:

Color Number       0 1 2 3 4 5 6 7 8 9 A B C D E F
Standard                   F 1 2 3 4 5 6 7 8 9 A B C D E 0
Invert             0 1 2 3 4 5 6 7 8 9 A B C D E F
B&W                        F 0 0 0 0 0 0 0 F 0 0 0 0 0 0 0

Palette Data

Application ID = 1 contains display palette information. Palette information is stored in an array of palette structures of the following form:

struct pallette
{
  CHAR intens, red, green, blue;
}

The number of significant palette items in the array is determined by the number of available colors (the "gfore" member in the image data structure) in the image. The significant bits are determined by the lintens lred, lgreen, and lblue items in the mode_data structure.

Tile Information

Application ID = 2 contains information as to how the image is broken down into tiles. The Tile_Data structure follows:

struct Tile_Data
{
  WORD    page_rows;
  WORD    page_cols;
  WORD    stp_rows;
  WORD    stp_cols;
}

Following is a description of each member of this structure:

page_rows Number of rows within each tile
page_cols Number of columns in each tile (must be divisible by 8)
stp_rows Number of horizontal tile strips within the image
stp_cols Number of vertical tile strips

Each tile is limited to a maximum of 4096 bytes of uncompressed data. The actual tiles are numbered starting with the upper left row as tile 0 and incremented from left to right as illustrated below.

0

1

2

3

4

5

6

7

8

9

A

B

The ID of a tile is the tile number ORed with a 8000h. For example, the lower-right tile can be found by finding the record with ID=800Bh.

Images may be broken down into checkerboard sections or horizontal strips. However, if an image is broken into horizontal strips for processing, the image as rotated by Inset will be slowed.

Pixel Tiles

Each individual pixel tile ID is determined by ORing in 8000h with the tile number, as described in the preceding section on tile information.

The image is organized into bit planes with eight pixels per byte; the most significant bit contains the leftmost pixel. For multiple-bit plane images, all scan lines for a plane are written out before the scan lines in the next plane.

If the actual column boundary of the tile exceeds the column boundary of the image, the image is padded with blank bytes to fill out the tile. If the actual row boundary of the tile exceeds that of the image, the extra rows are not present.

When the tile is stored on disk, it is in a vertically compressed format. The first scan line of each tile is written out with no modification. Then, before the following scan lines, there are compression bytes that indicate which bytes in the scan line are different from the preceding line. Each bit in the compression byte indicates whether a particular byte in that scan has changed (1 if changed, 0 if not). Then, following the compression bytes, only the modified scan bytes are written to the file.

For example, suppose we have a tile that is eight columns wide, the first scan line is all blank, and there is a dot at the beginning and end of the second scan line. This tile would be written to disk as follows:

   00 00 00 00 00 00 00 00 <- First scan line
81 80                   01 <- changed bytes
 ^
 Compression Byte

In multiple-bit plane images, the first scan is uncompressed, and the following lines are compressed in the same manner as described above.

Character Tiles

Alphanumeric images can be generally described as two-plane images with the first plane containing the alphanumeric character data and the second containing the attribute information. Alphanumeric characters are presumed to correspond to the IBM extended ASCII character set, with attribute information corresponding to the IBM CGA standard.

The character and text planes are compressed in the same manner as image bit planes with one caveat. The text scan-line length is twice what it should be (i.e., 160 bytes go out uncompressed for an 80-column screen).

For Further Information

For further information about Inset PIX, see the specification included on the CD-ROM. You can also contact:

Inset Systems
Developer Relations
71 Commerce Drive
Brookfield, CT 06804
Voice: 203-740-2400

Also see the Quarterdeck homepage:

http://www.insetusa.com/



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

Hosted by uCoz