Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
SDL_SetColors(3)
Edit
PageHistory
Diff
Info
LikePages
SDL_!SetColors !!!SDL_!SetColors NAME SYNOPSIS DESCRIPTION RETURN VALUE EXAMPLE SEE ALSO ---- !!NAME SDL_!SetColors- Sets a portion of the colormap for the given 8-bit surface. !!SYNOPSIS __#include __ __int SDL_!SetColors__(__SDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolors__); !!DESCRIPTION Sets a portion of the colormap for the given 8-bit surface. 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 colors. 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)__. !!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 !!SEE ALSO __SDL_Color SDL_Surface__, __SDL_!SetPalette__, __SDL_!SetVideoMode__ ----
One page links to
SDL_SetColors(3)
:
SDLManPages
This page is a man page (or other imported legacy content). We are unable to automatically determine the license status of this page.