version 2, including all changes.
.
Rev |
Author |
# |
Line |
2 |
perry |
1 |
SDL_!SetColors |
|
|
2 |
!!!SDL_!SetColors |
1 |
perry |
3 |
NAME |
|
|
4 |
SYNOPSIS |
|
|
5 |
DESCRIPTION |
|
|
6 |
RETURN VALUE |
|
|
7 |
EXAMPLE |
|
|
8 |
SEE ALSO |
|
|
9 |
---- |
|
|
10 |
!!NAME |
|
|
11 |
|
|
|
12 |
|
2 |
perry |
13 |
SDL_!SetColors- Sets a portion of the colormap for the given 8-bit surface. |
1 |
perry |
14 |
!!SYNOPSIS |
|
|
15 |
|
|
|
16 |
|
|
|
17 |
__#include __ |
|
|
18 |
|
|
|
19 |
|
2 |
perry |
20 |
__int SDL_!SetColors__(__SDL_Surface *surface, SDL_Color |
1 |
perry |
21 |
*colors, int firstcolor, int ncolors__); |
|
|
22 |
!!DESCRIPTION |
|
|
23 |
|
|
|
24 |
|
|
|
25 |
Sets a portion of the colormap for the given 8-bit |
|
|
26 |
surface. |
|
|
27 |
|
|
|
28 |
|
|
|
29 |
When __surface__ is the surface associated with the |
|
|
30 |
current display, the display colormap will be updated with |
|
|
31 |
the requested colors. If __SDL_HWPALETTE__ was set in |
2 |
perry |
32 |
''SDL_!SetVideoMode'' flags, __SDL_!SetColors__ will |
1 |
perry |
33 |
always return __1__, and the palette is guaranteed to be |
|
|
34 |
set the way you desire, even if the window colormap has to |
|
|
35 |
be warped or run under emulation. |
|
|
36 |
|
|
|
37 |
|
|
|
38 |
The color components of a __SDL_Color__ structure are |
|
|
39 |
8-bits in size, giving you a total of 256^3 =16777216 |
|
|
40 |
colors. |
|
|
41 |
|
|
|
42 |
|
|
|
43 |
Palettized (8-bit) screen surfaces with the |
|
|
44 |
__SDL_HWPALETTE__ flag have two palettes, a logical |
|
|
45 |
palette that is used for mapping blits to/from the surface |
|
|
46 |
and a physical palette (that determines how the hardware |
2 |
perry |
47 |
will map the colors to the display). __SDL_!SetColors__ |
1 |
perry |
48 |
modifies both palettes (if present), and is equivalent to |
2 |
perry |
49 |
calling ''SDL_!SetPalette'' with the __flags__ set to |
1 |
perry |
50 |
__(SDL_LOGPAL | SDL_PHYSPAL)__. |
|
|
51 |
!!RETURN VALUE |
|
|
52 |
|
|
|
53 |
|
|
|
54 |
If __surface__ is not a palettized surface, this function |
|
|
55 |
does nothing, returning __0__. If all of the colors were |
2 |
perry |
56 |
set as passed to __SDL_!SetColors__, it will return |
1 |
perry |
57 |
__1__. If not all the color entries were set exactly as |
|
|
58 |
given, it will return __0__, and you should look at the |
|
|
59 |
surface palette to determine the actual color |
|
|
60 |
palette. |
|
|
61 |
!!EXAMPLE |
|
|
62 |
|
|
|
63 |
|
|
|
64 |
/* Create a display surface with a grayscale palette */ |
|
|
65 |
SDL_Surface *screen; |
|
|
66 |
SDL_Color colors[[256]; |
|
|
67 |
int i; |
|
|
68 |
. |
|
|
69 |
. |
|
|
70 |
. |
|
|
71 |
/* Fill colors with color information */ |
|
|
72 |
for(i=0;i |
|
|
73 |
!!SEE ALSO |
|
|
74 |
|
|
|
75 |
|
2 |
perry |
76 |
__SDL_Color SDL_Surface__, __SDL_!SetPalette__, |
|
|
77 |
__SDL_!SetVideoMode__ |
1 |
perry |
78 |
---- |