SDL_SetColors.3
资源名称:NETVIDEO.rar [点击查看]
上传用户:sun1608
上传日期:2007-02-02
资源大小:6116k
文件大小:2k
源码类别:
流媒体/Mpeg4/MP4
开发平台:
Visual C++
- .TH "SDL_SetColors" "3" "Tue 11 Sep 2001, 23:01" "SDL" "SDL API Reference"
- .SH "NAME"
- SDL_SetColors- Sets a portion of the colormap for the given 8-bit surface&.
- .SH "SYNOPSIS"
- .PP
- fB#include "SDL&.h"
- .sp
- fBint fBSDL_SetColorsfPfR(fBSDL_Surface *surface, SDL_Color *colors, int firstcolor, int ncolorsfR);
- .SH "DESCRIPTION"
- .PP
- Sets a portion of the colormap for the given 8-bit surface&.
- .PP
- When fBsurfacefR is the surface associated with the current display, the display colormap will be updated with the requested colors&. If fBSDL_HWPALETTEfP was set in fISDL_SetVideoModefR flags, fBSDL_SetColorsfP will always return fB1fR, 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 fIfBSDL_ColorfRfR structure are 8-bits in size, giving you a total of 256^3 =16777216 colors&.
- .PP
- Palettized (8-bit) screen surfaces with the fBSDL_HWPALETTEfP 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)&. fBSDL_SetColorsfP modifies both palettes (if present), and is equivalent to calling fISDL_SetPalettefR with the fBflagsfR set to fB(SDL_LOGPAL | SDL_PHYSPAL)fP&.
- .SH "RETURN VALUE"
- .PP
- If fBsurfacefR is not a palettized surface, this function does nothing, returning fB0fR&. If all of the colors were set as passed to fBSDL_SetColorsfP, it will return fB1fR&. If not all the color entries were set exactly as given, it will return fB0fR, 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_SetColors(screen, colors, 0, 256);
- &.
- &.
- &.
- &.fR
- .fi
- .PP
- .SH "SEE ALSO"
- .PP
- fIfBSDL_ColorfRfR fIfBSDL_SurfacefRfR, fIfBSDL_SetPalettefPfR, fIfBSDL_SetVideoModefPfR
- ..." created by instant / docbook-to-man, Tue 11 Sep 2001, 23:01