Including file 2PCX.C will allow any C program to copy the actual EGA/VGA screen to a file in the ZSoft PCX graphics format. This format can be read by "Paintbrush", which is included with the Windows operating system. After loading the file into "Paintbrush", you then can freely edit it, change colors, add some explanatory text, combine it with other images, and so on.
Via the Windows clipboard you may then insert your graphics into a Microsoft Word document or use it in the context of other Windows applications. This gives you more possibilities to create prints of your own graphics than a simple hardcopy routine directly adressing a printer. Sample program PTREE.C demonstrates the usage of function shootpcx() contained in 2PCX.C. PTREE creates a nice fractal drawing based on the law of Pythagoras (Pythagoras' tree). Running the program with a file name for argument will save the image to that file. You can start the demo from the Windows program manager or file manager by typing the command line "PTREE PTREE.PCX" and then load PTREE.PCX into Paintbrush. The version of the routine shown here is restricted to a 16-color palette because more colors (up to 256) use different palette encoding in the PCX format. Using a simple run length encoding scheme, PCX produces much shorter files than the usual Windows BMP (bitmap) format. Even smaller files would be possible if only a black-and-white image had to be saved. But to keep things simple and readable, the necessary changes have not been included. Appropriate versions can be provided by the author. Different EGA/VGA graphic resolutions should cause no problems. The INVERT switch may be used to change from the black drawing background in a DOS graphics program (where black pixels are sometimes difficult to draw) to a white background, which is usually found in the Windows environment. All other colors are preserved by the actual implementation of this feature, which relies on the assumption that black and white form the first and the last entries respectively in your color palette. The listed sources are written for the Borland Turbo C compiler, but porting them to other compilers should pose no problems, especially not the shootpcx() function itself, which uses the graphics library only to read the actual color palette. © 1997 by binär industrie-informatik Bernd KohlerNice persons will not forget to send me a picture postcard (by snail mail) after download.
Very time-pressed persons may anyhow do me the favor and drop a line of e-mail with their name, institution and place of living. Placing the line Send 2PCX<CR>" into the body of their message will even save them the time needed to