0
|
1 <HTML
|
|
2 ><HEAD
|
|
3 ><TITLE
|
|
4 >SDL_SetColorKey</TITLE
|
|
5 ><META
|
|
6 NAME="GENERATOR"
|
|
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.61
|
|
8 "><LINK
|
|
9 REL="HOME"
|
|
10 TITLE="SDL Library Documentation"
|
|
11 HREF="index.html"><LINK
|
|
12 REL="UP"
|
|
13 TITLE="Video"
|
|
14 HREF="video.html"><LINK
|
|
15 REL="PREVIOUS"
|
|
16 TITLE="SDL_SaveBMP"
|
|
17 HREF="sdlsavebmp.html"><LINK
|
|
18 REL="NEXT"
|
|
19 TITLE="SDL_SetAlpha"
|
|
20 HREF="sdlsetalpha.html"></HEAD
|
|
21 ><BODY
|
|
22 CLASS="REFENTRY"
|
|
23 BGCOLOR="#FFF8DC"
|
|
24 TEXT="#000000"
|
|
25 LINK="#0000ee"
|
|
26 VLINK="#551a8b"
|
|
27 ALINK="#ff0000"
|
|
28 ><DIV
|
|
29 CLASS="NAVHEADER"
|
|
30 ><TABLE
|
|
31 WIDTH="100%"
|
|
32 BORDER="0"
|
|
33 CELLPADDING="0"
|
|
34 CELLSPACING="0"
|
|
35 ><TR
|
|
36 ><TH
|
|
37 COLSPAN="3"
|
|
38 ALIGN="center"
|
|
39 >SDL Library Documentation</TH
|
|
40 ></TR
|
|
41 ><TR
|
|
42 ><TD
|
|
43 WIDTH="10%"
|
|
44 ALIGN="left"
|
|
45 VALIGN="bottom"
|
|
46 ><A
|
|
47 HREF="sdlsavebmp.html"
|
|
48 >Prev</A
|
|
49 ></TD
|
|
50 ><TD
|
|
51 WIDTH="80%"
|
|
52 ALIGN="center"
|
|
53 VALIGN="bottom"
|
|
54 ></TD
|
|
55 ><TD
|
|
56 WIDTH="10%"
|
|
57 ALIGN="right"
|
|
58 VALIGN="bottom"
|
|
59 ><A
|
|
60 HREF="sdlsetalpha.html"
|
|
61 >Next</A
|
|
62 ></TD
|
|
63 ></TR
|
|
64 ></TABLE
|
|
65 ><HR
|
|
66 ALIGN="LEFT"
|
|
67 WIDTH="100%"></DIV
|
|
68 ><H1
|
|
69 ><A
|
|
70 NAME="SDLSETCOLORKEY"
|
|
71 >SDL_SetColorKey</A
|
|
72 ></H1
|
|
73 ><DIV
|
|
74 CLASS="REFNAMEDIV"
|
|
75 ><A
|
|
76 NAME="AEN1561"
|
|
77 ></A
|
|
78 ><H2
|
|
79 >Name</H2
|
|
80 >SDL_SetColorKey -- Sets the color key (transparent pixel) in a blittable surface and
|
|
81 RLE acceleration.</DIV
|
|
82 ><DIV
|
|
83 CLASS="REFSYNOPSISDIV"
|
|
84 ><A
|
|
85 NAME="AEN1564"
|
|
86 ></A
|
|
87 ><H2
|
|
88 >Synopsis</H2
|
|
89 ><DIV
|
|
90 CLASS="FUNCSYNOPSIS"
|
|
91 ><A
|
|
92 NAME="AEN1565"
|
|
93 ></A
|
|
94 ><P
|
|
95 ></P
|
|
96 ><PRE
|
|
97 CLASS="FUNCSYNOPSISINFO"
|
|
98 >#include "SDL.h"</PRE
|
|
99 ><P
|
|
100 ><CODE
|
|
101 ><CODE
|
|
102 CLASS="FUNCDEF"
|
|
103 >int <B
|
|
104 CLASS="FSFUNC"
|
|
105 >SDL_SetColorKey</B
|
|
106 ></CODE
|
|
107 >(SDL_Surface *surface, Uint32 flag, Uint32 key);</CODE
|
|
108 ></P
|
|
109 ><P
|
|
110 ></P
|
|
111 ></DIV
|
|
112 ></DIV
|
|
113 ><DIV
|
|
114 CLASS="REFSECT1"
|
|
115 ><A
|
|
116 NAME="AEN1571"
|
|
117 ></A
|
|
118 ><H2
|
|
119 >Description</H2
|
|
120 ><P
|
|
121 > Sets the color key (transparent pixel) in a blittable surface and enables or
|
|
122 disables RLE blit acceleration.</P
|
|
123 ><P
|
|
124 >RLE acceleration can substantially speed up blitting of images with large
|
|
125 horizontal runs of transparent pixels (i.e., pixels that match the
|
|
126 <TT
|
|
127 CLASS="PARAMETER"
|
|
128 ><I
|
|
129 >key</I
|
|
130 ></TT
|
|
131 > value). The <TT
|
|
132 CLASS="PARAMETER"
|
|
133 ><I
|
|
134 >key</I
|
|
135 ></TT
|
|
136 > must be of the same pixel format as the <TT
|
|
137 CLASS="PARAMETER"
|
|
138 ><I
|
|
139 >surface</I
|
|
140 ></TT
|
|
141 >, <A
|
|
142 HREF="sdlmaprgb.html"
|
|
143 ><TT
|
|
144 CLASS="FUNCTION"
|
|
145 >SDL_MapRGB</TT
|
|
146 ></A
|
|
147 > is often useful for obtaining an acceptable value.</P
|
|
148 ><P
|
|
149 >If <TT
|
|
150 CLASS="PARAMETER"
|
|
151 ><I
|
|
152 >flag</I
|
|
153 ></TT
|
|
154 > is <TT
|
|
155 CLASS="LITERAL"
|
|
156 >SDL_SRCCOLORKEY</TT
|
|
157 > then
|
|
158 <TT
|
|
159 CLASS="PARAMETER"
|
|
160 ><I
|
|
161 >key</I
|
|
162 ></TT
|
|
163 > is the transparent pixel value in the source image of a
|
|
164 blit.</P
|
|
165 ><P
|
|
166 >If <TT
|
|
167 CLASS="PARAMETER"
|
|
168 ><I
|
|
169 >flag</I
|
|
170 ></TT
|
|
171 > is OR'd with
|
|
172 <TT
|
|
173 CLASS="LITERAL"
|
|
174 >SDL_RLEACCEL</TT
|
|
175 > then the surface will be draw using RLE
|
|
176 acceleration when drawn with
|
|
177 <A
|
|
178 HREF="sdlblitsurface.html"
|
|
179 >SDL_BlitSurface</A
|
|
180 >. The surface will
|
|
181 actually be encoded for RLE acceleration the first time
|
|
182 <A
|
|
183 HREF="sdlblitsurface.html"
|
|
184 >SDL_BlitSurface</A
|
|
185 > or
|
|
186 <A
|
|
187 HREF="sdldisplayformat.html"
|
|
188 >SDL_DisplayFormat</A
|
|
189 > is called on the
|
|
190 surface.</P
|
|
191 ><P
|
|
192 >If <TT
|
|
193 CLASS="PARAMETER"
|
|
194 ><I
|
|
195 >flag</I
|
|
196 ></TT
|
|
197 > is 0, this function clears
|
|
198 any current color key.</P
|
|
199 ></DIV
|
|
200 ><DIV
|
|
201 CLASS="REFSECT1"
|
|
202 ><A
|
|
203 NAME="AEN1592"
|
|
204 ></A
|
|
205 ><H2
|
|
206 >Return Value</H2
|
|
207 ><P
|
|
208 >This function returns <SPAN
|
|
209 CLASS="RETURNVALUE"
|
|
210 >0</SPAN
|
|
211 >, or
|
|
212 <SPAN
|
|
213 CLASS="RETURNVALUE"
|
|
214 >-1</SPAN
|
|
215 > if there was an error.</P
|
|
216 ></DIV
|
|
217 ><DIV
|
|
218 CLASS="REFSECT1"
|
|
219 ><A
|
|
220 NAME="AEN1597"
|
|
221 ></A
|
|
222 ><H2
|
|
223 >See Also</H2
|
|
224 ><P
|
|
225 ><A
|
|
226 HREF="sdlblitsurface.html"
|
|
227 ><TT
|
|
228 CLASS="FUNCTION"
|
|
229 >SDL_BlitSurface</TT
|
|
230 ></A
|
|
231 >,
|
|
232 <A
|
|
233 HREF="sdldisplayformat.html"
|
|
234 ><TT
|
|
235 CLASS="FUNCTION"
|
|
236 >SDL_DisplayFormat</TT
|
|
237 ></A
|
|
238 >,
|
|
239 <A
|
|
240 HREF="sdlmaprgb.html"
|
|
241 ><TT
|
|
242 CLASS="FUNCTION"
|
|
243 >SDL_MapRGB</TT
|
|
244 ></A
|
|
245 >,
|
|
246 <A
|
|
247 HREF="sdlsetalpha.html"
|
|
248 ><TT
|
|
249 CLASS="FUNCTION"
|
|
250 >SDL_SetAlpha</TT
|
|
251 ></A
|
|
252 ></P
|
|
253 ></DIV
|
|
254 ><DIV
|
|
255 CLASS="NAVFOOTER"
|
|
256 ><HR
|
|
257 ALIGN="LEFT"
|
|
258 WIDTH="100%"><TABLE
|
|
259 WIDTH="100%"
|
|
260 BORDER="0"
|
|
261 CELLPADDING="0"
|
|
262 CELLSPACING="0"
|
|
263 ><TR
|
|
264 ><TD
|
|
265 WIDTH="33%"
|
|
266 ALIGN="left"
|
|
267 VALIGN="top"
|
|
268 ><A
|
|
269 HREF="sdlsavebmp.html"
|
|
270 >Prev</A
|
|
271 ></TD
|
|
272 ><TD
|
|
273 WIDTH="34%"
|
|
274 ALIGN="center"
|
|
275 VALIGN="top"
|
|
276 ><A
|
|
277 HREF="index.html"
|
|
278 >Home</A
|
|
279 ></TD
|
|
280 ><TD
|
|
281 WIDTH="33%"
|
|
282 ALIGN="right"
|
|
283 VALIGN="top"
|
|
284 ><A
|
|
285 HREF="sdlsetalpha.html"
|
|
286 >Next</A
|
|
287 ></TD
|
|
288 ></TR
|
|
289 ><TR
|
|
290 ><TD
|
|
291 WIDTH="33%"
|
|
292 ALIGN="left"
|
|
293 VALIGN="top"
|
|
294 >SDL_SaveBMP</TD
|
|
295 ><TD
|
|
296 WIDTH="34%"
|
|
297 ALIGN="center"
|
|
298 VALIGN="top"
|
|
299 ><A
|
|
300 HREF="video.html"
|
|
301 >Up</A
|
|
302 ></TD
|
|
303 ><TD
|
|
304 WIDTH="33%"
|
|
305 ALIGN="right"
|
|
306 VALIGN="top"
|
|
307 >SDL_SetAlpha</TD
|
|
308 ></TR
|
|
309 ></TABLE
|
|
310 ></DIV
|
|
311 ></BODY
|
|
312 ></HTML
|
|
313 > |