BuildTranslateVector

Build a color palette translation vector

Declaration

void NAPI GA_2DStateFuncs::BuildTranslateVector(
    GA_color *translate,
    GA_palette *dstPal,
    GA_palette *srcPal,
    int srcColors)

Prototype In

snap/graphics.h

Parameters

translate

Place to store resulting translate vector

dstPal

Destination palette to map to

srcPal

Source palette to map from

srcColors

Number of colors in the source palette to map

 

Description

This function builds a color palette translation vector and returns it. For color index modes (<= 8bpp), the source palette values are mapped onto the destination palette values, and the resulting translation vector will be an array of 32-bit color palette index values. To find the final color for a color value, take the source color index value and dereference it via the translation table to get the resulting color index value.

For 15bpp and higher RGB display modes, the destination palette parameter is ignored and the resulting translaction vector will be a 32-bit array of packed color values that represent the source palette entries. Ie: for 15bpp modes, the resulting vector will contain 32-bit values between 0 and 0x7FFF that represent the packed color values in 5:5:5 format. Hence converting paletted bitmap data to the destination pixel format is simply a matter of looking up the entry in the translation vector and using that to store the resulting value in the framebuffer.

This function is mostly intended for applications and shell drivers that know in advance that a number of bitmaps will be translated, so can create the color translation vector once and then reuse it for all bitmaps.

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com