aboutsummaryrefslogtreecommitdiffstats
path: root/distrib/sdl-1.2.15/docs/man3/SDL_SetPalette.3
diff options
context:
space:
mode:
authorJesse Hall <jessehall@google.com>2012-07-23 10:12:30 -0700
committerandroid code review <noreply-gerritcodereview@google.com>2012-07-23 10:12:30 -0700
commit2b3a42e7d0b441f71fc2e2b07269dd1f8151c977 (patch)
treeded6ee18c4e1f33df235e53615a6d65e2d64f4ef /distrib/sdl-1.2.15/docs/man3/SDL_SetPalette.3
parent3dcbebfd43e409c3bbff7fc79288e40666a947fd (diff)
parent9682c8870b8ff5e4ac2e4c70b759f791c6f38c1f (diff)
downloadexternal_qemu-2b3a42e7d0b441f71fc2e2b07269dd1f8151c977.zip
external_qemu-2b3a42e7d0b441f71fc2e2b07269dd1f8151c977.tar.gz
external_qemu-2b3a42e7d0b441f71fc2e2b07269dd1f8151c977.tar.bz2
Merge changes I505c4aea,I2ae0529c
* changes: Import SDL release-1.2.15 Handle SDL windows with BGRA color
Diffstat (limited to 'distrib/sdl-1.2.15/docs/man3/SDL_SetPalette.3')
-rw-r--r--distrib/sdl-1.2.15/docs/man3/SDL_SetPalette.359
1 files changed, 59 insertions, 0 deletions
diff --git a/distrib/sdl-1.2.15/docs/man3/SDL_SetPalette.3 b/distrib/sdl-1.2.15/docs/man3/SDL_SetPalette.3
new file mode 100644
index 0000000..a2ca3f6
--- /dev/null
+++ b/distrib/sdl-1.2.15/docs/man3/SDL_SetPalette.3
@@ -0,0 +1,59 @@
+.TH "SDL_SetPalette" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference"
+.SH "NAME"
+SDL_SetPalette \- Sets the colors in the palette of an 8-bit surface\&.
+.SH "SYNOPSIS"
+.PP
+\fB#include "SDL\&.h"
+.sp
+\fBint \fBSDL_SetPalette\fP\fR(\fBSDL_Surface *surface, int flags, SDL_Color *colors, int firstcolor, int ncolors\fR);
+.SH "DESCRIPTION"
+.PP
+Sets a portion of the palette for the given 8-bit surface\&.
+.PP
+Palettized (8-bit) screen surfaces with the \fBSDL_HWPALETTE\fP 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)\&. \fISDL_BlitSurface\fR 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)\&.
+.PP
+This function can modify either the logical or physical palette by specifing \fBSDL_LOGPAL\fP or \fBSDL_PHYSPAL\fPthe in the \fBflags\fR parameter\&.
+.PP
+When \fBsurface\fR is the surface associated with the current display, the display colormap will be updated with the requested colors\&. If \fBSDL_HWPALETTE\fP was set in \fISDL_SetVideoMode\fR flags, \fBSDL_SetPalette\fP will always return \fB1\fR, 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\&.
+.PP
+The color components of a \fI\fBSDL_Color\fR\fR structure are 8-bits in size, giving you a total of 256^3=16777216 colors\&.
+.SH "RETURN VALUE"
+.PP
+If \fBsurface\fR is not a palettized surface, this function does nothing, returning \fB0\fR\&. If all of the colors were set as passed to \fBSDL_SetPalette\fP, it will return \fB1\fR\&. If not all the color entries were set exactly as given, it will return \fB0\fR, and you should look at the surface palette to determine the actual color palette\&.
+.SH "EXAMPLE"
+.PP
+.nf
+\f(CW /* 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);
+ \&.
+ \&.
+ \&.
+ \&.\fR
+.fi
+.PP
+.SH "SEE ALSO"
+.PP
+\fISDL_SetColors\fR, \fISDL_SetVideoMode\fR, \fISDL_Surface\fR, \fISDL_Color\fR
+.\" created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01