Mercurial > sdl-ios-xcode
comparison docs/html/sdlcreatergbsurface.html @ 55:55f1f1b3e27d
Added new docs for SDL 1.2.1
author | Sam Lantinga <slouken@lokigames.com> |
---|---|
date | Sun, 10 Jun 2001 19:31:57 +0000 |
parents | 74212992fb08 |
children | e5bc29de3f0a |
comparison
equal
deleted
inserted
replaced
54:028447a8a758 | 55:55f1f1b3e27d |
---|---|
2 ><HEAD | 2 ><HEAD |
3 ><TITLE | 3 ><TITLE |
4 >SDL_CreateRGBSurface</TITLE | 4 >SDL_CreateRGBSurface</TITLE |
5 ><META | 5 ><META |
6 NAME="GENERATOR" | 6 NAME="GENERATOR" |
7 CONTENT="Modular DocBook HTML Stylesheet Version 1.61 | 7 CONTENT="Modular DocBook HTML Stylesheet Version 1.64 |
8 "><LINK | 8 "><LINK |
9 REL="HOME" | 9 REL="HOME" |
10 TITLE="SDL Library Documentation" | 10 TITLE="SDL Library Documentation" |
11 HREF="index.html"><LINK | 11 HREF="index.html"><LINK |
12 REL="UP" | 12 REL="UP" |
71 >SDL_CreateRGBSurface</A | 71 >SDL_CreateRGBSurface</A |
72 ></H1 | 72 ></H1 |
73 ><DIV | 73 ><DIV |
74 CLASS="REFNAMEDIV" | 74 CLASS="REFNAMEDIV" |
75 ><A | 75 ><A |
76 NAME="AEN1316" | 76 NAME="AEN1358" |
77 ></A | 77 ></A |
78 ><H2 | 78 ><H2 |
79 >Name</H2 | 79 >Name</H2 |
80 >SDL_CreateRGBSurface -- Create an empty SDL_Surface</DIV | 80 >SDL_CreateRGBSurface -- Create an empty SDL_Surface</DIV |
81 ><DIV | 81 ><DIV |
82 CLASS="REFSYNOPSISDIV" | 82 CLASS="REFSYNOPSISDIV" |
83 ><A | 83 ><A |
84 NAME="AEN1319" | 84 NAME="AEN1361" |
85 ></A | 85 ></A |
86 ><H2 | 86 ><H2 |
87 >Synopsis</H2 | 87 >Synopsis</H2 |
88 ><DIV | 88 ><DIV |
89 CLASS="FUNCSYNOPSIS" | 89 CLASS="FUNCSYNOPSIS" |
90 ><A | 90 ><A |
91 NAME="AEN1320" | 91 NAME="AEN1362" |
92 ></A | 92 ></A |
93 ><P | 93 ><P |
94 ></P | 94 ></P |
95 ><PRE | 95 ><PRE |
96 CLASS="FUNCSYNOPSISINFO" | 96 CLASS="FUNCSYNOPSISINFO" |
110 ></DIV | 110 ></DIV |
111 ></DIV | 111 ></DIV |
112 ><DIV | 112 ><DIV |
113 CLASS="REFSECT1" | 113 CLASS="REFSECT1" |
114 ><A | 114 ><A |
115 NAME="AEN1326" | 115 NAME="AEN1368" |
116 ></A | 116 ></A |
117 ><H2 | 117 ><H2 |
118 >Description</H2 | 118 >Description</H2 |
119 ><P | 119 ><P |
120 >Allocate an empty surface (must be called after <A | 120 >Allocate an empty surface (must be called after <A |
151 ></TT | 151 ></TT |
152 > specifies the type of surface that should be created, it is an OR'd combination of the following possible values.</P | 152 > specifies the type of surface that should be created, it is an OR'd combination of the following possible values.</P |
153 ><DIV | 153 ><DIV |
154 CLASS="INFORMALTABLE" | 154 CLASS="INFORMALTABLE" |
155 ><A | 155 ><A |
156 NAME="AEN1338" | 156 NAME="AEN1380" |
157 ></A | 157 ></A |
158 ><P | 158 ><P |
159 ></P | 159 ></P |
160 ><TABLE | 160 ><TABLE |
161 BORDER="1" | 161 BORDER="1" |
196 >SDL_SRCCOLORKEY</TT | 196 >SDL_SRCCOLORKEY</TT |
197 ></TD | 197 ></TD |
198 ><TD | 198 ><TD |
199 ALIGN="LEFT" | 199 ALIGN="LEFT" |
200 VALIGN="TOP" | 200 VALIGN="TOP" |
201 >With this flag SDL will attempt to find the best location for this surface, either in system memory or video memory, to obtain hardware colorkey blitting support.</TD | 201 >This flag turns on colourkeying for blits from this surface. If |
202 <TT | |
203 CLASS="LITERAL" | |
204 >SDL_HWSURFACE</TT | |
205 > is also specified and colourkeyed blits | |
206 are hardware-accelerated, then SDL will attempt to place the surface in | |
207 video memory. | |
208 Use <A | |
209 HREF="sdlsetcolorkey.html" | |
210 ><TT | |
211 CLASS="FUNCTION" | |
212 >SDL_SetColorKey</TT | |
213 ></A | |
214 > | |
215 to set or clear this flag after surface creation.</TD | |
202 ></TR | 216 ></TR |
203 ><TR | 217 ><TR |
204 ><TD | 218 ><TD |
205 ALIGN="LEFT" | 219 ALIGN="LEFT" |
206 VALIGN="TOP" | 220 VALIGN="TOP" |
209 >SDL_SRCALPHA</TT | 223 >SDL_SRCALPHA</TT |
210 ></TD | 224 ></TD |
211 ><TD | 225 ><TD |
212 ALIGN="LEFT" | 226 ALIGN="LEFT" |
213 VALIGN="TOP" | 227 VALIGN="TOP" |
214 >With this flag SDL will attempt to find the best location for this surface, either in system memory or video memory, to obtain hardware alpha support</TD | 228 >This flag turns on alpha-blending for blits from this surface. If |
229 <TT | |
230 CLASS="LITERAL" | |
231 >SDL_HWSURFACE</TT | |
232 > is also specified and alpha-blending blits | |
233 are hardware-accelerated, then the surface will be placed in video memory if | |
234 possible. | |
235 Use <A | |
236 HREF="sdlsetalpha.html" | |
237 ><TT | |
238 CLASS="FUNCTION" | |
239 >SDL_SetAlpha</TT | |
240 ></A | |
241 > to | |
242 set or clear this flag after surface creation.</TD | |
215 ></TR | 243 ></TR |
216 ></TBODY | 244 ></TBODY |
217 ></TABLE | 245 ></TABLE |
218 ><P | 246 ><P |
219 ></P | 247 ></P |
220 ></DIV | 248 ></DIV |
249 ><DIV | |
250 CLASS="NOTE" | |
251 ><BLOCKQUOTE | |
252 CLASS="NOTE" | |
253 ><P | |
254 ><B | |
255 >Note: </B | |
256 >If an alpha-channel is specified (that is, if <TT | |
257 CLASS="PARAMETER" | |
258 ><I | |
259 >Amask</I | |
260 ></TT | |
261 > is | |
262 nonzero), then the <TT | |
263 CLASS="LITERAL" | |
264 >SDL_SRCALPHA</TT | |
265 > flag is automatically | |
266 set. You may remove this flag by calling | |
267 <A | |
268 HREF="sdlsetalpha.html" | |
269 ><TT | |
270 CLASS="FUNCTION" | |
271 >SDL_SetAlpha</TT | |
272 ></A | |
273 > | |
274 after surface creation.</P | |
275 ></BLOCKQUOTE | |
276 ></DIV | |
221 ></DIV | 277 ></DIV |
222 ><DIV | 278 ><DIV |
223 CLASS="REFSECT1" | 279 CLASS="REFSECT1" |
224 ><A | 280 ><A |
225 NAME="AEN1357" | 281 NAME="AEN1411" |
282 ></A | |
283 ><H2 | |
284 >Return Value</H2 | |
285 ><P | |
286 >Returns the created surface, or <SPAN | |
287 CLASS="RETURNVALUE" | |
288 >NULL</SPAN | |
289 > upon error.</P | |
290 ></DIV | |
291 ><DIV | |
292 CLASS="REFSECT1" | |
293 ><A | |
294 NAME="AEN1415" | |
295 ></A | |
296 ><H2 | |
297 >Example</H2 | |
298 ><PRE | |
299 CLASS="PROGRAMLISTING" | |
300 > /* Create a 32-bit surface with the bytes of each pixel in R,G,B,A order, | |
301 as expected by OpenGL for textures */ | |
302 SDL_Surface *surface; | |
303 Uint32 rmask, gmask, bmask, amask; | |
304 | |
305 /* SDL interprets each pixel as a 32-bit number, so our masks must depend | |
306 on the endianness (byte order) of the machine */ | |
307 #if SDL_BYTEORDER == SDL_BIG_ENDIAN | |
308 rmask = 0xff000000; | |
309 gmask = 0x00ff0000; | |
310 bmask = 0x0000ff00; | |
311 amask = 0x000000ff; | |
312 #else | |
313 rmask = 0x000000ff; | |
314 gmask = 0x0000ff00; | |
315 bmask = 0x00ff0000; | |
316 amask = 0xff000000; | |
317 #endif | |
318 | |
319 surface = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 32, | |
320 rmask, gmask, bmask, amask); | |
321 if(surface == NULL) { | |
322 fprintf(stderr, "CreateRGBSurface failed: %s\n", SDL_GetError()); | |
323 exit(1); | |
324 }</PRE | |
325 ></DIV | |
326 ><DIV | |
327 CLASS="REFSECT1" | |
328 ><A | |
329 NAME="AEN1418" | |
226 ></A | 330 ></A |
227 ><H2 | 331 ><H2 |
228 >See Also</H2 | 332 >See Also</H2 |
229 ><P | 333 ><P |
230 ><A | 334 ><A |
265 <A | 369 <A |
266 HREF="sdlsurface.html" | 370 HREF="sdlsurface.html" |
267 ><SPAN | 371 ><SPAN |
268 CLASS="STRUCTNAME" | 372 CLASS="STRUCTNAME" |
269 >SDL_Surface</SPAN | 373 >SDL_Surface</SPAN |
374 ></A | |
375 > | |
376 <A | |
377 HREF="sdlsetalpha.html" | |
378 ><TT | |
379 CLASS="FUNCTION" | |
380 >SDL_SetAlpha</TT | |
381 ></A | |
382 > | |
383 <A | |
384 HREF="sdlsetcolorkey.html" | |
385 ><TT | |
386 CLASS="FUNCTION" | |
387 >SDL_SetColorKey</TT | |
270 ></A | 388 ></A |
271 ></P | 389 ></P |
272 ></DIV | 390 ></DIV |
273 ><DIV | 391 ><DIV |
274 CLASS="NAVFOOTER" | 392 CLASS="NAVFOOTER" |