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