Skip to content

Latest commit

 

History

History
499 lines (499 loc) · 10.3 KB

video.html

File metadata and controls

499 lines (499 loc) · 10.3 KB
 
Apr 26, 2001
Apr 26, 2001
1
2
3
4
5
6
<HTML
><HEAD
><TITLE
>Video</TITLE
><META
NAME="GENERATOR"
Jun 10, 2001
Jun 10, 2001
7
CONTENT="Modular DocBook HTML Stylesheet Version 1.64
Apr 26, 2001
Apr 26, 2001
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
"><LINK
REL="HOME"
TITLE="SDL Library Documentation"
HREF="index.html"><LINK
REL="UP"
TITLE="SDL Reference"
HREF="reference.html"><LINK
REL="PREVIOUS"
TITLE="SDL_WasInit"
HREF="sdlwasinit.html"><LINK
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
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
HREF="sdlwasinit.html"
>Prev</A
></TD
><TD
WIDTH="80%"
ALIGN="center"
VALIGN="bottom"
></TD
><TD
WIDTH="10%"
ALIGN="right"
VALIGN="bottom"
><A
HREF="sdlgetvideosurface.html"
>Next</A
></TD
></TR
></TABLE
><HR
ALIGN="LEFT"
WIDTH="100%"></DIV
><DIV
CLASS="CHAPTER"
><H1
><A
NAME="VIDEO"
>Chapter 6. Video</A
></H1
><DIV
CLASS="TOC"
><DL
><DT
><B
>Table of Contents</B
></DT
><DT
><A
HREF="sdlgetvideosurface.html"
>SDL_GetVideoSurface</A
> &#8212; returns a pointer to the current display surface</DT
><DT
><A
HREF="sdlgetvideoinfo.html"
>SDL_GetVideoInfo</A
> &#8212; returns a pointer to information about the video hardware</DT
><DT
><A
HREF="sdlvideodrivername.html"
>SDL_VideoDriverName</A
> &#8212; Obtain the name of the video driver</DT
><DT
><A
HREF="sdllistmodes.html"
>SDL_ListModes</A
> &#8212; Returns a pointer to an array of available screen dimensions for
the given format and video flags</DT
><DT
><A
HREF="sdlvideomodeok.html"
>SDL_VideoModeOK</A
> &#8212; Check to see if a particular video mode is supported.</DT
><DT
><A
HREF="sdlsetvideomode.html"
>SDL_SetVideoMode</A
> &#8212; Set up a video mode with the specified width, height and bits-per-pixel.</DT
><DT
><A
HREF="sdlupdaterect.html"
>SDL_UpdateRect</A
> &#8212; Makes sure the given area is updated on the given screen.</DT
><DT
><A
HREF="sdlupdaterects.html"
>SDL_UpdateRects</A
> &#8212; Makes sure the given list of rectangles is updated on the given screen.</DT
><DT
><A
HREF="sdlflip.html"
>SDL_Flip</A
> &#8212; Swaps screen buffers</DT
><DT
><A
HREF="sdlsetcolors.html"
>SDL_SetColors</A
> &#8212; Sets a portion of the colormap for the given 8-bit surface.</DT
><DT
><A
HREF="sdlsetpalette.html"
>SDL_SetPalette</A
> &#8212; Sets the colors in the palette of an 8-bit surface.</DT
><DT
><A
HREF="sdlsetgamma.html"
>SDL_SetGamma</A
> &#8212; Sets the color gamma function for the display</DT
><DT
><A
HREF="sdlgetgammaramp.html"
>SDL_GetGammaRamp</A
> &#8212; Gets the color gamma lookup tables for the display</DT
><DT
><A
HREF="sdlsetgammaramp.html"
>SDL_SetGammaRamp</A
> &#8212; Sets the color gamma lookup tables for the display</DT
><DT
><A
HREF="sdlmaprgb.html"
>SDL_MapRGB</A
> &#8212; Map a RGB color value to a pixel format.</DT
><DT
><A
HREF="sdlmaprgba.html"
>SDL_MapRGBA</A
> &#8212; Map a RGBA color value to a pixel format.</DT
><DT
><A
HREF="sdlgetrgb.html"
>SDL_GetRGB</A
> &#8212; Get RGB values from a pixel in the specified pixel format.</DT
><DT
><A
HREF="sdlgetrgba.html"
>SDL_GetRGBA</A
> &#8212; Get RGBA values from a pixel in the specified pixel format.</DT
><DT
><A
HREF="sdlcreatergbsurface.html"
>SDL_CreateRGBSurface</A
> &#8212; Create an empty SDL_Surface</DT
><DT
><A
HREF="sdlcreatergbsurfacefrom.html"
>SDL_CreateRGBSurfaceFrom</A
> &#8212; Create an SDL_Surface from pixel data</DT
><DT
><A
HREF="sdlfreesurface.html"
>SDL_FreeSurface</A
Jun 10, 2001
Jun 10, 2001
191
> &#8212; Frees (deletes) a SDL_Surface</DT
Apr 26, 2001
Apr 26, 2001
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
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
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
><DT
><A
HREF="sdllocksurface.html"
>SDL_LockSurface</A
> &#8212; Lock a surface for directly access.</DT
><DT
><A
HREF="sdlunlocksurface.html"
>SDL_UnlockSurface</A
> &#8212; Unlocks a previously locked surface.</DT
><DT
><A
HREF="sdlloadbmp.html"
>SDL_LoadBMP</A
> &#8212; Load a Windows BMP file into an SDL_Surface.</DT
><DT
><A
HREF="sdlsavebmp.html"
>SDL_SaveBMP</A
> &#8212; Save an SDL_Surface as a Windows BMP file.</DT
><DT
><A
HREF="sdlsetcolorkey.html"
>SDL_SetColorKey</A
> &#8212; Sets the color key (transparent pixel) in a blittable surface and
RLE acceleration.</DT
><DT
><A
HREF="sdlsetalpha.html"
>SDL_SetAlpha</A
> &#8212; Adjust the alpha properties of a surface</DT
><DT
><A
HREF="sdlsetcliprect.html"
>SDL_SetClipRect</A
> &#8212; Sets the clipping rectangle for a surface.</DT
><DT
><A
HREF="sdlgetcliprect.html"
>SDL_GetClipRect</A
> &#8212; Gets the clipping rectangle for a surface.</DT
><DT
><A
HREF="sdlconvertsurface.html"
>SDL_ConvertSurface</A
> &#8212; Converts a surface to the same format as another surface.</DT
><DT
><A
HREF="sdlblitsurface.html"
>SDL_BlitSurface</A
> &#8212; This performs a fast blit from the source surface to the destination surface.</DT
><DT
><A
HREF="sdlfillrect.html"
>SDL_FillRect</A
> &#8212; This function performs a fast fill of the given rectangle with some color</DT
><DT
><A
HREF="sdldisplayformat.html"
>SDL_DisplayFormat</A
> &#8212; Convert a surface to the display format</DT
><DT
><A
HREF="sdldisplayformatalpha.html"
>SDL_DisplayFormatAlpha</A
> &#8212; Convert a surface to the display format</DT
><DT
><A
HREF="sdlwarpmouse.html"
>SDL_WarpMouse</A
> &#8212; Set the position of the mouse cursor.</DT
><DT
><A
HREF="sdlcreatecursor.html"
>SDL_CreateCursor</A
> &#8212; Creates a new mouse cursor.</DT
><DT
><A
HREF="sdlfreecursor.html"
>SDL_FreeCursor</A
> &#8212; Frees a cursor created with SDL_CreateCursor.</DT
><DT
><A
HREF="sdlsetcursor.html"
>SDL_SetCursor</A
> &#8212; Set the currently active mouse cursor.</DT
><DT
><A
HREF="sdlgetcursor.html"
>SDL_GetCursor</A
> &#8212; Get the currently active mouse cursor.</DT
><DT
><A
HREF="sdlshowcursor.html"
>SDL_ShowCursor</A
> &#8212; Toggle whether or not the cursor is shown on the screen.</DT
><DT
><A
HREF="sdlglloadlibrary.html"
>SDL_GL_LoadLibrary</A
> &#8212; Specify an OpenGL library</DT
><DT
><A
HREF="sdlglgetprocaddress.html"
>SDL_GL_GetProcAddress</A
> &#8212; Get the address of a GL function</DT
><DT
><A
HREF="sdlglgetattribute.html"
>SDL_GL_GetAttribute</A
> &#8212; Get the value of a special SDL/OpenGL attribute</DT
><DT
><A
HREF="sdlglsetattribute.html"
>SDL_GL_SetAttribute</A
> &#8212; Set a special SDL/OpenGL attribute</DT
><DT
><A
HREF="sdlglswapbuffers.html"
>SDL_GL_SwapBuffers</A
> &#8212; Swap OpenGL framebuffers/Update Display</DT
><DT
><A
HREF="sdlcreateyuvoverlay.html"
>SDL_CreateYUVOverlay</A
> &#8212; Create a YUV video overlay</DT
><DT
><A
HREF="sdllockyuvoverlay.html"
>SDL_LockYUVOverlay</A
> &#8212; Lock an overlay</DT
><DT
><A
HREF="sdlunlockyuvoverlay.html"
>SDL_UnlockYUVOverlay</A
> &#8212; Unlock an overlay</DT
><DT
><A
HREF="sdldisplayyuvoverlay.html"
>SDL_DisplayYUVOverlay</A
> &#8212; Blit the overlay to the display</DT
><DT
><A
HREF="sdlfreeyuvoverlay.html"
>SDL_FreeYUVOverlay</A
> &#8212; Free a YUV video overlay</DT
><DT
><A
HREF="sdlglattr.html"
>SDL_GLattr</A
> &#8212; SDL GL Attributes</DT
><DT
><A
HREF="sdlrect.html"
>SDL_Rect</A
> &#8212; Defines a rectangular area</DT
><DT
><A
HREF="sdlcolor.html"
>SDL_Color</A
> &#8212; Format independent color description</DT
><DT
><A
HREF="sdlpalette.html"
>SDL_Palette</A
> &#8212; Color palette for 8-bit pixel formats</DT
><DT
><A
HREF="sdlpixelformat.html"
>SDL_PixelFormat</A
> &#8212; Stores surface format information</DT
><DT
><A
HREF="sdlsurface.html"
>SDL_Surface</A
> &#8212; Graphical Surface Structure</DT
><DT
><A
HREF="sdlvideoinfo.html"
>SDL_VideoInfo</A
> &#8212; Video Target information</DT
><DT
><A
HREF="sdloverlay.html"
>SDL_Overlay</A
> &#8212; YUV video overlay</DT
></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
WIDTH="100%"
BORDER="0"
CELLPADDING="0"
CELLSPACING="0"
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
><A
HREF="sdlwasinit.html"
>Prev</A
></TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="index.html"
>Home</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
><A
HREF="sdlgetvideosurface.html"
>Next</A
></TD
></TR
><TR
><TD
WIDTH="33%"
ALIGN="left"
VALIGN="top"
>SDL_WasInit</TD
><TD
WIDTH="34%"
ALIGN="center"
VALIGN="top"
><A
HREF="reference.html"
>Up</A
></TD
><TD
WIDTH="33%"
ALIGN="right"
VALIGN="top"
>SDL_GetVideoSurface</TD
></TR
></TABLE
></DIV
></BODY
></HTML
>