WinPal and WinMatch UtilitiesThe WinPal and WinMatch utilities provide additional palette controls for BMP and PCX files. WinPal reduces a 256-color BMP or PCX image to a 236-color image, using only colors that do not conflict with the Windows system palette. WinMatch matches the color palette of one BMP/PCX file to the palette of another BMP/PCX file. Both WinPal and WinMatch are Win32 console applications. By default, Fastgraph's BMP and PCX image display functions automatically reduce 256-color files to 236 colors. Further, they map the 236 colors to the Windows non-system colors (colors 10 to 245). While this strategy works very well when displaying individual image files, problems can arise when displaying parts of two different image files at the same time, even if the two image files use the same palettes. Consider the case of some sprites displayed against a background. It's not unusual to store the background in one image file and the sprites in another, with each file having the same palette. The color reduction process in the image display functions combines colors on based on two criteria: (1) their distance apart in color space, and (2) how many pixels there are of each color. Because the two images will almost certainly have different color populations, their reduced palettes will be different. In our example, the sprites would likely appear in the wrong colors. The WinPal and WinMatch utilities provide an easy solution to this problem. You could first use WinPal to reduce both image files to 236 non-system colors, then use WinMatch to make their palettes identical again, as shown here:
Your program would then use the PCX files BACK1.PCX and SPRITES1.PCX instead of the original PCX files. When displaying the PCX files, you would specify the FG_KEEPCOLORS flag when calling fg_showpcx() to inhibit the color reduction since the images are already reduced to the 236 non-system colors. The WinPal command syntax is:
where
The WinMatch command syntax is:
where
|
 
copyright 2001 Ted Gruber Software, Inc.