Home |
Generate Optimal |
Generate OptimalThe Generate Optimal palette option is only available if the target supports 256 color (i.e. 8-bpp) output. This is the opposite of using a Fixed Orthogonal palette. When this option is selected, Image Convert will create a custom palette for use with the input images. The custom palette will be saved at the top of the output file, and will be named PegCustomPalette. The custom palette is simply an array of 256*3 unsigned characters, which is passed to the PegScreen::SetupPalette function when you want to use the custom palette. Using a custom palette when running in 256-color or higher modes provides the best possible image display. Since the resulting palette is generally modified extensively as compared to the palette that was included in the input images, the input images are automatically re-encoded by Image Convert to use the newly created palette. This all happens transparently when the Generate Optimal option is selected in the Image Convert dialog. The custom palette created by Image Convert is always named PegCustomPalette, and is found at the top of the C++ output file generated by Image Convert. This palette always starts with the 16 standard colors, and is followed by up to 240 colors selected to produce the best possible image display for your input images. The custom palette is simply an array of unsigned characters containing the Red, Green, and Blue components of each color. This array of RGB values should be programmed into the video controller palette registers prior to displaying the associated bitmap(s). This palette can be directly passed to the PegScreen::SetupPalette() function, as shown below: PegScreen()->SetupPalette(PegCustomPalette, 256); It is also possible to use multiple custom palettes. When multiple custom palettes are used, it is the responsibility of the application level software to install the correct custom palette before the corresponding images are displayed. For systems that display 'one window at a time', it is a simple matter to install the correct palette when each window is displayed. For other systems, it can be complex to use multiple palettes, and one optimal palette is generally preferred.
|