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