Sortix nightly manual
This manual documents Sortix nightly, a development build that has not been officially released. You can instead view this document in the latest official manual.
SDL_SetColors(3) | SDL API Reference | SDL_SetColors(3) |
NAME
SDL_SetColors - Sets a portion of the colormap for the given 8-bit surface.SYNOPSIS
#include "SDL.h"DESCRIPTION
Sets a portion of the colormap for the given 8-bit surface.RETURN VALUE
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 palette.EXAMPLE
/* Create a display surface with a grayscale palette */
SDL_Surface *screen;
SDL_Color colors[256];
int i;
.
.
.
/* Fill colors with color information */
for(i=0;i<256;i++){
colors[i].r=i;
colors[i].g=i;
colors[i].b=i;
}
/* Create display */
screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE);
if(!screen){
printf("Couldn't set video mode: %s
", SDL_GetError());
exit(-1);
}
/* Set palette */
SDL_SetColors(screen, colors, 0, 256);
.
.
.
.
SEE ALSO
SDL_Color SDL_Surface, SDL_SetPalette, SDL_SetVideoModeTue 11 Sep 2001, 23:01 | SDL |