MGL_setPalette

Sets the palette values for a device context.

Declaration

void MGLAPI MGL_setPalette(
    MGLDC *dc,
    palette_t *pal,
    int numColors,
    int startIndex)

Prototype In

mgraph.h

Parameters

dc

Device context to set palette values for

pal

Pointer to array of palette values to set

numColors

Number of color values to set

startIndex

Starting index of first color value to set

 

Description

This function sets part or all of the color palette for the device context. You can specify only a subset of the palette values to be modified with the startIndex and numColors arguments. Thus:

MGL_setPalette(dc,pal,10,50);

will program the 10 color indices from 50-60 with the values stored in the palette buffer 'pal'.

Note:    This routine does not actually change the value of the hardware palette.  If you wish to change the hardware palette to reflect the new values, you will need to call the MGL_realizePalette function to update the hardware palette.

Note:    You must ensure that you do not attempt to program invalid color indices! Use MGL_maxColor() to find the largest color index in color index modes.

Note:    This function is also valid for RGB device contexts, and will simply set the color translation tables for these devices (used for drawing color index bitmaps and translating color index color values to RGB values).

See Also

MGL_getPalette, MGL_setPaletteEntry, MGL_realizePalette

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