SDL_!SetColors?- Sets a portion of the colormap for the given 8-bit surface.
int SDL_!SetColors?(__SDL_Surface *surface, SDL_Color
- colors, int firstcolor, int ncolors__);
Sets a portion of the colormap for the given 8-bit
When surface is the surface associated with the
current display, the display colormap will be updated with
the requested colors. If SDL_HWPALETTE was set in
SDL_!SetVideoMode? flags, SDL_!SetColors? will
always return 1, and the palette is guaranteed to be
set the way you desire, even if the window colormap has to
be warped or run under emulation.
The color components of a SDL_Color structure are
8-bits in size, giving you a total of 256^3 =16777216
Palettized (8-bit) screen surfaces with the
SDL_HWPALETTE flag have two palettes, a logical
palette that is used for mapping blits to/from the surface
and a physical palette (that determines how the hardware
will map the colors to the display). SDL_!SetColors?
modifies both palettes (if present), and is equivalent to
calling SDL_!SetPalette? with the flags set to
(SDL_LOGPAL | SDL_PHYSPAL).
If surface is not a palettized surface, this function
does nothing, returning 0. If all of the colors were
set as passed to SDL_!SetColors?, it will return
1. If not all the color entries were set exactly as
given, it will return 0, and you should look at the
surface palette to determine the actual color
/* Create a display surface with a grayscale palette /
/ Fill colors with color information */
SDL_Color SDL_Surface, SDL_!SetPalette?,