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