Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5131 clevermous 1
2
>
3
>
4
>SDL_CreateRGBSurface
5
>
6
NAME="GENERATOR"
7
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
8
">
9
REL="HOME"
10
TITLE="SDL Library Documentation"
11
HREF="index.html">
12
REL="UP"
13
TITLE="Video"
14
HREF="video.html">
15
REL="PREVIOUS"
16
TITLE="SDL_GetRGBA"
17
HREF="sdlgetrgba.html">
18
REL="NEXT"
19
TITLE="SDL_CreateRGBSurfaceFrom"
20
HREF="sdlcreatergbsurfacefrom.html">
21
>
22
CLASS="REFENTRY"
23
BGCOLOR="#FFF8DC"
24
TEXT="#000000"
25
LINK="#0000ee"
26
VLINK="#551a8b"
27
ALINK="#ff0000"
28
>
29
CLASS="NAVHEADER"
30
>
31
WIDTH="100%"
32
BORDER="0"
33
CELLPADDING="0"
34
CELLSPACING="0"
35
>
36
>
37
COLSPAN="3"
38
ALIGN="center"
39
>SDL Library Documentation
40
>
41
>
42
>
43
WIDTH="10%"
44
ALIGN="left"
45
VALIGN="bottom"
46
>
47
HREF="sdlgetrgba.html"
48
>Prev
49
>
50
>
51
WIDTH="80%"
52
ALIGN="center"
53
VALIGN="bottom"
54
>
55
>
56
WIDTH="10%"
57
ALIGN="right"
58
VALIGN="bottom"
59
>
60
HREF="sdlcreatergbsurfacefrom.html"
61
>Next
62
>
63
>
64
>
65
>
66
ALIGN="LEFT"
67
WIDTH="100%">
68
>
69
>
70
NAME="SDLCREATERGBSURFACE"
71
>SDL_CreateRGBSurface
72
>
73
>
74
CLASS="REFNAMEDIV"
75
>
76
NAME="AEN1358"
77
>
78
>
79
>Name
80
>SDL_CreateRGBSurface -- Create an empty SDL_Surface
81
>
82
CLASS="REFSYNOPSISDIV"
83
>
84
NAME="AEN1361"
85
>
86
>
87
>Synopsis
88
>
89
CLASS="FUNCSYNOPSIS"
90
>
91
NAME="AEN1362"
92
>
93
>
94
>
95
>
96
CLASS="FUNCSYNOPSISINFO"
97
>#include "SDL.h"
98
>
99
>
100
>
101
CLASS="FUNCDEF"
102
>SDL_Surface *
103
CLASS="FSFUNC"
104
>SDL_CreateRGBSurface
105
>
106
>(Uint32 flags, int width, int height, int depth, Uint32 Rmask, Uint32 Gmask, Uint32 Bmask, Uint32 Amask);
107
>
108
>
109
>
110
>
111
>
112
>
113
CLASS="REFSECT1"
114
>
115
NAME="AEN1368"
116
>
117
>
118
>Description
119
>
120
>Allocate an empty surface (must be called after 
121
HREF="sdlsetvideomode.html"
122
>SDL_SetVideoMode
123
>)
124
>
125
>If 
126
CLASS="PARAMETER"
127
>
128
>depth
129
>
130
> is 8 bits an empty palette is allocated for the surface, otherwise a 'packed-pixel' 
131
HREF="sdlpixelformat.html"
132
>
133
CLASS="STRUCTNAME"
134
>SDL_PixelFormat
135
>
136
> is created using the 
137
CLASS="PARAMETER"
138
>
139
>[RGBA]mask
140
>
141
>'s provided (see 
142
HREF="sdlpixelformat.html"
143
>
144
CLASS="STRUCTNAME"
145
>SDL_PixelFormat
146
>
147
>). The 
148
CLASS="PARAMETER"
149
>
150
>flags
151
>
152
> specifies the type of surface that should be created, it is an OR'd combination of the following possible values.
153
>
154
CLASS="INFORMALTABLE"
155
>
156
NAME="AEN1380"
157
>
158
>
159
>
160
>
161
BORDER="1"
162
CLASS="CALSTABLE"
163
>
164
>
165
>
166
ALIGN="LEFT"
167
VALIGN="TOP"
168
>
169
CLASS="LITERAL"
170
>SDL_SWSURFACE
171
>
172
>
173
ALIGN="LEFT"
174
VALIGN="TOP"
175
>SDL will create the surface in system memory. This improves the performance of pixel level access, however you may not be able to take advantage of some types of hardware blitting.
176
>
177
>
178
>
179
ALIGN="LEFT"
180
VALIGN="TOP"
181
>
182
CLASS="LITERAL"
183
>SDL_HWSURFACE
184
>
185
>
186
ALIGN="LEFT"
187
VALIGN="TOP"
188
>SDL will attempt to create the surface in video memory. This will allow SDL to take advantage of Video->Video blits (which are often accelerated).
189
>
190
>
191
>
192
ALIGN="LEFT"
193
VALIGN="TOP"
194
>
195
CLASS="LITERAL"
196
>SDL_SRCCOLORKEY
197
>
198
>
199
ALIGN="LEFT"
200
VALIGN="TOP"
201
>This flag turns on colourkeying for blits from this surface. If
202
203
CLASS="LITERAL"
204
>SDL_HWSURFACE
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 
209
HREF="sdlsetcolorkey.html"
210
>
211
CLASS="FUNCTION"
212
>SDL_SetColorKey
213
>
214
>
215
to set or clear this flag after surface creation.
216
>
217
>
218
>
219
ALIGN="LEFT"
220
VALIGN="TOP"
221
>
222
CLASS="LITERAL"
223
>SDL_SRCALPHA
224
>
225
>
226
ALIGN="LEFT"
227
VALIGN="TOP"
228
>This flag turns on alpha-blending for blits from this surface. If
229
230
CLASS="LITERAL"
231
>SDL_HWSURFACE
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 
236
HREF="sdlsetalpha.html"
237
>
238
CLASS="FUNCTION"
239
>SDL_SetAlpha
240
>
241
> to
242
set or clear this flag after surface creation.
243
>
244
>
245
>
246
>
247
>
248
>
249
>
250
CLASS="NOTE"
251
>
252
CLASS="NOTE"
253
>
254
>
255
>Note: 
256
>If an alpha-channel is specified (that is, if 
257
CLASS="PARAMETER"
258
>
259
>Amask
260
>
261
> is
262
nonzero), then the 
263
CLASS="LITERAL"
264
>SDL_SRCALPHA
265
> flag is automatically
266
set. You may remove this flag by calling
267
268
HREF="sdlsetalpha.html"
269
>
270
CLASS="FUNCTION"
271
>SDL_SetAlpha
272
>
273
>
274
after surface creation.
275
>
276
>
277
>
278
>
279
CLASS="REFSECT1"
280
>
281
NAME="AEN1411"
282
>
283
>
284
>Return Value
285
>
286
>Returns the created surface, or 
287
CLASS="RETURNVALUE"
288
>NULL
289
> upon error.
290
>
291
>
292
CLASS="REFSECT1"
293
>
294
NAME="AEN1415"
295
>
296
>
297
>Example
298
>
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
    }
325
>
326
>
327
CLASS="REFSECT1"
328
>
329
NAME="AEN1418"
330
>
331
>
332
>See Also
333
>
334
>
335
HREF="sdlcreatergbsurfacefrom.html"
336
>
337
CLASS="FUNCTION"
338
>SDL_CreateRGBSurfaceFrom
339
>
340
>,
341
342
HREF="sdlfreesurface.html"
343
>
344
CLASS="FUNCTION"
345
>SDL_FreeSurface
346
>
347
>,
348
349
HREF="sdlsetvideomode.html"
350
>
351
CLASS="FUNCTION"
352
>SDL_SetVideoMode
353
>
354
>,
355
356
HREF="sdllocksurface.html"
357
>
358
CLASS="FUNCTION"
359
>SDL_LockSurface
360
>
361
>,
362
363
HREF="sdlpixelformat.html"
364
>
365
CLASS="STRUCTNAME"
366
>SDL_PixelFormat
367
>
368
>,
369
370
HREF="sdlsurface.html"
371
>
372
CLASS="STRUCTNAME"
373
>SDL_Surface
374
>
375
>
376
377
HREF="sdlsetalpha.html"
378
>
379
CLASS="FUNCTION"
380
>SDL_SetAlpha
381
>
382
>
383
384
HREF="sdlsetcolorkey.html"
385
>
386
CLASS="FUNCTION"
387
>SDL_SetColorKey
388
>
389
>
390
>
391
>
392
CLASS="NAVFOOTER"
393
>
394
ALIGN="LEFT"
395
WIDTH="100%">
396
WIDTH="100%"
397
BORDER="0"
398
CELLPADDING="0"
399
CELLSPACING="0"
400
>
401
>
402
WIDTH="33%"
403
ALIGN="left"
404
VALIGN="top"
405
>
406
HREF="sdlgetrgba.html"
407
>Prev
408
>
409
>
410
WIDTH="34%"
411
ALIGN="center"
412
VALIGN="top"
413
>
414
HREF="index.html"
415
>Home
416
>
417
>
418
WIDTH="33%"
419
ALIGN="right"
420
VALIGN="top"
421
>
422
HREF="sdlcreatergbsurfacefrom.html"
423
>Next
424
>
425
>
426
>
427
>
428
WIDTH="33%"
429
ALIGN="left"
430
VALIGN="top"
431
>SDL_GetRGBA
432
>
433
WIDTH="34%"
434
ALIGN="center"
435
VALIGN="top"
436
>
437
HREF="video.html"
438
>Up
439
>
440
>
441
WIDTH="33%"
442
ALIGN="right"
443
VALIGN="top"
444
>SDL_CreateRGBSurfaceFrom
445
>
446
>
447
>
448
>
449
>
450
>