PCX PROGRAMMER'S TOOLKIT

Tom Castle

Tom Castle is a chemist who frequently writes programming articles. He can be reached at 8734 Merrimac, Richland, MI 49083, or on MCI Mail: tcastle.


Product Information

PCX Programmer's Toolkit, Version 3.52; Genus Microprogramming, 11315 Meadow Lake, Houston, TX 77077; 713-870-0737 or 800-227-0918. Requirements: IBM PC, XT, AT, PS2, or compatible; DOS 2.1 or higher; 128K RAM. Supported Compilers: Microsoft C, MS QuickC, Turbo C, Lattice C, Turbo Pascal, Microsoft Pascal, Microsoft Basic, QuickBasic, Microsoft Fortran, Clipper, Microsoft ASM, (soon Turbo ASM). Video Adapters: Hercules, CGA, EGA, VGA, Paradise Professional VGA, Orchid ProDesigner, Video 7 VRAM, STB Extra/EM. Also supports: Expanded memory conforming to LIM 4.0. Price: $195. Source code available for $300.

In my opinion, there is an overabundance of bit-mapped graphics file formats for MS-DOS machines. All too often for the user, files created by one program won't be usable by another program. From a programmer's vantage, we have to deal with all these different beasties.

Fortunately, a ubiquitous bit-mapped image file format has emerged from the mire, ZSoft's PCX format. Almost every drawing and desktop publishing program, along with FAX and scanner software, uses or translates PCX-format files.

A PCX file consists of a 128-byte header section followed by a compressed data section. By using runlength encoding (RLE) to compress the data, bit-mapped graphics files can be squeezed to a small fraction of their original size. This is obviously important when you get up into extended VGA with resolutions of 800 x 600 pixels in 16 colors (240 Kbytes) or even EGA 640 x 350 pixels in 16 colors (112 Kbytes).

The first part of the PCX Programmer's Toolkit is a collection of stand-alone programs that include the screen capture, display, clip, print, and library utilities. Other programs locate pixel coordinates, retrieve the PCX header information, translate captured text screens to a bit-mapped graphics image, and fix older versions of PCX files to conform to the latest specification set by ZSoft.

The second part of the Toolkit is a collection of function libraries to include in your applications. There are a total of 61 functions, and the libraries can be used with a wide array of languages and compilers (see product box).

This Toolkit lets you do much more than display and save PCX files. A number of the library functions deal with transferring a file from a storage location to either another storage area or to an output device. You also have functions to query about file types, headers, palettes, and hardware. Two functions directly display bit-mapped images on the display with logical operations for animation or superimposing images.

The Toolkit includes library management routines that let you manipulate entire image libraries and extract single images for presentation. By using libraries of images instead of individual PCX files, your graphics images are less available for scrutiny or hazard from the end user.

The Toolkit lets you use two different types of image buffers when working with PCX files. The traditional buffer is used for storing compressed PCX image files. A second type, a virtual buffer, stores the entire uncompressed bit image.

There are two advantages to using virtual buffers. First, images larger than the screen can be stored in a virtual buffer. The image then can be quickly panned or scrolled by scanning the virtual buffer. The virtual buffer is limited in size only by free memory, and can be placed in expanded memory if available. Second, displaying or printing an image from a virtual buffer are about five to ten times faster than the same operations from a conventional buffer containing a compressed PCX image file. The Toolkit, Version 3.52, supports printing to a Hewlett-Packard LaserJet II. This is true both for the stand-alone print utility and for the print functions in the programmer's library. Support for Epson/IBM dot-matrix printers is scheduled for the next release, but Genus has voiced reluctance about becoming too bogged down with printer driver support. This could be a weak point in an otherwise excellent package. You'll probably need to buy an additional graphics print driver toolkit.


Copyright © 1989, Dr. Dobb's Journal