Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Latest commit

 

History

History
507 lines (507 loc) · 10.7 KB

video.html

File metadata and controls

507 lines (507 loc) · 10.7 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
3
4
5
6
<HTML
><HEAD
><TITLE
>Video</TITLE
><META
NAME="GENERATOR"
Feb 10, 2004
Feb 10, 2004
7
CONTENT="Modular DocBook HTML Stylesheet Version 1.76b+
Apr 26, 2001
Apr 26, 2001
8
9
10
11
12
13
14
15
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="PREVIOUS"
Feb 10, 2004
Feb 10, 2004
16
17
TITLE="SDL_envvars"
HREF="sdlenvvars.html"><LINK
Apr 26, 2001
Apr 26, 2001
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
REL="NEXT"
TITLE="SDL_GetVideoSurface"
HREF="sdlgetvideosurface.html"><META
NAME="KEYWORD"
CONTENT="video"><META
NAME="KEYWORD"
CONTENT="function"></HEAD
><BODY
CLASS="CHAPTER"
BGCOLOR="#FFF8DC"
TEXT="#000000"
LINK="#0000ee"
VLINK="#551a8b"
ALINK="#ff0000"
><DIV
CLASS="NAVHEADER"
><TABLE
Feb 10, 2004
Feb 10, 2004
35
SUMMARY="Header navigation table"
Apr 26, 2001
Apr 26, 2001
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TH
COLSPAN="3"
ALIGN="center"
>SDL Library Documentation</TH
></TR
><TR
><TD
WIDTH="10%"
ALIGN="left"
VALIGN="bottom"
><A
Feb 10, 2004
Feb 10, 2004
52
53
HREF="sdlenvvars.html"
ACCESSKEY="P"
Apr 26, 2001
Apr 26, 2001
54
55
56
57
58
59
60
61
62
63
64
65
66
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlgetvideosurface.html"
Feb 10, 2004
Feb 10, 2004
67
ACCESSKEY="N"
Apr 26, 2001
Apr 26, 2001
68
69
70
71
72
73
74
75
76
77
78
79
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="VIDEO"
Feb 10, 2004
Feb 10, 2004
80
81
></A
>Chapter 6. Video</H1
Apr 26, 2001
Apr 26, 2001
82
83
84
85
86
87
88
89
90
91
92
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="sdlgetvideosurface.html"
>SDL_GetVideoSurface</A
Feb 10, 2004
Feb 10, 2004
93
>&nbsp;--&nbsp;returns a pointer to the current display surface</DT
Apr 26, 2001
Apr 26, 2001
94
95
96
97
><DT
><A
HREF="sdlgetvideoinfo.html"
>SDL_GetVideoInfo</A
Feb 10, 2004
Feb 10, 2004
98
>&nbsp;--&nbsp;returns a pointer to information about the video hardware</DT
Apr 26, 2001
Apr 26, 2001
99
100
101
102
><DT
><A
HREF="sdlvideodrivername.html"
>SDL_VideoDriverName</A
Feb 10, 2004
Feb 10, 2004
103
>&nbsp;--&nbsp;Obtain the name of the video driver</DT
Apr 26, 2001
Apr 26, 2001
104
105
106
107
><DT
><A
HREF="sdllistmodes.html"
>SDL_ListModes</A
Feb 10, 2004
Feb 10, 2004
108
>&nbsp;--&nbsp;Returns a pointer to an array of available screen dimensions for
Apr 26, 2001
Apr 26, 2001
109
110
111
112
113
the given format and video flags</DT
><DT
><A
HREF="sdlvideomodeok.html"
>SDL_VideoModeOK</A
Feb 10, 2004
Feb 10, 2004
114
>&nbsp;--&nbsp;Check to see if a particular video mode is supported.</DT
Apr 26, 2001
Apr 26, 2001
115
116
117
118
><DT
><A
HREF="sdlsetvideomode.html"
>SDL_SetVideoMode</A
Feb 10, 2004
Feb 10, 2004
119
>&nbsp;--&nbsp;Set up a video mode with the specified width, height and bits-per-pixel.</DT
Apr 26, 2001
Apr 26, 2001
120
121
122
123
><DT
><A
HREF="sdlupdaterect.html"
>SDL_UpdateRect</A
Feb 10, 2004
Feb 10, 2004
124
>&nbsp;--&nbsp;Makes sure the given area is updated on the given screen.</DT
Apr 26, 2001
Apr 26, 2001
125
126
127
128
><DT
><A
HREF="sdlupdaterects.html"
>SDL_UpdateRects</A
Feb 10, 2004
Feb 10, 2004
129
>&nbsp;--&nbsp;Makes sure the given list of rectangles is updated on the given screen.</DT
Apr 26, 2001
Apr 26, 2001
130
131
132
133
><DT
><A
HREF="sdlflip.html"
>SDL_Flip</A
Feb 10, 2004
Feb 10, 2004
134
>&nbsp;--&nbsp;Swaps screen buffers</DT
Apr 26, 2001
Apr 26, 2001
135
136
137
138
><DT
><A
HREF="sdlsetcolors.html"
>SDL_SetColors</A
Feb 10, 2004
Feb 10, 2004
139
>&nbsp;--&nbsp;Sets a portion of the colormap for the given 8-bit surface.</DT
Apr 26, 2001
Apr 26, 2001
140
141
142
143
><DT
><A
HREF="sdlsetpalette.html"
>SDL_SetPalette</A
Feb 10, 2004
Feb 10, 2004
144
>&nbsp;--&nbsp;Sets the colors in the palette of an 8-bit surface.</DT
Apr 26, 2001
Apr 26, 2001
145
146
147
148
><DT
><A
HREF="sdlsetgamma.html"
>SDL_SetGamma</A
Feb 10, 2004
Feb 10, 2004
149
>&nbsp;--&nbsp;Sets the color gamma function for the display</DT
Apr 26, 2001
Apr 26, 2001
150
151
152
153
><DT
><A
HREF="sdlgetgammaramp.html"
>SDL_GetGammaRamp</A
Feb 10, 2004
Feb 10, 2004
154
>&nbsp;--&nbsp;Gets the color gamma lookup tables for the display</DT
Apr 26, 2001
Apr 26, 2001
155
156
157
158
><DT
><A
HREF="sdlsetgammaramp.html"
>SDL_SetGammaRamp</A
Feb 10, 2004
Feb 10, 2004
159
>&nbsp;--&nbsp;Sets the color gamma lookup tables for the display</DT
Apr 26, 2001
Apr 26, 2001
160
161
162
163
><DT
><A
HREF="sdlmaprgb.html"
>SDL_MapRGB</A
Feb 10, 2004
Feb 10, 2004
164
>&nbsp;--&nbsp;Map a RGB color value to a pixel format.</DT
Apr 26, 2001
Apr 26, 2001
165
166
167
168
><DT
><A
HREF="sdlmaprgba.html"
>SDL_MapRGBA</A
Feb 10, 2004
Feb 10, 2004
169
>&nbsp;--&nbsp;Map a RGBA color value to a pixel format.</DT
Apr 26, 2001
Apr 26, 2001
170
171
172
173
><DT
><A
HREF="sdlgetrgb.html"
>SDL_GetRGB</A
Feb 10, 2004
Feb 10, 2004
174
>&nbsp;--&nbsp;Get RGB values from a pixel in the specified pixel format.</DT
Apr 26, 2001
Apr 26, 2001
175
176
177
178
><DT
><A
HREF="sdlgetrgba.html"
>SDL_GetRGBA</A
Feb 10, 2004
Feb 10, 2004
179
>&nbsp;--&nbsp;Get RGBA values from a pixel in the specified pixel format.</DT
Apr 26, 2001
Apr 26, 2001
180
181
182
183
><DT
><A
HREF="sdlcreatergbsurface.html"
>SDL_CreateRGBSurface</A
Feb 10, 2004
Feb 10, 2004
184
>&nbsp;--&nbsp;Create an empty SDL_Surface</DT
Apr 26, 2001
Apr 26, 2001
185
186
187
188
><DT
><A
HREF="sdlcreatergbsurfacefrom.html"
>SDL_CreateRGBSurfaceFrom</A
Feb 10, 2004
Feb 10, 2004
189
>&nbsp;--&nbsp;Create an SDL_Surface from pixel data</DT
Apr 26, 2001
Apr 26, 2001
190
191
192
193
><DT
><A
HREF="sdlfreesurface.html"
>SDL_FreeSurface</A
Feb 10, 2004
Feb 10, 2004
194
>&nbsp;--&nbsp;Frees (deletes) a SDL_Surface</DT
Apr 26, 2001
Apr 26, 2001
195
196
197
198
><DT
><A
HREF="sdllocksurface.html"
>SDL_LockSurface</A
Feb 10, 2004
Feb 10, 2004
199
>&nbsp;--&nbsp;Lock a surface for directly access.</DT
Apr 26, 2001
Apr 26, 2001
200
201
202
203
><DT
><A
HREF="sdlunlocksurface.html"
>SDL_UnlockSurface</A
Feb 10, 2004
Feb 10, 2004
204
>&nbsp;--&nbsp;Unlocks a previously locked surface.</DT
Apr 26, 2001
Apr 26, 2001
205
206
207
208
><DT
><A
HREF="sdlloadbmp.html"
>SDL_LoadBMP</A
Feb 10, 2004
Feb 10, 2004
209
>&nbsp;--&nbsp;Load a Windows BMP file into an SDL_Surface.</DT
Apr 26, 2001
Apr 26, 2001
210
211
212
213
><DT
><A
HREF="sdlsavebmp.html"
>SDL_SaveBMP</A
Feb 10, 2004
Feb 10, 2004
214
>&nbsp;--&nbsp;Save an SDL_Surface as a Windows BMP file.</DT
Apr 26, 2001
Apr 26, 2001
215
216
217
218
><DT
><A
HREF="sdlsetcolorkey.html"
>SDL_SetColorKey</A
Feb 10, 2004
Feb 10, 2004
219
>&nbsp;--&nbsp;Sets the color key (transparent pixel) in a blittable surface and
Apr 26, 2001
Apr 26, 2001
220
221
222
223
224
RLE acceleration.</DT
><DT
><A
HREF="sdlsetalpha.html"
>SDL_SetAlpha</A
Feb 10, 2004
Feb 10, 2004
225
>&nbsp;--&nbsp;Adjust the alpha properties of a surface</DT
Apr 26, 2001
Apr 26, 2001
226
227
228
229
><DT
><A
HREF="sdlsetcliprect.html"
>SDL_SetClipRect</A
Feb 10, 2004
Feb 10, 2004
230
>&nbsp;--&nbsp;Sets the clipping rectangle for a surface.</DT
Apr 26, 2001
Apr 26, 2001
231
232
233
234
><DT
><A
HREF="sdlgetcliprect.html"
>SDL_GetClipRect</A
Feb 10, 2004
Feb 10, 2004
235
>&nbsp;--&nbsp;Gets the clipping rectangle for a surface.</DT
Apr 26, 2001
Apr 26, 2001
236
237
238
239
><DT
><A
HREF="sdlconvertsurface.html"
>SDL_ConvertSurface</A
Feb 10, 2004
Feb 10, 2004
240
>&nbsp;--&nbsp;Converts a surface to the same format as another surface.</DT
Apr 26, 2001
Apr 26, 2001
241
242
243
244
><DT
><A
HREF="sdlblitsurface.html"
>SDL_BlitSurface</A
Feb 10, 2004
Feb 10, 2004
245
>&nbsp;--&nbsp;This performs a fast blit from the source surface to the destination surface.</DT
Apr 26, 2001
Apr 26, 2001
246
247
248
249
><DT
><A
HREF="sdlfillrect.html"
>SDL_FillRect</A
Feb 10, 2004
Feb 10, 2004
250
>&nbsp;--&nbsp;This function performs a fast fill of the given rectangle with some color</DT
Apr 26, 2001
Apr 26, 2001
251
252
253
254
><DT
><A
HREF="sdldisplayformat.html"
>SDL_DisplayFormat</A
Feb 10, 2004
Feb 10, 2004
255
>&nbsp;--&nbsp;Convert a surface to the display format</DT
Apr 26, 2001
Apr 26, 2001
256
257
258
259
><DT
><A
HREF="sdldisplayformatalpha.html"
>SDL_DisplayFormatAlpha</A
Feb 10, 2004
Feb 10, 2004
260
>&nbsp;--&nbsp;Convert a surface to the display format</DT
Apr 26, 2001
Apr 26, 2001
261
262
263
264
><DT
><A
HREF="sdlwarpmouse.html"
>SDL_WarpMouse</A
Feb 10, 2004
Feb 10, 2004
265
>&nbsp;--&nbsp;Set the position of the mouse cursor.</DT
Apr 26, 2001
Apr 26, 2001
266
267
268
269
><DT
><A
HREF="sdlcreatecursor.html"
>SDL_CreateCursor</A
Feb 10, 2004
Feb 10, 2004
270
>&nbsp;--&nbsp;Creates a new mouse cursor.</DT
Apr 26, 2001
Apr 26, 2001
271
272
273
274
><DT
><A
HREF="sdlfreecursor.html"
>SDL_FreeCursor</A
Feb 10, 2004
Feb 10, 2004
275
>&nbsp;--&nbsp;Frees a cursor created with SDL_CreateCursor.</DT
Apr 26, 2001
Apr 26, 2001
276
277
278
279
><DT
><A
HREF="sdlsetcursor.html"
>SDL_SetCursor</A
Feb 10, 2004
Feb 10, 2004
280
>&nbsp;--&nbsp;Set the currently active mouse cursor.</DT
Apr 26, 2001
Apr 26, 2001
281
282
283
284
><DT
><A
HREF="sdlgetcursor.html"
>SDL_GetCursor</A
Feb 10, 2004
Feb 10, 2004
285
>&nbsp;--&nbsp;Get the currently active mouse cursor.</DT
Apr 26, 2001
Apr 26, 2001
286
287
288
289
><DT
><A
HREF="sdlshowcursor.html"
>SDL_ShowCursor</A
Feb 10, 2004
Feb 10, 2004
290
>&nbsp;--&nbsp;Toggle whether or not the cursor is shown on the screen.</DT
Apr 26, 2001
Apr 26, 2001
291
292
293
294
><DT
><A
HREF="sdlglloadlibrary.html"
>SDL_GL_LoadLibrary</A
Feb 10, 2004
Feb 10, 2004
295
>&nbsp;--&nbsp;Specify an OpenGL library</DT
Apr 26, 2001
Apr 26, 2001
296
297
298
299
><DT
><A
HREF="sdlglgetprocaddress.html"
>SDL_GL_GetProcAddress</A
Feb 10, 2004
Feb 10, 2004
300
>&nbsp;--&nbsp;Get the address of a GL function</DT
Apr 26, 2001
Apr 26, 2001
301
302
303
304
><DT
><A
HREF="sdlglgetattribute.html"
>SDL_GL_GetAttribute</A
Feb 10, 2004
Feb 10, 2004
305
>&nbsp;--&nbsp;Get the value of a special SDL/OpenGL attribute</DT
Apr 26, 2001
Apr 26, 2001
306
307
308
309
><DT
><A
HREF="sdlglsetattribute.html"
>SDL_GL_SetAttribute</A
Feb 10, 2004
Feb 10, 2004
310
>&nbsp;--&nbsp;Set a special SDL/OpenGL attribute</DT
Apr 26, 2001
Apr 26, 2001
311
312
313
314
><DT
><A
HREF="sdlglswapbuffers.html"
>SDL_GL_SwapBuffers</A
Feb 10, 2004
Feb 10, 2004
315
>&nbsp;--&nbsp;Swap OpenGL framebuffers/Update Display</DT
Apr 26, 2001
Apr 26, 2001
316
317
318
319
><DT
><A
HREF="sdlcreateyuvoverlay.html"
>SDL_CreateYUVOverlay</A
Feb 10, 2004
Feb 10, 2004
320
>&nbsp;--&nbsp;Create a YUV video overlay</DT
Apr 26, 2001
Apr 26, 2001
321
322
323
324
><DT
><A
HREF="sdllockyuvoverlay.html"
>SDL_LockYUVOverlay</A
Feb 10, 2004
Feb 10, 2004
325
>&nbsp;--&nbsp;Lock an overlay</DT
Apr 26, 2001
Apr 26, 2001
326
327
328
329
><DT
><A
HREF="sdlunlockyuvoverlay.html"
>SDL_UnlockYUVOverlay</A
Feb 10, 2004
Feb 10, 2004
330
>&nbsp;--&nbsp;Unlock an overlay</DT
Apr 26, 2001
Apr 26, 2001
331
332
333
334
><DT
><A
HREF="sdldisplayyuvoverlay.html"
>SDL_DisplayYUVOverlay</A
Feb 10, 2004
Feb 10, 2004
335
>&nbsp;--&nbsp;Blit the overlay to the display</DT
Apr 26, 2001
Apr 26, 2001
336
337
338
339
><DT
><A
HREF="sdlfreeyuvoverlay.html"
>SDL_FreeYUVOverlay</A
Feb 10, 2004
Feb 10, 2004
340
>&nbsp;--&nbsp;Free a YUV video overlay</DT
Apr 26, 2001
Apr 26, 2001
341
342
343
344
><DT
><A
HREF="sdlglattr.html"
>SDL_GLattr</A
Feb 10, 2004
Feb 10, 2004
345
>&nbsp;--&nbsp;SDL GL Attributes</DT
Apr 26, 2001
Apr 26, 2001
346
347
348
349
><DT
><A
HREF="sdlrect.html"
>SDL_Rect</A
Feb 10, 2004
Feb 10, 2004
350
>&nbsp;--&nbsp;Defines a rectangular area</DT
Apr 26, 2001
Apr 26, 2001
351
352
353
354
><DT
><A
HREF="sdlcolor.html"
>SDL_Color</A
Feb 10, 2004
Feb 10, 2004
355
>&nbsp;--&nbsp;Format independent color description</DT
Apr 26, 2001
Apr 26, 2001
356
357
358
359
><DT
><A
HREF="sdlpalette.html"
>SDL_Palette</A
Feb 10, 2004
Feb 10, 2004
360
>&nbsp;--&nbsp;Color palette for 8-bit pixel formats</DT
Apr 26, 2001
Apr 26, 2001
361
362
363
364
><DT
><A
HREF="sdlpixelformat.html"
>SDL_PixelFormat</A
Feb 10, 2004
Feb 10, 2004
365
>&nbsp;--&nbsp;Stores surface format information</DT
Apr 26, 2001
Apr 26, 2001
366
367
368
369
><DT
><A
HREF="sdlsurface.html"
>SDL_Surface</A
Feb 10, 2004
Feb 10, 2004
370
>&nbsp;--&nbsp;Graphical Surface Structure</DT
Apr 26, 2001
Apr 26, 2001
371
372
373
374
><DT
><A
HREF="sdlvideoinfo.html"
>SDL_VideoInfo</A
Feb 10, 2004
Feb 10, 2004
375
>&nbsp;--&nbsp;Video Target information</DT
Apr 26, 2001
Apr 26, 2001
376
377
378
379
><DT
><A
HREF="sdloverlay.html"
>SDL_Overlay</A
Feb 10, 2004
Feb 10, 2004
380
>&nbsp;--&nbsp;YUV video overlay</DT
Apr 26, 2001
Apr 26, 2001
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
></DL
></DIV
><P
>SDL presents a very simple interface to the display framebuffer. The
framebuffer is represented as an offscreen surface to which you can write
directly. If you want the screen to show what you have written, call the <A
HREF="sdlupdaterects.html"
>update</A
> function which will
guarantee that the desired portion of the screen is updated.</P
><P
>Before you call any of the SDL video functions, you must first call
<SPAN
CLASS="TOKEN"
>SDL_Init(SDL_INIT_VIDEO)</SPAN
>, which initializes the video
and events in the SDL library. Check the return code, which should be
<SPAN
CLASS="RETURNVALUE"
>0</SPAN
>, to see if there were any errors in starting up.</P
><P
>If you use both sound and video in your application, you need to call
<SPAN
CLASS="TOKEN"
>SDL_Init(SDL_INIT_AUDIO | SDL_INIT_VIDEO)</SPAN
> before opening the
sound device, otherwise under Win32 DirectX, you won't be able to set
full-screen display modes.</P
><P
>After you have initialized the library, you can start up the video display in a
number of ways. The easiest way is to pick a common screen resolution and
depth and just initialize the video, checking for errors. You will probably
get what you want, but SDL may be emulating your requested mode and converting
the display on update. The best way is to
<A
HREF="sdlgetvideoinfo.html"
>query</A
>, for the best
video mode closest to the desired one, and then
<A
HREF="sdldisplayformat.html"
>convert</A
>
your images to that pixel format.</P
><P
>SDL currently supports any bit depth &gt;= 8 bits per pixel. 8 bpp formats are
considered 8-bit palettized modes, while 12, 15, 16, 24, and 32 bits per pixel
are considered "packed pixel" modes, meaning each pixel contains the RGB color
components packed in the bits of the pixel.</P
><P
>After you have initialized your video mode, you can take the surface that was
returned, and write to it like any other framebuffer, calling the update
routine as you go.</P
><P
>When you have finished your video access and are ready to quit your
application, you should call "<SPAN
CLASS="TOKEN"
>SDL_Quit()</SPAN
>" to shutdown the
video and events.</P
></DIV
><DIV
CLASS="NAVFOOTER"
><HR
ALIGN="LEFT"
WIDTH="100%"><TABLE
Feb 10, 2004
Feb 10, 2004
448
SUMMARY="Footer navigation table"
Apr 26, 2001
Apr 26, 2001
449
450
451
452
453
454
455
456
457
458
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
Feb 10, 2004
Feb 10, 2004
459
460
HREF="sdlenvvars.html"
ACCESSKEY="P"
Apr 26, 2001
Apr 26, 2001
461
462
463
464
465
466
467
468
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
Feb 10, 2004
Feb 10, 2004
469
ACCESSKEY="H"
Apr 26, 2001
Apr 26, 2001
470
471
472
473
474
475
476
477
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlgetvideosurface.html"
Feb 10, 2004
Feb 10, 2004
478
ACCESSKEY="N"
Apr 26, 2001
Apr 26, 2001
479
480
481
482
483
484
485
486
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
Feb 10, 2004
Feb 10, 2004
487
>SDL_envvars</TD
Apr 26, 2001
Apr 26, 2001
488
489
490
491
492
493
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="reference.html"
Feb 10, 2004
Feb 10, 2004
494
ACCESSKEY="U"
Apr 26, 2001
Apr 26, 2001
495
496
497
498
499
500
501
502
503
504
505
506
507
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_GetVideoSurface</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>