Copyright c 1985, 1987, 1988, 1990, 1991, ZSoft Corporation
All Rights Reserved
Technical Reference Manual
Introduction 2
Image File (.PCX) Format 3
ZSoft .PCX FILE HEADER FORMAT 4
Decoding .PCX Files 6
Palette Information Description 7
EGA/VGA 16 Color Palette Information 7
VGA 256 Color Palette Information 7
24-Bit .PCX Files 8
CGA Color Palette Information 8
CGA Color Map 8
PC Paintbrush Bitmap Character Format 9
Sample "C" Routines 10
FRIEZE Technical Information 14
General FRIEZE Information 14
7.00 and Later FRIEZE 14
FRIEZE Function Calls 15
FRIEZE Error Codes 18
Introduction
This booklet was designed to aid developers and users in understanding
the technical aspects of the .PCX file format and the use of FRIEZE.
Any comments, questions or suggestions about this booklet should be sent to:
ZSoft Corporation
Technical Services
ATTN: Code Librarian
450 Franklin Rd. Suite 100
Marietta, GA 30067
Technical Reference Manual information compiled by:
Dean Ansley
Revision 5
To down load additional information and the source for a complete
Turbo Pascal program to show .PCX files on a CGA/EGA/VGA graphics
display, call our BBS at (404)427-1045. You may use a 9600 baud
modem or a 2400 baud standard modem. Your modem should be set for
8 data bits, 1 stop bit, and NO parity.
Image File (.PCX) Format
If you have technical questions on the format, please do not call
technical support. ZSoft provides this document as a courtesy to
its users and developers. It is not the function of Technical Support to
provide programming assistance. If something is not clear, leave a
message on our BBS, Compuserve, or write us a letter at the above address.
The information in this section will be useful if you want to write
a program to read or write PCX files (images). If you want to write
a special case program for one particular image format you should be able
to produce something that runs twice as fast as "Load from..." in
PC Paintbrush.
Image files used by PC Paintbrush product family and FRIEZE (those with
a .PCX extension) begin with a 128 byte header. Usually you can ignore
this header, since your images will probably all have the same
resolution. If you want to process different resolutions or colors, you
will need to interpret the header correctly. The remainder of the image
file consists of encoded graphic data. The encoding method is a simple
byte oriented run-length technique. We reserve the right to change
this method to improve space efficiency. When more than one color plane
is stored in the file, each line of the image is stored by color plane
(generally ordered red, green, blue, intensity), As shown below.
Scan line 0: RRR... (Plane 0)
GGG... (Plane 1)
BBB... (Plane 2)
III... (Plane 3)
Scan line 1: RRR...
GGG...
BBB...
III... (etc.)
The encoding method is:
FOR each byte, X, read from the file
IF the top two bits of X are 1's then
count = 6 lowest bits of X
data = next byte following X
ELSE
count = 1
data = X
Since the overhead this technique requires is, on average, 25%
of the non-repeating data and is at least offset whenever bytes are
repeated, the file storage savings are usually considerable.
ZSoft .PCX FILE HEADER FORMAT
Byte Item Size Description/Comments
0 Manufacturer 1 Constant Flag, 10 = ZSoft .pcx
1 Version 1 Version information
0 = Version 2.5 of PC Paintbrush
2 = Version 2.8 w/palette information
3 = Version 2.8 w/o palette information
4 = PC Paintbrush for Windows(Plus for Windows
uses Ver 5)
5 = Version 3.0 and > of PC Paintbrush and
PC Paintbrush +, includes Publisher's Paintbrush .
Includes 24-bit .PCX files
2 Encoding 1 1 = .PCX run length encoding
3 BitsPerPixel 1 Number of bits to represent a pixel (per
Plane) - 1, 2, 4, or 8
4 Window 8 Image Dimensions: Xmin,Ymin,Xmax,Ymax
12 HDpi 2 Horizontal Resolution of image in DPI*
14 VDpi 2 Vertical Resolution of image in DPI*
16 Colormap 48 Color palette setting, see text
64 Reserved 1 Should be set to 0.
65 NPlanes 1 Number of color planes
66 BytesPerLine 2 Number of bytes to allocate for a scanline
plane. MUST be an EVEN number. Do
NOT calculate from Xmax-Xmin.
68 PaletteInfo 2 How to interpret palette- 1 = Color/BW,
2 = Grayscale (ignored in PB IV/ IV +)
70 HscreenSize 2 Horizontal screen size in pixels. New field
found only in PB IV/IV Plus
72 VscreenSize 2 Vertical screen size in pixels. New field
found only in PB IV/IV Plus
74 Filler 54 Blank to fill out 128 byte header. Set all bytes to 0
NOTES:
All sizes are measured in BYTES.
All variables of SIZE 2 are integers.
*HDpi and VDpi represent the Horizontal and Vertical resolutions which the image was created (either printer or scanner); i.e. an image which was scanned might have 300 and 300 in each of these fields.
Decoding .PCX Files
First, find the pixel dimensions of the image by calculating