SDL_SetPalette man page on JazzOS

Man page or keyword search:  
man Server   2339 pages
apropos Keyword Search (all sections)
Output format
JazzOS logo
[printable version]

SDL_SetPalette(3)	       SDL API Reference	     SDL_SetPalette(3)

       SDL_SetPalette - Sets the colors in the palette of an 8-bit surface.

       #include "SDL.h"

       int  SDL_SetPalette(SDL_Surface *surface, int flags, SDL_Color *colors,
       int firstcolor, int ncolors);

       Sets a portion of the palette for the given 8-bit surface.

       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_BlitSurface always uses the logical
       palette when blitting surfaces (if it has to  convert  between  surface
       pixel  formats). Because of this, it is often useful to modify only one
       or the other palette to achieve various special	color  effects	(e.g.,
       screen fading, color flashes, screen dimming).

       This  function  can  modify  either  the logical or physical palette by
       specifing SDL_LOGPAL or SDL_PHYSPALthe in the flags parameter.

       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_SetPalette  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  emu‐

       The  color components of a SDL_Color structure are 8-bits in size, giv‐
       ing you a total of 256^3=16777216 colors.

       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.

	       /* Create a display surface with a grayscale palette */
	       SDL_Surface *screen;
	       SDL_Color colors[256];
	       int i;
	       /* Fill colors with color information */

	       /* Create display */
	       screen=SDL_SetVideoMode(640, 480, 8, SDL_HWPALETTE);
		 printf("Couldn't set video mode: %s
       ", SDL_GetError());

	       /* Set palette */
	       SDL_SetPalette(screen, SDL_LOGPAL|SDL_PHYSPAL, colors, 0, 256);

       SDL_SetColors, SDL_SetVideoMode, SDL_Surface, SDL_Color

SDL			    Tue 11 Sep 2001, 23:01	     SDL_SetPalette(3)

List of man pages available for JazzOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net