Sortix cross-volatile manual
This manual documents Sortix cross-volatile. You can instead view this document in the latest official manual.
SDL_SetPalette(3) | SDL API Reference | SDL_SetPalette(3) |
NAME
SDL_SetPalette - Sets the colors in the palette of an 8-bit surface.SYNOPSIS
#include "SDL.h"DESCRIPTION
Sets a portion of the palette 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_SetPalette, 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_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, 0, 256);
.
.
.
.
SEE ALSO
SDL_SetColors, SDL_SetVideoMode, SDL_Surface, SDL_ColorTue 11 Sep 2001, 23:01 | SDL |