d1de82186f9c8911ebf626e2c94fdf5d425caa42
[sdlgit/SDL-Site.git] / pages / SDL-Video.html-inc
1 <div class="pod">
2 <!-- INDEX START -->
3 <h3 id="TOP">Index</h3>
4
5 <ul><li><a href="#NAME">NAME</a></li>
6 <li><a href="#CATEGORY">CATEGORY</a></li>
7 <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
8 <li><a href="#CONSTANTS">CONSTANTS</a></li>
9 <li><a href="#Core_Functions">Core Functions</a>
10 <ul><li><a href="#get_video_surface">get_video_surface</a></li>
11 <li><a href="#get_video_info">get_video_info</a></li>
12 <li><a href="#video_driver_name">video_driver_name</a></li>
13 <li><a href="#list_modes">list_modes</a></li>
14 <li><a href="#video_mode_ok">video_mode_ok</a></li>
15 <li><a href="#set_video_mode">set_video_mode</a>
16 <ul><li><a href="#List_of_avalaibles_flags">List of avalaibles flags</a></li>
17 </ul>
18 </li>
19 <li><a href="#convert_surface">convert_surface</a></li>
20 <li><a href="#display_format">display_format</a></li>
21 <li><a href="#display_format_alpha">display_format_alpha</a></li>
22 <li><a href="#load_BMP">load_BMP</a></li>
23 <li><a href="#save_BMP">save_BMP</a></li>
24 <li><a href="#set_color_key">set_color_key</a></li>
25 <li><a href="#set_alpha">set_alpha</a></li>
26 <li><a href="#fill_rect">fill_rect</a></li>
27 </ul>
28 </li>
29 <li><a href="#Surface_Locking_and_Unlocking">Surface Locking and Unlocking</a>
30 <ul><li><a href="#lock_surface">lock_surface</a></li>
31 <li><a href="#unlock_surface">unlock_surface</a></li>
32 <li><a href="#MUSTLOCK">MUSTLOCK</a></li>
33 </ul>
34 </li>
35 <li><a href="#Screen_Updating_Functions">Screen Updating Functions</a>
36 <ul><li><a href="#set_clip_rect">set_clip_rect</a></li>
37 <li><a href="#get_clip_rect">get_clip_rect</a></li>
38 <li><a href="#blit_surface">blit_surface</a></li>
39 <li><a href="#update_rect">update_rect</a></li>
40 <li><a href="#update_rects">update_rects</a></li>
41 <li><a href="#flip">flip</a></li>
42 </ul>
43 </li>
44 <li><a href="#Palette_Color_and_Pixel_Functions">Palette, Color and Pixel Functions</a>
45 <ul><li><a href="#set_colors">set_colors</a></li>
46 <li><a href="#set_palette">set_palette</a></li>
47 <li><a href="#set_gamma">set_gamma</a></li>
48 <li><a href="#get_gamma_ramp">get_gamma_ramp</a></li>
49 <li><a href="#set_gamma_ramp">set_gamma_ramp</a></li>
50 <li><a href="#map_RGB">map_RGB</a></li>
51 <li><a href="#map_RGBA">map_RGBA</a></li>
52 <li><a href="#get_RGB">get_RGB</a></li>
53 <li><a href="#get_RGBA">get_RGBA</a></li>
54 </ul>
55 </li>
56 <li><a href="#GL_Methods">GL Methods</a>
57 <ul><li><a href="#GL_load_library">GL_load_library</a></li>
58 <li><a href="#GL_get_proc_address">GL_get_proc_address</a></li>
59 <li><a href="#GL_get_attribute">GL_get_attribute</a></li>
60 <li><a href="#GL_set_attribute">GL_set_attribute</a></li>
61 <li><a href="#GL_swap_buffers">GL_swap_buffers</a></li>
62 </ul>
63 </li>
64 <li><a href="#Video_Overlay_Functions">Video Overlay Functions</a>
65 <ul><li><a href="#lock_YUV_overlay">lock_YUV_overlay</a></li>
66 <li><a href="#unlock_YUV_overlay">unlock_YUV_overlay</a></li>
67 <li><a href="#display_YUV_overlay">display_YUV_overlay</a></li>
68 </ul>
69 </li>
70 <li><a href="#Window_Management_Functions">Window Management Functions</a>
71 <ul><li><a href="#wm_set_caption">wm_set_caption</a></li>
72 <li><a href="#wm_get_caption">wm_get_caption</a></li>
73 <li><a href="#wm_set_icon">wm_set_icon</a></li>
74 <li><a href="#wm_grab_input">wm_grab_input</a></li>
75 <li><a href="#wm_iconify_window">wm_iconify_window</a></li>
76 <li><a href="#wm_toggle_fullscreen">wm_toggle_fullscreen</a></li>
77 </ul>
78 </li>
79 <li><a href="#AUTHOR">AUTHOR</a></li>
80 <li><a href="#SEE_ALSO">SEE ALSO</a>
81 <ul><li><a href="#Category_Objects">Category Objects</a>
82 </li>
83 </ul>
84 </li>
85 </ul><hr />
86 <!-- INDEX END --><a href="assets/Video.png" target="_blank"><img src="assets/Video.png" style="height: 160px" alt="Video.png"/></a><a href="assets/Video_lock_surface.png" target="_blank"><img src="assets/Video_lock_surface.png" style="height: 160px" alt="Video_lock_surface.png"/></a><hr />
87
88 <h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
89 <div id="NAME_CONTENT">
90 <p>SDL::Video - Bindings to the video category in SDL API</p>
91
92 </div>
93 <h1 id="CATEGORY">CATEGORY</h1><p><a href="#TOP" class="toplink">Top</a></p>
94 <div id="CATEGORY_CONTENT">
95 <p>Core, Video</p>
96
97 </div>
98 <h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
99 <div id="SYNOPSIS_CONTENT">
100 <pre> use SDL ':init';
101  use SDL::Video ':flags';
102  use SDL::Surface;
103  use SDL::Rect;
104
105  # the size of the window box or the screen resolution if fullscreen
106  my $screen_width   = 800;
107  my $screen_height  = 600;
108
109  SDL::init(SDL_INIT_VIDEO);
110
111  # setting video mode
112  my $screen_surface = SDL::Video::set_video_mode($screen_width, $screen_height, 32, SDL_ANYFORMAT);
113
114  # drawing something somewhere
115  my $mapped_color   = SDL::Video::map_RGB($screen_surface-&gt;format(), 0, 0, 255); # blue
116  SDL::Video::fill_rect($screen_surface, 
117                        SDL::Rect-&gt;new($screen_width / 4, $screen_height / 4, 
118                                       $screen_width / 2, $screen_height / 2), $mapped_color);
119
120  # update an area on the screen so its visible
121  SDL::Video::update_rect($screen_surface, 0, 0, $screen_width, $screen_height);
122
123  sleep(5); # just to have time to see it
124
125  SDL::quit();
126
127 </pre>
128
129 </div>
130 <h1 id="CONSTANTS">CONSTANTS</h1><p><a href="#TOP" class="toplink">Top</a></p>
131 <div id="CONSTANTS_CONTENT">
132 <p>Available flags for <a href="/SDL-Video.html#set_video_mode">SDL::Video::set_video_mode</a>:</p>
133 <dl>
134         <dt>SDL_ANYFORMAT</dt>
135         <dd>
136                 <p>Allow any pixel-format *</p>
137         </dd>
138         <dt>SDL_HWPALETTE</dt>
139         <dd>
140                 <p>Have an exclusive palette</p>
141         </dd>
142         <dt>SDL_DOUBLEBUF</dt>
143         <dd>
144                 <p>Double buffered *</p>
145         </dd>
146         <dt>SDL_FULLSCREEN</dt>
147         <dd>
148                 <p>Full screen surface *</p>
149         </dd>
150         <dt>SDL_OPENGL</dt>
151         <dd>
152                 <p>Have an OpenGL context *</p>
153         </dd>
154         <dt>SDL_OPENGLBLIT</dt>
155         <dd>
156                 <p>Support OpenGL blitting *. NOTE: This option is kept for compatibility only, and is not recommended for new code.</p>
157         </dd>
158         <dt>SDL_RESIZABLE</dt>
159         <dd>
160                 <p>Resizable surface *</p>
161         </dd>
162         <dt>SDL_NOFRAME</dt>
163         <dd>
164                 <p>No window caption or edge frame</p>
165         </dd>
166 </dl>
167 <p>Used internally</p>
168 <dl>
169         <dt>SDL_HWACCEL</dt>
170         <dd>
171                 <p>Use hardware acceleration blit</p>
172         </dd>
173         <dt>SDL_SRCCOLORKEY</dt>
174         <dd>
175                 <p>Use colorkey blitting</p>
176         </dd>
177         <dt>SDL_RLEACCELOK</dt>
178         <dd>
179                 <p>Private flag</p>
180         </dd>
181         <dt>SDL_RLEACCEL</dt>
182         <dd>
183                 <p>Accelerated colorkey blitting with RLE</p>
184         </dd>
185         <dt>SDL_SRCALPHA</dt>
186         <dd>
187                 <p>Use alpha blending blit</p>
188         </dd>
189         <dt>SDL_PREALLOC</dt>
190         <dd>
191                 <p>Use preallocated memory</p>
192         </dd>
193 </dl>
194
195
196
197
198
199 </div>
200 <h1 id="Core_Functions">Core Functions</h1><p><a href="#TOP" class="toplink">Top</a></p>
201 <div id="Core_Functions_CONTENT">
202
203 </div>
204 <h2 id="get_video_surface">get_video_surface</h2>
205 <div id="get_video_surface_CONTENT">
206 <pre> my $surface = SDL::Video::get_video_surface();
207
208 </pre>
209 <p>This function returns the current display <a href="SDL-Surface.html">SDL::Surface</a>. If SDL is doing format conversion on the display surface, this 
210 function returns the publicly visible surface, not the real video surface.</p>
211 <p>Example:</p>
212 <pre> # somewhere after you set the video mode
213  my $surface = SDL::Video::get_video_surface();
214
215  printf( &quot;our screen is %d pixels wide and %d pixels high\n&quot;, $surface-&gt;w, $surface-&gt;h );
216
217 </pre>
218
219 </div>
220 <h2 id="get_video_info">get_video_info</h2>
221 <div id="get_video_info_CONTENT">
222 <pre> my $video_info = SDL::Video::get_video_info();
223
224 </pre>
225 <p>This function returns a read-only <a href="SDL-VideoInfo.html">SDL::VideoInfo</a> containing information about the video hardware. If it is called before 
226 <a href="#set_video_mode">SDL::Video::set_video_mode</a>, the <code>vfmt</code> member of the returned structure will contain the pixel 
227 format of the <strong>best</strong> video mode. </p>
228 <p>Example:</p>
229 <pre> use SDL;
230  use SDL::Video;
231  use SDL::VideoInfo;
232  use SDL::PixelFormat;
233
234  SDL::init(SDL_INIT_VIDEO);
235
236  my $video_info = SDL::Video::get_video_info();
237
238  printf( &quot;we can have %dbits per pixel\n&quot;, $video_info-&gt;vfmt-&gt;BitsPerPixel );
239
240  SDL::quit();
241
242 </pre>
243
244 </div>
245 <h2 id="video_driver_name">video_driver_name</h2>
246 <div id="video_driver_name_CONTENT">
247 <pre> my $driver_name = SDL::Video::video_driver_name();
248
249 </pre>
250 <p>This function will return the name of the initialized video driver up to a maximum of 1024 characters. The driver name is a simple one 
251 word identifier like <code>&quot;x11&quot;</code>, <code>&quot;windib&quot;</code> or <code>&quot;directx&quot;</code>.</p>
252 <p><strong>Note</strong>: Some platforms allow selection of the video driver through the <code>SDL_VIDEODRIVER</code> environment variable. </p>
253 <p>Example:</p>
254 <pre> use SDL;
255  use SDL::Video;
256
257  SDL::init(SDL_INIT_VIDEO);
258
259  print SDL::Video::video_driver_name() . &quot;\n&quot;;
260
261  SDL::quit();
262
263 </pre>
264
265 </div>
266 <h2 id="list_modes">list_modes</h2>
267 <div id="list_modes_CONTENT">
268 <pre> my @modes = @{ SDL::Video::list_modes( $pixel_format, $flags ) };
269
270 </pre>
271 <p>Returns a ref to an array of available screen dimensions for the given format and video flags,
272 or it return undef if no modes are available.</p>
273 <p>Example:</p>
274 <pre> use SDL;
275  use SDL::Video;
276  use SDL::VideoInfo;
277  use SDL::PixelFormat;
278  use SDL::Rect;
279
280  SDL::init(SDL_INIT_VIDEO);
281
282  my $video_info = SDL::Video::get_video_info();
283
284  my @modes = @{ SDL::Video::list_modes($video_info-&gt;vfmt, SDL_NOFRAME) };
285
286  if($#modes &gt; 0)
287  {
288      print(&quot;available modes:\n&quot;);
289      foreach my $index ( @modes )
290      {
291          printf(&quot;%03d: %d x %d\n&quot;, $index, $modes[$index]-&gt;w, $modes[$index]-&gt;h );
292      }
293  }
294  elsif($#modes == 0)
295  {
296      printf(&quot;%s video modes available\n&quot;, $modes[0]);
297  }
298
299  SDL::quit();
300
301 </pre>
302
303 </div>
304 <h2 id="video_mode_ok">video_mode_ok</h2>
305 <div id="video_mode_ok_CONTENT">
306 <pre> my $bpp_ok = SDL::Video::video_mode_ok( $width, $height, $bpp, $flags );
307
308 </pre>
309 <p>This function is used to check whether the requested mode is supported by the current video device. The arguments passed to this function 
310 are the same as those you would pass to <a href="#set_video_mode">SDL::Video::set_video_mode</a>. 
311 It returns <code>0</code> if the mode is not supported at all, otherwise the suggested <code>bpp</code>.</p>
312 <p>Example:</p>
313 <pre> use SDL;
314  use SDL::Video;
315
316  SDL::init(SDL_INIT_VIDEO);
317
318  my $video_mode_ok = SDL::Video::video_mode_ok( 800, 600, 32, SDL_SWSURFACE );
319
320  unless($video_mode_ok)
321  {
322      printf( &quot;this video mode is not supported\n&quot; );
323  }
324
325  SDL::quit();
326
327 </pre>
328
329 </div>
330 <h2 id="set_video_mode">set_video_mode</h2>
331 <div id="set_video_mode_CONTENT">
332 <pre> my $surface = SDL::Video::set_video_mode( 800, 600, 32, SDL_SWSURFACE|SDL_DOUBLEBUF|SDL_FULLSCREEN);
333
334 </pre>
335 <p>Sets up a video mode with the specified width, height, bits-per-pixel and flags. 
336 <code>set_video_mode</code> returns a <a href="SDL-Surface.html">SDL::Surface</a> on success otherwise it returns undef on error, the error message is retrieved 
337 using <code>SDL::get_error</code>.</p>
338
339 </div>
340 <h3 id="List_of_avalaibles_flags">List of avalaibles flags</h3>
341 <div id="List_of_avalaibles_flags_CONTENT">
342 <dl>
343         <dt><code>SDL_SWSURFACE</code></dt>
344         <dd>
345                 <p>Create the video surface in system memory</p>
346         </dd>
347         <dt><code>SDL_HWSURFACE</code></dt>
348         <dd>
349                 <p>Create the video surface in video memory</p>
350         </dd>
351         <dt><code>SDL_ASYNCBLIT</code></dt>
352         <dd>
353                 <p>Enables the use of asynchronous updates of the display surface. 
354 This will usually slow down blitting on single CPU machines, but may provide a speed increase on SMP systems.</p>
355         </dd>
356         <dt><code>SDL_ANYFORMAT</code></dt>
357         <dd>
358                 <p>Normally, if a video surface of the requested bits-per-pixel (bpp) is not available, SDL will emulate one with a shadow surface.
359 Passing <code>SDL_ANYFORMAT</code> prevents this and causes SDL to use the video surface, regardless of its pixel depth.</p>
360         </dd>
361         <dt><code>SDL_HWPALETTE</code></dt>
362         <dd>
363                 <p>Give SDL exclusive palette access. Without this flag you may not always get the colors you request with SDL::set_colors or SDL::set_palette.</p>
364         </dd>
365         <dt><code>SDL_DOUBLEBUF</code></dt>
366         <dd>
367                 <p>Enable hardware double buffering; only valid with <code>SDL_HWSURFACE</code>. Calling <a href="#flip">SDL::Video::flip</a> will flip the buffers and update 
368 the screen. 
369 All drawing will take place on the surface that is not displayed at the moment. 
370 If double buffering could not be enabled then <a href="#flip">SDL::Video::flip</a> will just perform a 
371 <a href="#update_rect">SDL::Video::update_rect</a> on the entire screen.</p>
372         </dd>
373         <dt><code>SDL_FULLSCREEN</code></dt>
374         <dd>
375                 <p>SDL will attempt to use a fullscreen mode. If a hardware resolution change is not possible (for whatever reason), 
376 the next higher resolution will be used and the display window centered on a black background.</p>
377         </dd>
378         <dt><code>SDL_OPENGL</code></dt>
379         <dd>
380                 <p>Create an OpenGL rendering context. You should have previously set OpenGL video attributes with 
381 <a href="#GL_set_attribute">SDL::Video::GL_set_attribute</a>.</p>
382         </dd>
383         <dt><code>SDL_OPENGLBLIT</code></dt>
384         <dd>
385                 <p>Create an OpenGL rendering context, like above, but allow normal blitting operations. 
386 The screen (2D) surface may have an alpha channel, and SDL::update_rects must be used for updating changes to the screen surface. 
387 NOTE: This option is kept for compatibility only, and will be removed in next versions. Is not recommended for new code.</p>
388         </dd>
389         <dt><code>SDL_RESIZABLE</code></dt>
390         <dd>
391                 <p>Create a resizable window. 
392 When the window is resized by the user a <code>SDL_VIDEORESIZE</code> event is generated and 
393 <a href="#set_video_mode">SDL::Video::set_video_mode</a> can be called again with the new size.</p>
394         </dd>
395         <dt><code>SDL_NOFRAME</code></dt>
396         <dd>
397                 <p>If possible, SDL_NOFRAME causes SDL to create a window with no title bar or frame decoration. 
398 Fullscreen modes automatically have this flag set.</p>
399         </dd>
400 </dl>
401 <p><strong>Note 1</strong>: Use <code>SDL_SWSURFACE</code> if you plan on doing per-pixel manipulations, or blit surfaces with alpha channels, and require a high framerate. 
402 When you use hardware surfaces (by passing the flag <code>SDL_HWSURFACE</code> as parameter), SDL copies the surfaces from video memory to system memory 
403 when you lock them, and back when you unlock them. This can cause a major performance hit. Be aware that you may request a hardware surface, 
404 but receive a software surface because the video driver doesn't support hardware surface. Many platforms can only provide a hardware surface 
405 when using <code>SDL_FULLSCREEN</code>. The <code>SDL_HWSURFACE</code> flag is best used when the surfaces you'll be blitting can also be stored in video memory.</p>
406 <p><strong>Note 2</strong>: If you want to control the position on the screen when creating a windowed surface, you may do so by setting the environment 
407 variables <code>SDL_VIDEO_CENTERED=center</code> or <code>SDL_VIDEO_WINDOW_POS=x,y</code>. You can also set them via <code>SDL::putenv</code>.</p>
408 <p><strong>Note 3</strong>: This function should be called in the main thread of your application.</p>
409 <p><strong>User note 1</strong>: Some have found that enabling OpenGL attributes like <code>SDL_GL_STENCIL_SIZE</code> (the stencil buffer size) before the video mode has 
410 been set causes the application to simply ignore those attributes, while enabling attributes after the video mode has been set works fine.</p>
411 <p><strong>User note 2</strong>: Also note that, in Windows, setting the video mode resets the current OpenGL context. You must execute again the OpenGL 
412 initialization code (set the clear color or the shade model, or reload textures, for example) after calling SDL::set_video_mode. In Linux, 
413 however, it works fine, and the initialization code only needs to be executed after the first call to 
414 <a href="#set_video_mode">SDL::Video::set_video_mode</a> (although there is no harm in executing the initialization code after 
415 each call to <a href="#set_video_mode">SDL::Video::set_video_mode</a>, for example for a multiplatform application). </p>
416
417 </div>
418 <h2 id="convert_surface">convert_surface</h2>
419 <div id="convert_surface_CONTENT">
420 <pre> $converted_surface = SDL::Video::convert_surface( $surface, $format, $flags );
421
422 </pre>
423 <p>Creates a new SDL::surface of the specified <a href="SDL-PixelFormat.html">SDL::PixelFormat</a>, and then copies and maps the given surface to it. 
424 It is also useful for making a copy of a surface.</p>
425 <p>The flags parameter is passed to <a href="SDL-Surface.html">SDL::Surface</a><code>-&gt;new</code> and has those semantics.
426 This function is used internally by <a href="#display_format">SDL::Video::display_format</a>.
427 This function can only be called after <code>SDL::init</code>. </p>
428 <p>it returns a <a href="SDL-Surface.html">SDL::Surface</a> on success or <code>undef</code> on error.</p>
429
430 </div>
431 <h2 id="display_format">display_format</h2>
432 <div id="display_format_CONTENT">
433 <pre> $new_surface = SDL::Video::display_format( $surface );
434
435 </pre>
436 <p>This function takes a surface and copies it to a new surface of the pixel format and colors of the video framebuffer, suitable for fast 
437 blitting onto the display surface. It calls <a href="#conver_surface">SDL::Video::convert_surface</a>.</p>
438 <p>If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and alpha value before calling 
439 this function.</p>
440 <p>If you want an alpha channel, see <code>SDL::Video::display_format_alpha</code>.
441 Return Value</p>
442 <p><strong>Note</strong>: Remember to use a different variable for the returned surface, otherwise you have a memory leak, since the original surface isn't freed. </p>
443
444 </div>
445 <h2 id="display_format_alpha">display_format_alpha</h2>
446 <div id="display_format_alpha_CONTENT">
447 <pre> $new_surface = SDL::Video::display_format_alpha( $surface );
448
449 </pre>
450 <p>This function takes a surface and copies it to a new surface of the pixel format and colors of the video framebuffer plus an alpha channel, 
451 suitable for fast blitting onto the display surface. It calls <a href="#convert_surface">SDL::Video::convert_surface</a>.</p>
452 <p>If you want to take advantage of hardware colorkey or alpha blit acceleration, you should set the colorkey and alpha value before calling 
453 this function.</p>
454 <p>This function can be used to convert a colorkey to an alpha channel, if the <code>SDL_SRCCOLORKEY</code> flag is set on the surface. The generated 
455 surface will then be transparent (alpha=0) where the pixels match the colorkey, and opaque (alpha=255) elsewhere.</p>
456 <p><strong>Note</strong>: The video surface must be initialised using <a href="#set_video_mode">SDL::Video::set_video_mode</a> before this function is called, or it will 
457 segfault.</p>
458
459 </div>
460 <h2 id="load_BMP">load_BMP</h2>
461 <div id="load_BMP_CONTENT">
462 <pre> $surface = SDL::Video::load_BMP( $filename );
463
464 </pre>
465 <p>Loads a <a href="SDL-Surface.html">SDL::Surface</a> from a named Windows BMP file.
466 <code>SDL::Video::load_BMP</code> returns a <a href="SDL-Surface.html">SDL::Surface</a> on success or <code>undef</code> on error.</p>
467 <p><strong>Note</strong>: When loading a 24-bit Windows BMP file, pixel data points are loaded as blue, green, red, and NOT red, green, blue (as one might expect). </p>
468 <pre> use SDL;
469  use SDL::Video;
470  use SDL::Rect;
471  use SDL::Surface;
472
473  my $screen_width  = 640;
474  my $screen_height = 480;
475
476  SDL::init(SDL_INIT_VIDEO);
477
478  my $screen  = SDL::Video::set_video_mode($screen_width, $screen_height, 32, SDL_SWSURFACE);
479
480  my $picture = SDL::Video::load_BMP('test.bmp');
481
482  die(SDL::get_error) unless $picture;
483
484  my $rect    = SDL::Rect-&gt;new(0, 0, $screen_width, $screen_height);
485
486  SDL::Video::blit_surface( $picture, SDL::Rect-&gt;new(0, 0, $picture-&gt;w, $picture-&gt;h), 
487                            $screen,  SDL::Rect-&gt;new(0, 0, $screen-&gt;w,  $screen-&gt;h) );
488
489  SDL::Video::update_rect( $screen, 0, 0, $screen_width, $screen_height );
490
491  sleep(2);
492
493  SDL::quit;
494
495 </pre>
496
497 </div>
498 <h2 id="save_BMP">save_BMP</h2>
499 <div id="save_BMP_CONTENT">
500 <pre> $saved_BMP = SDL::Video::save_BMP( $surface, $filename );
501
502 </pre>
503 <p>Saves the given <a href="SDL-Surface.html">SDL::Surface</a> as a Windows BMP file named filename. 
504 it returns 0 on success or -1 on error.</p>
505
506 </div>
507 <h2 id="set_color_key">set_color_key</h2>
508 <div id="set_color_key_CONTENT">
509 <pre> $set_color_key = SDL::Video::set_color_key( $surface, $flag, $key );
510
511 </pre>
512 <p>Sets the color key (transparent pixel) in a blittable surface and enables or disables RLE blit acceleration.</p>
513 <p>RLE acceleration can substantially speed up blitting of images with large horizontal runs of transparent pixels (i.e., pixels that match 
514 the key value).
515 The key must be of the same pixel format as the surface, <a href="#map_RGB">SDL::Video::map_RGB</a> is often useful for obtaining an acceptable value.
516 If flag is <code>SDL_SRCCOLORKEY</code> then key is the transparent pixel value in the source image of a blit.</p>
517 <p>If <code>flag</code> is OR'd with <code>SDL_RLEACCEL</code> then the surface will be drawn using RLE acceleration when drawn with SDL::Blit_surface.
518 The surface will actually be encoded for RLE acceleration the first time <a href="#blit_surface">SDL::Video::blit_surface</a> or 
519 <code>SDL::Video::display_format|/display_format</code> is called on the surface.
520 If <code>flag</code> is <code>0</code>, this function clears any current color key. </p>
521 <p><code>SDL::Video::set_color_key</code> returns <code>0</code> on success or <code>-1</code> on error.</p>
522
523 </div>
524 <h2 id="set_alpha">set_alpha</h2>
525 <div id="set_alpha_CONTENT">
526 <pre> $set_alpha = SDL::Video::set_alpha( $surface, $flag, $key );
527
528 </pre>
529 <p><code>set_alpha</code> is used for setting the per-surface alpha value and/or enabling and disabling alpha blending.</p>
530 <p>The surface parameter specifies which SDL::surface whose alpha attributes you wish to adjust. 
531 flags is used to specify whether alpha blending should be used ( <code>SDL_SRCALPHA</code> ) and whether the surface should use RLE acceleration for 
532 blitting ( <code>SDL_RLEACCEL</code> ). 
533 flags can be an OR'd combination of these two options, one of these options or <code>0</code>. 
534 If <code>SDL_SRCALPHA</code> is not passed as a flag then all alpha information is ignored when blitting the surface. 
535 The alpha parameter is the per-surface alpha value; a surface need not have an alpha channel to use per-surface alpha and blitting can 
536 still be accelerated with <code>SDL_RLEACCEL</code>.</p>
537 <p><strong>Note</strong>: The per-surface alpha value of 128 is considered a special case and is optimised, so it's much faster than other per-surface values.</p>
538 <p>Alpha affects surface blitting in the following ways: </p>
539 <dl>
540         <dt>RGBA-&gt;RGB with <code>SDL_SRCALPHA</code></dt>
541         <dd>
542                 <p>The source is alpha-blended with the destination, using the alpha channel. 
543 SDL_SRCCOLORKEY and the per-surface alpha are ignored.</p>
544         </dd>
545         <dt>RGBA-&gt;RGB without <code>SDL_SRCALPHA</code></dt>
546         <dd>
547                 <p>The RGB data is copied from the source. The source alpha channel and the per-surface alpha value are ignored. 
548 If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.</p>
549         </dd>
550         <dt>RGB-&gt;RGBA with <code>SDL_SRCALPHA</code></dt>
551         <dd>
552                 <p>The source is alpha-blended with the destination using the per-surface alpha value. 
553 If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied. 
554 The alpha channel of the copied pixels is set to opaque.</p>
555         </dd>
556         <dt>RGB-&gt;RGBA without <code>SDL_SRCALPHA</code></dt>
557         <dd>
558                 <p>The RGB data is copied from the source and the alpha value of the copied pixels is set to opaque. 
559 If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.</p>
560         </dd>
561         <dt>RGBA-&gt;RGBA with <code>SDL_SRCALPHA</code></dt>
562         <dd>
563                 <p>The source is alpha-blended with the destination using the source alpha channel. 
564 The alpha channel in the destination surface is left untouched. SDL_SRCCOLORKEY is ignored.</p>
565         </dd>
566         <dt>RGBA-&gt;RGBA without <code>SDL_SRCALPHA</code></dt>
567         <dd>
568                 <p>The RGBA data is copied to the destination surface.
569 If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.</p>
570         </dd>
571         <dt>RGB-&gt;RGB with <code>SDL_SRCALPHA</code></dt>
572         <dd>
573                 <p>The source is alpha-blended with the destination using the per-surface alpha value. 
574 If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.</p>
575         </dd>
576         <dt>RGB-&gt;RGB without <code>SDL_SRCALPHA</code></dt>
577         <dd>
578                 <p>The RGB data is copied from the source. 
579 If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.</p>
580         </dd>
581 </dl>
582 <p><strong>Note</strong>: When blitting, the presence or absence of <code>SDL_SRCALPHA</code> is relevant only on the source surface, not the destination.
583 <strong>Note</strong>: Note that RGBA-&gt;RGBA blits (with <code>SDL_SRCALPHA</code> set) keep the alpha of the destination surface. This means that you cannot compose 
584 two arbitrary RGBA surfaces this way and get the result you would expect from &quot;overlaying&quot; them; the destination alpha will work as a mask.</p>
585 <p><strong>Note</strong>: Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used if available. </p>
586 <p><code>SDL::Video::set_alpha</code> returns <code>0</code> on success or <code>-1</code> on error.</p>
587
588 </div>
589 <h2 id="fill_rect">fill_rect</h2>
590 <div id="fill_rect_CONTENT">
591 <pre> $fill_rect = SDL::Video::fill_rect( $dest, $dest_rect, $pixel );
592
593 </pre>
594 <p>This function performs a fast fill of the given <a href="SDL-Rect.html">SDL::Rect</a> with the given <a href="SDL-PixelFormat.html">SDL::PixelFormat</a>. If dest_rect is NULL, the whole surface 
595 will be filled with color.</p>
596 <p>The color should be a pixel of the format used by the surface, and can be generated by the <a href="#map_RGB">SDL::Video::map_RGB</a> or 
597 <code>SDL::Video::map_RGBA|/map_RGBA</code> functions. If the color value contains an alpha value then the destination is simply &quot;filled&quot; with that 
598 alpha information, no blending takes place.</p>
599 <p>If there is a clip rectangle set on the destination (set via <a href="#set_clip_rect">SDL::Video::set_clip_rect</a>), then this function will clip based 
600 on the intersection of the clip rectangle and the dstrect rectangle, and the dstrect rectangle will be modified to represent the area actually 
601 filled.</p>
602 <p>If you call this on the video surface (ie: the value of <a href="#get_video_surface">SDL::Video::get_video_surface</a>) you may have to update the video 
603 surface to see the result. This can happen if you are using a shadowed surface that is not double buffered in Windows XP using build 1.2.9. </p>
604 <p><code>SDL::Video::fill_rect</code> returns <code>0</code> on success or <code>-1</code> on error.</p>
605 <p>for an example see <a href="#SYNOPSIS">SYNOPSIS</a>.</p>
606
607 </div>
608 <h1 id="Surface_Locking_and_Unlocking">Surface Locking and Unlocking</h1><p><a href="#TOP" class="toplink">Top</a></p>
609 <div id="Surface_Locking_and_Unlocking_CONTEN">
610
611 </div>
612 <h2 id="lock_surface">lock_surface</h2>
613 <div id="lock_surface_CONTENT">
614 <pre> int SDL::Video::lock_surface( $surface );
615
616 </pre>
617 <p><code>SDL::Video::lock_surface</code> sets up the given <a href="SDL-Surface.html">SDL::Surface</a> for directly accessing the pixels.
618 Between calls to SDL::lock_surface and SDL::unlock_surface, you can write to ( <code>surface-</code>set_pixels&gt;) and read from ( <code>surface-</code>get_pixels&gt; ), 
619 using the pixel format stored in <code>surface-</code>format&gt;. 
620 Once you are done accessing the surface, you should use <a href="#unlock_surface">SDL::Video::unlock_surface</a> to release the lock.</p>
621 <p>Not all surfaces require locking. If <a href="#MUSTLOCK">SDL::Video::MUSTLOCK</a> evaluates to <code>0</code>, then reading and writing pixels to the surface can 
622 be performed at any time, and the pixel format of the surface will not change.
623 No operating system or library calls should be made between the lock/unlock pairs, as critical system locks may be held during this time.
624 <code>SDL::Video::lock_surface</code> returns <code>0</code> on success or <code>-1</code> on error.</p>
625 <p><strong>Note</strong>: Since SDL 1.1.8, the surface locks are recursive. This means that you can lock a surface multiple times, but each lock must have 
626 a matching unlock.</p>
627 <pre> use strict;
628  use warnings;
629  use Carp;
630
631  use SDL v2.3;
632  use SDL::Video;
633  use SDL::Event;
634  use SDL::Events;
635  use SDL::Surface;
636
637  my $screen;
638
639  sub putpixel
640  {
641      my($x, $y, $color) = @_;
642      my $lineoffset     = $y * ($screen-&gt;pitch / 4);
643      $screen-&gt;set_pixels( $lineoffset+ $x, $color);
644  }
645
646  sub render
647  {
648      if( SDL::Video::MUSTLOCK( $screen) )
649      {
650          return if (SDL::Video::lock_surface( $screen ) &lt; 0)
651      }
652
653      my $ticks                = SDL::get_ticks();
654      my ($i, $y, $yofs, $ofs) = (0,0,0,0);
655      for ($i = 0; $i &lt; 480; $i++)
656      {
657          for (my $j = 0, $ofs = $yofs; $j &lt; 640; $j++, $ofs++)
658          {
659              $screen-&gt;set_pixels( $ofs, (  $i * $i + $j * $j + $ticks ) );
660          }
661          $yofs += $screen-&gt;pitch / 4;
662      }
663
664      putpixel(10, 10, 0xff0000);
665      putpixel(11, 10, 0xff0000);
666      putpixel(10, 11, 0xff0000);
667      putpixel(11, 11, 0xff0000);
668
669      SDL::Video::unlock_surface($screen) if (SDL::Video::MUSTLOCK($screen));
670
671      SDL::Video::update_rect($screen, 0, 0, 640, 480);    
672
673      return 0;
674  }
675
676  sub main
677  {
678      carp 'Unable to init SDL: '.SDL::get_error() if( SDL::init(SDL_INIT_VIDEO) &lt; 0);
679
680      $screen = SDL::Video::set_video_mode( 640, 480, 32, SDL_SWSURFACE);
681
682      carp 'Unable to set 640x480x32 video' . SDL::get_error() if(!$screen);
683
684      while(1)
685      {
686          render();
687
688          my $event = SDL::Event-&gt;new();
689
690          while( SDL::Events::poll_event($event) )
691          {
692              my $type = $event-&gt;type;
693              return 0 if( $type == SDL_KEYDOWN || $type == SDL_QUIT);
694          }
695          SDL::Events::pump_events();
696      }
697  }
698
699  main();
700
701  SDL::quit;
702
703 </pre>
704
705 </div>
706 <h2 id="unlock_surface">unlock_surface</h2>
707 <div id="unlock_surface_CONTENT">
708 <pre> SDL::Video::unlock_surface( $surface );
709
710 </pre>
711 <p>Surfaces that were previously locked using <a href="#lock_sruface">SDL::Video::lock_surface</a> must be unlocked with <code>SDL::Video::unlock_surface</code>. 
712 Surfaces should be unlocked as soon as possible.
713 <code>SDL::Video::unlock_surface</code> doesn't return anything.</p>
714 <p><strong>Note</strong>: Since 1.1.8, the surface locks are recursive. See <a href="#lock_sruface">SDL::Video::lock_surface</a> for more information. </p>
715
716 </div>
717 <h2 id="MUSTLOCK">MUSTLOCK</h2>
718 <div id="MUSTLOCK_CONTENT">
719 <pre> int SDL::Video::MUSTLOCK( $surface );
720
721 </pre>
722 <p><code>MUSTLOCK</code> returns <code>0</code> if the surface does not have to be locked during pixel operations, otherwise <code>1</code>.</p>
723
724 </div>
725 <h1 id="Screen_Updating_Functions">Screen Updating Functions</h1><p><a href="#TOP" class="toplink">Top</a></p>
726 <div id="Screen_Updating_Functions_CONTENT">
727
728 </div>
729 <h2 id="set_clip_rect">set_clip_rect</h2>
730 <div id="set_clip_rect_CONTENT">
731 <pre> SDL::Video::set_clip_rect( $surface, $rect );
732
733 </pre>
734 <p>Sets the clipping rectangle for the given <a href="SDL-Surface.html">SDL::Surface</a>. When this surface is the destination of a blit, only the area within the clip 
735 rectangle will be drawn into.
736 The rectangle pointed to by rect will be clipped to the edges of the surface so that the clip rectangle for a surface can never fall 
737 outside the edges of the surface.
738 If rect is NULL the clipping rectangle will be set to the full size of the surface. 
739 <code>SDL::Video::set_clip_rect</code> doesn't returns anything.</p>
740
741 </div>
742 <h2 id="get_clip_rect">get_clip_rect</h2>
743 <div id="get_clip_rect_CONTENT">
744 <pre> SDL::Video::get_clip_rect( $surface, $rect );
745
746 </pre>
747 <p>Gets the clipping rectangle for the given <a href="SDL-Surface.html">SDL::Surface</a>. When this surface is the destination of a blit, only the area within the clip 
748 rectangle is drawn into.
749 The rectangle pointed to by rect will be filled with the clipping rectangle of the surface. 
750 <code>SDL::Video::get_clip_rect</code> doesn't returns anything;</p>
751 <pre> use SDL;
752  use SDL::Video;
753  use SDL::Rect;
754  use SDL::Surface;
755
756  my $screen_width  = 640;
757  my $screen_height = 480;
758
759  SDL::init(SDL_INIT_VIDEO);
760
761  my $screen  = SDL::Video::set_video_mode($screen_width, $screen_height, 32, SDL_SWSURFACE);
762
763  my $rect = SDL::Rect-&gt;new(0, 0, 0, 0);
764
765  SDL::Video::get_clip_rect($screen, $rect);
766
767  printf( &quot;rect is %d, %d, %d, %d\n&quot;, $rect-&gt;x, $rect-&gt;y, $rect-&gt;w, $rect-&gt;h);
768
769  SDL::quit;
770
771 </pre>
772
773 </div>
774 <h2 id="blit_surface">blit_surface</h2>
775 <div id="blit_surface_CONTENT">
776 <pre> SDL::Video::blit_surface( $src_surface, $src_rect, $dest_surface, $dest_rect );
777
778 </pre>
779 <p>This performs a fast blit from the given source <a href="SDL-Surface.html">SDL::Surface</a> to the given destination <a href="SDL-Surface.html">SDL::Surface</a>.
780 The width and height in <code>src_surface</code> determine the size of the copied rectangle. Only the position is used in the <code>dst_rect</code> 
781 (the width and height are ignored). Blits with negative <code>dst_rect</code> coordinates will be clipped properly.
782 If <code>src_rect</code> is NULL, the entire surface is copied. If <code>dst_rect</code> is NULL, then the destination position (upper left corner) is (0, 0).
783 The final blit rectangle is saved in <code>dst_rect</code> after all clipping is performed (<code>src_rect</code> is not modified).
784 The blit function should not be called on a locked surface. I.e. when you use your own drawing functions you may need to lock a surface, 
785 but this is not the case with <code>SDL::Video::blit_surface</code>. Like most surface manipulation functions in SDL, it should not be used together 
786 with OpenGL.</p>
787 <p>The results of blitting operations vary greatly depending on whether <code>SDL_SRCALPHA</code> is set or not. See <a href="#set_alpha">SDL::Video::set_alpha</a> 
788 for an explanation of how this affects your results. Colorkeying and alpha attributes also interact with surface blitting.
789 <code>SDL::Video::blit_surface</code> doesn't returns anything.</p>
790 <p>For an example see <a href="#load_BMP">SDL::Video::load_BMP</a>.</p>
791
792 </div>
793 <h2 id="update_rect">update_rect</h2>
794 <div id="update_rect_CONTENT">
795 <pre> update_rect( $surface, $left, $top, $width, $height );
796
797 </pre>
798 <p>Makes sure the given area is updated on the given screen.  
799 The rectangle must be confined within the screen boundaries because there's no clipping.
800 update_rect doesn't returns any value.</p>
801 <p><strong>Note</strong>: This function should not be called while screen is locked by <a href="#lock_surface">SDL::Video::lock_surface</a></p>
802 <p><strong>Note2</strong>: If <code>x</code>, <code>y</code>, <code>width</code> and <code>height</code> are all equal to 0, <code>update_rect</code> will update the entire screen. </p>
803 <p>For an example see <a href="#SYNOPSIS">SYNOPSIS</a></p>
804
805 </div>
806 <h2 id="update_rects">update_rects</h2>
807 <div id="update_rects_CONTENT">
808 <pre> update_rects( $surface, @rects );
809
810 </pre>
811 <p>Makes sure the given list of rectangles is updated on the given screen. 
812 The rectangle must be confined within the screen boundaries because there's no clipping.
813 <code>update_rects</code> doesn't returns any value.</p>
814 <p><strong>Note</strong>: This function should not be called while screen is locked by <a href="#lock_surface">SDL::Video::lock_surface</a>.</p>
815 <p>Example:</p>
816 <pre> use SDL;
817  use SDL::Video;
818  use SDL::Surface;
819  use SDL::Rect;
820
821  # the size of the window box or the screen resolution if fullscreen
822  my $screen_width   = 800;
823  my $screen_height  = 600;
824
825  SDL::init(SDL_INIT_VIDEO);
826
827  # setting video mode
828  my $screen_surface = SDL::Video::set_video_mode($screen_width, $screen_height, 32, SDL_SWSURFACE);
829
830  # drawing the whole screen blue
831  my $mapped_color   = SDL::Video::map_RGB($screen_surface-&gt;format(), 0, 0, 255); # blue
832  SDL::Video::fill_rect($screen_surface, 
833                        SDL::Rect-&gt;new(0, 0, $screen_width, $screen_height),
834                        $mapped_color);
835
836  my @rects = ();
837  push(@rects, SDL::Rect-&gt;new(200,   0, 400, 600));
838  push(@rects, SDL::Rect-&gt;new(  0, 150, 800, 300));
839
840  # updating parts of the screen (should look like a cross)
841  SDL::Video::update_rects($screen_surface, @rects);
842
843  sleep(2);
844
845  SDL::quit();
846
847 </pre>
848
849 </div>
850 <h2 id="flip">flip</h2>
851 <div id="flip_CONTENT">
852 <pre> $flip = SDL::Video::flip( $screen_surface );
853
854 </pre>
855 <p>On hardware that supports double-buffering, this function sets up a flip and returns. 
856 The hardware will wait for vertical retrace, and then swap video buffers before the next video surface blit or lock will return. 
857 On hardware that doesn't support double-buffering or if <code>SDL_SWSURFACE</code> was set, this is equivalent to calling 
858 <code>SDL::Video::update_rect( $screen, 0, 0, 0, 0 )</code>.</p>
859 <p>A software screen surface is also updated automatically when parts of a SDL window are redrawn, caused by overlapping windows or by 
860 restoring from an iconified state. As a result there is no proper double buffer behavior in windowed mode for a software screen, in 
861 contrast to a full screen software mode.</p>
862 <p>The <code>SDL_DOUBLEBUF</code> flag must have been passed to <a href="#set_video_mode">SDL::Video::set_video_mode</a>, when setting the video mode for this function 
863 to perform hardware flipping.</p>
864 <p><code>flip</code> returns <code>0</code> on success or <code>-1</code> on error.</p>
865 <p><strong>Note</strong>: If you want to swap the buffers of an initialized OpenGL context, use the function <a href="#GL_swap_buffers">SDL::Video::GL_swap_buffers</a> 
866 instead. </p>
867 <p>Example:</p>
868 <pre> use SDL;
869  use SDL::Video;
870  use SDL::Surface;
871
872  # the size of the window box or the screen resolution if fullscreen
873  my $screen_width   = 800;
874  my $screen_height  = 600;
875
876  SDL::init(SDL_INIT_VIDEO);
877
878  # setting video mode
879  my $screen_surface = SDL::Video::set_video_mode($screen_width, $screen_height, 32, SDL_DOUBLEBUF|SDL_FULLSCREEN);
880
881  # do some video operations here
882
883  # doing page flipping
884  unless( SDL::Video::flip($screen_surface) == 0 )
885  {
886      printf( STDERR &quot;failed to swap buffers: %s\n&quot;, SDL::get_error() );
887  }
888
889  SDL::quit();
890
891 </pre>
892
893 </div>
894 <h1 id="Palette_Color_and_Pixel_Functions">Palette, Color and Pixel Functions</h1><p><a href="#TOP" class="toplink">Top</a></p>
895 <div id="Palette_Color_and_Pixel_Functions_CO">
896
897 </div>
898 <h2 id="set_colors">set_colors</h2>
899 <div id="set_colors_CONTENT">
900 <pre> $set_colors = SDL::Video::set_colors( $surface, $start, $color1, $color2, ... )
901
902 </pre>
903 <p>Sets a portion of the colormap for the given 8-bit surface. </p>
904 <p>When surface is the surface associated with the current display, the display colormap will be updated with the requested colors. 
905 If <code>SDL_HWPALETTE</code> was set in <a href="#set_video_mode">SDL::Video::set_video_mode</a> flags, <code>SDL::Video::set_colors</code> will always return 1, and the 
906 palette is guaranteed to be set the way you desire, even if the window colormap has to be warped or run under emulation.
907 The color components of a <a href="SDL-Color.html">SDL::Color</a> structure are 8-bits in size, giving you a total of 2563 = 16777216 colors.
908 Palettized (8-bit) screen surfaces with the <code>SDL_HWPALETTE</code> flag have two palettes, a logical palette that is used for mapping blits to/from 
909 the surface and a physical palette (that determines how the hardware will map the colors to the display). 
910 <code>SDL::Video::set_colors</code> modifies both palettes (if present), and is equivalent to calling <a href="#set_palette">SDL::Video::set_palette</a> with the 
911 flags set to ( <code>SDL_LOGPAL | SDL_PHYSPAL</code> ). </p>
912 <p>If <code>surface</code> is not a palettized surface, this function does nothing, returning 0. 
913 If all of the colors were set as passed to <code>SDL::Video::set_colors</code>, it will return 1.
914 If not all the color entries were set exactly as given, it will return 0, and you should look at the surface palette to determine the 
915 actual color palette.</p>
916
917 </div>
918 <h2 id="set_palette">set_palette</h2>
919 <div id="set_palette_CONTENT">
920 <pre> $set_palette = set_palette( $surface, $flags, $start, $color1, $color2, ... );
921
922 </pre>
923 <p>Sets a portion of the palette for the given 8-bit surface.</p>
924 <p>Palettized (8-bit) screen surfaces with the <code>SDL_HWPALETTE</code> flag have two palettes, a logical palette that is used for mapping blits to/from 
925 the surface and a physical palette (that determines how the hardware will map the colors to the display). 
926 Non screen surfaces have a logical palette only. <a href="#blit">SDL::Video::blit</a> always uses the logical palette when blitting surfaces (if it has to 
927 convert between surface pixel formats). Because of this, it is often useful to modify only one or the other palette to achieve various 
928 special color effects (e.g., screen fading, color flashes, screen dimming).</p>
929 <p>This function can modify either the logical or physical palette by specifying <code>SDL_LOGPAL</code> or <code>SDL_PHYSPAL</code> the in the flags parameter.</p>
930 <p>When surface is the surface associated with the current display, the display colormap will be updated with the requested colors.
931 If <code>SDL_HWPALETTE</code> was set in <a href="#set_video_mode">SDL::Video::set_video_mode</a> flags, <code>SDL::Video::set_palette</code> will always return 1, and the 
932 palette is guaranteed to be set the way you desire, even if the window colormap has to be warped or run under emulation.
933 The color components of a <code>SDL::Color</code> structure are 8-bits in size, giving you a total of 2563 = 16777216 colors. </p>
934 <p>If <code>surface</code> is not a palettized surface, this function does nothing, returning <code>0</code>. If all of the colors were set as passed to <code>set_palette</code>,
935 it will return <code>1</code>. If not all the color entries were set exactly as given, it will return <code>0</code>, and you should look at the surface palette 
936 to determine the actual color palette.</p>
937
938 </div>
939 <h2 id="set_gamma">set_gamma</h2>
940 <div id="set_gamma_CONTENT">
941 <pre> $set_gamma = SDL::Video::set_gamma( $red_gamma, $green_gamma, $blue_gamma );
942
943 </pre>
944 <p>Sets the &quot;gamma function&quot; for the display of each color component. Gamma controls the brightness/contrast of colors displayed on the screen. 
945 A gamma value of 1.0 is identity (i.e., no adjustment is made).</p>
946 <p>This function adjusts the gamma based on the &quot;gamma function&quot; parameter, you can directly specify lookup tables for gamma adjustment 
947 with SDL::set_gamma_ramp.</p>
948 <p><strong>Note</strong>: Not all display hardware is able to change gamma.</p>
949 <p><code>SDL::Video::set_gamma</code> returns <code>-1</code> on error.</p>
950 <p><strong>Warning</strong>: Under Linux (X.org Gnome and Xfce), gamma settings affects the entire display (including the desktop)! </p>
951 <p>Example:</p>
952 <pre> use SDL;
953  use SDL::Video;
954  use SDL::Surface;
955  use SDL::Rect;
956  use Time::HiRes qw( usleep );
957
958  # the size of the window box or the screen resolution if fullscreen
959  my $screen_width   = 800;
960  my $screen_height  = 600;
961
962  SDL::init(SDL_INIT_VIDEO);
963
964  # setting video mode
965  my $screen_surface = SDL::Video::set_video_mode($screen_width, $screen_height, 32, SDL_SWSURFACE);
966
967  # drawing something somewhere
968  my $mapped_color   = SDL::Video::map_RGB($screen_surface-&gt;format(), 128, 128, 128); # gray
969  SDL::Video::fill_rect($screen_surface, 
970                        SDL::Rect-&gt;new($screen_width / 4, $screen_height / 4, $screen_width / 2, $screen_height / 2), 
971                        $mapped_color);
972
973  # update the whole screen
974  SDL::Video::update_rect($screen_surface, 0, 0, $screen_width, $screen_height);
975
976  usleep(500000);
977
978  for(1..20)
979  {
980     SDL::Video::set_gamma( 1 - $_ / 20, 1, 1 );
981         usleep(40000);
982  }
983
984  for(1..20)
985  {
986     SDL::Video::set_gamma( $_ / 20, 1, 1 );
987         usleep(40000);
988  }
989
990  SDL::Video::set_gamma( 1, 1, 1 );
991
992  usleep(500000);
993
994  SDL::quit();
995
996 </pre>
997
998 </div>
999 <h2 id="get_gamma_ramp">get_gamma_ramp</h2>
1000 <div id="get_gamma_ramp_CONTENT">
1001 <pre> $get_gamma_ramp = SDL::Video::get_gamma_ramp( \@red_table, \@green_table, \@blue_table );
1002
1003 </pre>
1004 <p>Gets the gamma translation lookup tables currently used by the display. Each table is an array of 256 Uint16 values.
1005 <code>SDL::Video::get_gamma_ramp</code> returns -1 on error.</p>
1006 <pre> use SDL;
1007  use SDL::Video;
1008
1009  SDL::init(SDL_INIT_VIDEO);
1010
1011  my (@red, @green, @blue);
1012
1013  my $ret = SDL::Video::get_gamma_ramp( \@red, \@green, \@blue );
1014
1015  if( -1 == $ret )
1016  {
1017      print( &quot;an error occoured&quot; );
1018  }
1019  else
1020  {
1021      printf( &quot;for gamma = 1.0: red=0x%04X, green=0x%04X, blue=0x%04X\n&quot;, $red[255], $green[255], $blue[255] );
1022      printf( &quot;for gamma = 0.5: red=0x%04X, green=0x%04X, blue=0x%04X\n&quot;, $red[127], $green[127], $blue[127] );
1023      printf( &quot;for gamma = 0.0: red=0x%04X, green=0x%04X, blue=0x%04X\n&quot;, $red[0],   $green[0],   $blue[0]   );
1024  }
1025
1026  SDL::quit();
1027
1028 </pre>
1029
1030 </div>
1031 <h2 id="set_gamma_ramp">set_gamma_ramp</h2>
1032 <div id="set_gamma_ramp_CONTENT">
1033 <pre> $set_gamma_ramp = SDL::Video::set_gamma_ramp( \@red_table, \@green_table, \@blue_table );
1034
1035 </pre>
1036 <p>Sets the gamma lookup tables for the display for each color component. Each table is an array ref of 256 Uint16 values, representing a 
1037 mapping between the input and output for that channel.
1038 The input is the index into the array, and the output is the 16-bit gamma value at that index, scaled to the output color precision. 
1039 You may pass NULL to any of the channels to leave them unchanged.</p>
1040 <p>This function adjusts the gamma based on lookup tables, you can also have the gamma calculated based on a &quot;gamma function&quot; parameter 
1041 with <a href="#set_gamma">SDL::Video::set_gamma</a>.</p>
1042 <p>Not all display hardware is able to change gamma. 
1043 <code>SDL::Video::set_gamma_ramp</code> returns <code>-1</code> on error (or if gamma adjustment is not supported).</p>
1044 <p>Example:</p>
1045 <pre> use SDL;
1046  use SDL::Video;
1047
1048  SDL::init(SDL_INIT_VIDEO);
1049
1050  my (@red, @green, @blue);
1051
1052  my $ret = SDL::Video::get_gamma_ramp( \@red, \@green, \@blue );
1053
1054  $red[127] = 0xFF00;
1055
1056     $ret = SDL::Video::set_gamma_ramp( \@red, \@green, \@blue );
1057
1058     $ret = SDL::Video::get_gamma_ramp( \@red, \@green, \@blue );
1059
1060  if( -1 == $ret )
1061  {
1062      print( &quot;an error occoured&quot; );
1063  }
1064  else
1065  {
1066      printf( &quot;for gamma = 1.0: red=0x%04X, green=0x%04X, blue=0x%04X\n&quot;, $red[255], $green[255], $blue[255] );
1067      printf( &quot;for gamma = 0.5: red=0x%04X, green=0x%04X, blue=0x%04X\n&quot;, $red[127], $green[127], $blue[127] );
1068      printf( &quot;for gamma = 0.0: red=0x%04X, green=0x%04X, blue=0x%04X\n&quot;, $red[0],   $green[0],   $blue[0]   );
1069  }
1070
1071  SDL::quit();
1072
1073 </pre>
1074
1075 </div>
1076 <h2 id="map_RGB">map_RGB</h2>
1077 <div id="map_RGB_CONTENT">
1078 <pre> $pixel = SDL::Video::map_RGB( $pixel_format, $r, $g, $b );
1079
1080 </pre>
1081 <p>Maps the RGB color value to the specified <a href="SDL-PixelFormat.html">SDL::PixelFormat</a> and returns the pixel value as a 32-bit int.
1082 If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
1083 If the specified pixel format has an alpha component it will be returned as all 1 bits (fully opaque). </p>
1084 <p><code>SDL::Video::map_RGB</code> returns a pixel value best approximating the given RGB color value for a given pixel format.
1085 If the <a href="SDL-PixelFormat.html">SDL::PixelFormat</a>'s  bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored 
1086 (e.g., with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).</p>
1087 <pre> use SDL;
1088  use SDL::Video;
1089  use SDL::PixelFormat;
1090  use SDL::Surface;
1091
1092  SDL::init(SDL_INIT_VIDEO);
1093
1094  my $screen_surface = SDL::Video::set_video_mode(640, 480, 16, SDL_SWSURFACE);
1095  #                                                          ^-- 16 bits per pixel
1096
1097  $r = 0x9C;
1098  $g = 0xDC;
1099  $b = 0x67;
1100
1101  printf( &quot;for 24bpp it is: 0x%02X 0x%02X 0x%02X\n&quot;, $r, $g, $b);
1102
1103  my $_16bit = SDL::Video::map_RGB( $screen_surface-&gt;format, $r, $g, $b );
1104
1105  # 16bpp is 5 bits red, 6 bits green and 5 bits blue
1106  # we will obtain the values for each color and calculating them back to 24/32bit color system
1107  ($r, $g, $b) = @{ SDL::Video::get_RGB( $screen_surface-&gt;format, $_16bit ) };
1108
1109  printf( &quot;for 16bpp it is: 0x%02X 0x%02X 0x%02X\n&quot;, $r, $g, $b );
1110
1111  # so color #9CDC67 becomes #9CDF63
1112
1113  SDL::quit();
1114
1115 </pre>
1116
1117 </div>
1118 <h2 id="map_RGBA">map_RGBA</h2>
1119 <div id="map_RGBA_CONTENT">
1120 <pre> $pixel = SDL::Video::map_RGB( $pixel_format, $r, $g, $b, $a );
1121
1122 </pre>
1123 <p>Maps the RGBA color value to the specified <a href="SDL-PixelFormat.html">SDL::PixelFormat</a> and returns the pixel value as a 32-bit int.
1124 If the format has a palette (8-bit) the index of the closest matching color in the palette will be returned.
1125 If the specified pixel format has no alpha component the alpha value will be ignored (as it will be in formats with a palette). </p>
1126 <p>A pixel value best approximating the given RGBA color value for a given pixel format.
1127 If the pixel format bpp (color depth) is less than 32-bpp then the unused upper bits of the return value can safely be ignored (e.g., 
1128 with a 16-bpp format the return value can be assigned to a Uint16, and similarly a Uint8 for an 8-bpp format).</p>
1129
1130 </div>
1131 <h2 id="get_RGB">get_RGB</h2>
1132 <div id="get_RGB_CONTENT">
1133 <pre> $rgb_array_ref = SDL::Video::get_RGB( $pixel_format, $pixel );
1134
1135 </pre>
1136 <p>Returns RGB values from a pixel in the specified pixel format. The pixel is an integer (e.g. 16bit RGB565, 24/32bit RGB888).
1137 This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB 
1138 component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).</p>
1139 <p>For an example see <a href="#map_RGB">SDL::Video::map_RGB</a>.</p>
1140
1141 </div>
1142 <h2 id="get_RGBA">get_RGBA</h2>
1143 <div id="get_RGBA_CONTENT">
1144 <pre> $rgba_array_ref = SDL::Video::get_RGBA( $pixel_format, $pixel );
1145
1146 </pre>
1147 <p>Gets RGBA values from a pixel in the specified pixel format. 
1148 This function uses the entire 8-bit [0..255] range when converting color components from pixel formats with less than 8-bits per RGB 
1149 component (e.g., a completely white pixel in 16-bit RGB565 format would return [0xff, 0xff, 0xff] not [0xf8, 0xfc, 0xf8]).</p>
1150 <p>If the surface has no alpha component, the alpha will be returned as 0xff (100% opaque). </p>
1151
1152 </div>
1153 <h1 id="GL_Methods">GL Methods</h1><p><a href="#TOP" class="toplink">Top</a></p>
1154 <div id="GL_Methods_CONTENT">
1155
1156 </div>
1157 <h2 id="GL_load_library">GL_load_library</h2>
1158 <div id="GL_load_library_CONTENT">
1159 <pre> $gl_load_lib = SDL::Video::GL_load_library( 'path/to/static/glfunctions.dll' );
1160
1161 </pre>
1162 <p>If you wish, you may load the OpenGL library from the given path at runtime, this must be done before 
1163 <a href="#set_video_mode">SDL::Video::set_video_mode</a> is called. You must then use <a href="#GL_get_proc_address">SDL::Video::GL_get_proc_address</a> to retrieve 
1164 function pointers to GL functions. </p>
1165 <p><code>GL_load_library</code> returns <code>0</code> on success or <code>-1</code> or error.</p>
1166
1167 </div>
1168 <h2 id="GL_get_proc_address">GL_get_proc_address</h2>
1169 <div id="GL_get_proc_address_CONTENT">
1170 <pre> $proc_address = SDL::Video::GL_get_proc_address( $proc );
1171
1172 </pre>
1173 <p>Returns the address of the GL function proc, or NULL if the function is not found. If the GL library is loaded at runtime, with 
1174 <a href="#GL_load_library">SDL::Video::GL_load_library</a>, then all GL functions must be retrieved this way. Usually this is used to retrieve function 
1175 pointers to OpenGL extensions. Note that this function needs an OpenGL context to function properly, so it should be called after 
1176 <a href="#set_video_mode">SDL::Video::set_video_mode</a> has been called (with the <code>SDL_OPENGL</code> flag).</p>
1177 <p>It returns undef if the function is not found.</p>
1178 <p>Example:</p>
1179 <pre> my $has_multitexture = 1;
1180
1181  # Get function pointer
1182  $gl_active_texture_ARB_ptr = SDL::Video::GL_get_proc_address(&quot;glActiveTextureARB&quot;);
1183
1184  # Check for a valid function ptr
1185  unless($gl_active_texture_ARB_ptr)
1186  {
1187      printf( STDERR &quot;Multitexture Extensions not present.\n&quot; );
1188      $has_multitexture = 0;
1189  }
1190
1191  $gl_active_texture_ARB_ptr(GL_TEXTURE0_ARB) if $has_multitexture;
1192
1193 </pre>
1194
1195 </div>
1196 <h2 id="GL_get_attribute">GL_get_attribute</h2>
1197 <div id="GL_get_attribute_CONTENT">
1198 <pre> $value = SDL::Video::GL_get_attribute( $attr );
1199
1200 </pre>
1201 <p>It returns SDL/OpenGL attribute <code>attr</code>. This is useful after a call to <a href="#set_video_mode">SDL::Video::set_video_mode</a> to check whether your 
1202 attributes have been set as you expected. 
1203 <code>SDL::Video::GL_get_attribute</code> returns <code>undef</code> if the attribute is not found.</p>
1204 <p>Example:</p>
1205 <pre> print( SDL::Video::GL_set_attribute(SDL_GL_RED_SIZE) );
1206
1207 </pre>
1208
1209 </div>
1210 <h2 id="GL_set_attribute">GL_set_attribute</h2>
1211 <div id="GL_set_attribute_CONTENT">
1212 <pre> $set_attr = SDL::Video::GL_set_attribute( $attr, $value );
1213
1214 </pre>
1215 <p>This function sets the given OpenGL attribute <code>attr</code> to <code>value</code>. The requested attributes will take effect after a call to 
1216 <a href="#set_video_mode">SDL::Video::set_video_mode</a>.
1217 You should use <code>SDL::Video::GL_get_attribute|/GL_get_attribute</code> to check the values after a <a href="#set_video_mode">SDL::Video::set_video_mode</a> call, 
1218 since the values obtained can differ from the requested ones.</p>
1219 <p>Available attributes:</p>
1220 <ul>
1221                 <li><code>SDL_GL_RED_SIZE</code>        </li>
1222                 <li><code>SDL_GL_GREEN_SIZE</code>      </li>
1223                 <li><code>SDL_GL_BLUE_SIZE</code>       </li>
1224                 <li><code>SDL_GL_ALPHA_SIZE</code>      </li>
1225                 <li><code>SDL_GL_BUFFER_SIZE</code>     </li>
1226                 <li><code>SDL_GL_DOUBLEBUFFER</code>    </li>
1227                 <li><code>SDL_GL_DEPTH_SIZE</code>      </li>
1228                 <li><code>SDL_GL_STENCIL_SIZE</code>    </li>
1229                 <li><code>SDL_GL_ACCUM_RED_SIZE</code>  </li>
1230                 <li><code>SDL_GL_ACCUM_GREEN_SIZE</code>        </li>
1231                 <li><code>SDL_GL_ACCUM_BLUE_SIZE</code> </li>
1232                 <li><code>SDL_GL_ACCUM_ALPHA_SIZE</code>        </li>
1233                 <li><code>SDL_GL_STEREO</code>  </li>
1234                 <li><code>SDL_GL_MULTISAMPLEBUFFERS</code>      </li>
1235                 <li><code>SDL_GL_MULTISAMPLESAMPLES</code>      </li>
1236                 <li><code>SDL_GL_ACCELERATED_VISUAL</code>      </li>
1237                 <li><code>SDL_GL_SWAP_CONTROL</code></li>
1238 </ul>
1239
1240 <p><code>GL_set_attribute</code> returns <code>0</code> on success or <code>-1</code> on error.</p>
1241 <p><strong>Note</strong>: The <code>SDL_DOUBLEBUF</code> flag is not required to enable double buffering when setting an OpenGL video mode. Double buffering is enabled 
1242 or disabled using the <code>SDL_GL_DOUBLEBUFFER</code> attribute. </p>
1243 <p>Example:</p>
1244 <pre> SDL::Video::GL_set_attribute(SDL_GL_RED_SIZE, 5);
1245
1246 </pre>
1247
1248 </div>
1249 <h2 id="GL_swap_buffers">GL_swap_buffers</h2>
1250 <div id="GL_swap_buffers_CONTENT">
1251 <pre> SDL::Video::GL_swap_buffers();
1252
1253 </pre>
1254 <p>Swap the OpenGL buffers, if double-buffering is supported.
1255 <code>SDL::Video::GL_swap_buffers</code> doesn't returns any value.</p>
1256
1257 </div>
1258 <h1 id="Video_Overlay_Functions">Video Overlay Functions</h1><p><a href="#TOP" class="toplink">Top</a></p>
1259 <div id="Video_Overlay_Functions_CONTENT">
1260 <p>see <a href="SDL-Overlay.html">SDL::Overlay</a> </p>
1261
1262 </div>
1263 <h2 id="lock_YUV_overlay">lock_YUV_overlay</h2>
1264 <div id="lock_YUV_overlay_CONTENT">
1265 <pre> $lock_overlay = SDL::Video::lock_YUV_overlay( $overlay );
1266
1267 </pre>
1268 <p>Much the same as <a href="#lock_surface">SDL::Video::lock_surface</a>, <code>lock_YUV_overlay</code> locks the overlay for direct access to pixel data.
1269 It returns <code>0</code> on success or <code>-1</code> on error.</p>
1270
1271 </div>
1272 <h2 id="unlock_YUV_overlay">unlock_YUV_overlay</h2>
1273 <div id="unlock_YUV_overlay_CONTENT">
1274 <pre> SDL::Video::unlock_YUV_overlay( $overlay );
1275
1276 </pre>
1277 <p>The opposite to <a href="#sock_YUV_overlay">SDL::Video::lock_YUV_overlay</a>. Unlocks a previously locked overlay. An overlay must be unlocked before it 
1278 can be displayed. <code>unlock_YUV_overlay</code> does not return anything.</p>
1279
1280 </div>
1281 <h2 id="display_YUV_overlay">display_YUV_overlay</h2>
1282 <div id="display_YUV_overlay_CONTENT">
1283 <pre> $display_overlay = SDL::Video::display_YUV_overlay( $overlay, $dstrect );
1284
1285 </pre>
1286 <p>Blit the overlay to the display surface specified when the overlay was created. The <a href="SDL-Rect.html">SDL::Rect</a> structure, <code>dstrect</code>, specifies a rectangle 
1287 on the display where the overlay is drawn. The <code>x</code> and <code>y</code> fields of <code>dstrect</code> specify the upper left location in display coordinates. 
1288 The overlay is scaled (independently in x and y dimensions) to the size specified by dstrect, and is <code>optimized</code> for 2x scaling</p>
1289 <p>It returns <code>0</code> on success or <code>-1</code> on error.</p>
1290
1291 </div>
1292 <h1 id="Window_Management_Functions">Window Management Functions</h1><p><a href="#TOP" class="toplink">Top</a></p>
1293 <div id="Window_Management_Functions_CONTENT">
1294
1295 </div>
1296 <h2 id="wm_set_caption">wm_set_caption</h2>
1297 <div id="wm_set_caption_CONTENT">
1298 <pre> SDL::Video::wm_set_caption( $title, $icon );
1299
1300 </pre>
1301 <p>Sets the title-bar and icon name of the display window.</p>
1302 <p><code>title</code> is a UTF-8 encoded null-terminated string which will serve as the window title (the text at the top of the window). The function 
1303 does not change the string. You may free the string after the function returns.</p>
1304 <p><code>icon</code> is a UTF-8 encoded null-terminated string which will serve as the iconified window title (the text which is displayed in the menu 
1305 bar or desktop when the window is minimized). As with title this string may be freed after the function returns. </p>
1306 <p>Example:</p>
1307 <pre> use SDL;
1308  use SDL::Video;
1309  use SDL::Surface;
1310
1311  SDL::init(SDL_INIT_VIDEO);
1312
1313  my $screen  = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
1314
1315  SDL::Video::wm_set_caption( 'maximized title', 'minimized title' );
1316
1317  sleep(2);
1318
1319  SDL::quit;
1320
1321 </pre>
1322
1323 </div>
1324 <h2 id="wm_get_caption">wm_get_caption</h2>
1325 <div id="wm_get_caption_CONTENT">
1326 <pre> SDL::Video::wm_get_caption( $title, $icon );
1327
1328 </pre>
1329 <p>Retrieves the title-bar and icon name of the display window.</p>
1330 <p>Example:</p>
1331 <pre> use SDL;
1332  use SDL::Video;
1333  use SDL::Surface;
1334
1335  SDL::init(SDL_INIT_VIDEO);
1336
1337  my $screen  = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
1338
1339  SDL::Video::wm_set_caption( 'maximized title', 'minimized title' );
1340
1341  my ($title, $icon) = @{ SDL::Video::wm_get_caption() };
1342
1343  printf( &quot;title is '%s' and icon is '%s'\n&quot;, $title, $icon );
1344
1345  SDL::quit;
1346
1347 </pre>
1348
1349 </div>
1350 <h2 id="wm_set_icon">wm_set_icon</h2>
1351 <div id="wm_set_icon_CONTENT">
1352 <pre> SDL::Video::wm_set_icon( $icon );
1353
1354 </pre>
1355 <p>Sets the icon for the display window. Win32 icons must be 32x32.</p>
1356 <p>This function must be called before the first call to <a href="#set_video_mode">SDL::Video::set_video_mode</a>. Note that this means <a href="SDL-Image.html">SDL::Image</a> 
1357 cannot be used.</p>
1358 <p>The shape is determined by the colorkey or alpha channel of the icon, if any. If neither of those are present, the icon is made opaque 
1359 (no transparency).</p>
1360 <p>Example:</p>
1361 <pre> SDL::Video::wm_set_icon(SDL::Video::load_BMP(&quot;icon.bmp&quot;));
1362
1363 </pre>
1364 <p>Another option, if your icon image does not have a colorkey set, is to use the SDL::Video::set_color_key to set the transparency.</p>
1365 <p>Example:</p>
1366 <pre> my $image = SDL::Video::load_BMP(&quot;icon.bmp&quot;);
1367
1368  my colorkey = SDL::Video::map_RGB($image-&gt;format, 255, 0, 255); # specify the color that will be transparent
1369
1370  SDL::Video::set_color_key($image, SDL_SRCCOLORKEY, $colorkey);              
1371
1372  SDL::Video::wm_set_icon($image);
1373
1374 </pre>
1375
1376 </div>
1377 <h2 id="wm_grab_input">wm_grab_input</h2>
1378 <div id="wm_grab_input_CONTENT">
1379 <pre> $grab_mode = SDL::Video::wm_grab_input($mode);
1380
1381 </pre>
1382 <p>Grabbing means that the mouse is confined to the application window, and nearly all keyboard input is passed directly to the application, 
1383 and not interpreted by a window manager, if any.</p>
1384 <p>When mode is <code>SDL_GRAB_QUERY</code> the grab mode is not changed, but the current grab mode is returned.</p>
1385 <p><code>mode</code> and the return value of <code>wm_grab_input</code> can be one of the following:</p>
1386 <ul>
1387                 <li><code>SDL_GRAB_QUERY</code> </li>
1388                 <li><code>SDL_GRAB_OFF</code>   </li>
1389                 <li><code>SDL_GRAB_ON</code></li>
1390 </ul>
1391
1392
1393 </div>
1394 <h2 id="wm_iconify_window">wm_iconify_window</h2>
1395 <div id="wm_iconify_window_CONTENT">
1396 <pre> $iconify_window = SDL::Video::wm_iconify_window();
1397
1398 </pre>
1399 <p>If the application is running in a window managed environment SDL attempts to iconify/minimise it. If <code>wm_iconify_window</code> is successful, 
1400 the application will receive a <code>SDL_APPACTIVE</code> loss event (see Application visibility events at <a href="SDL-Event.html">SDL::Event</a>).</p>
1401 <p>Returns non-zero on success or 0 if iconification is not supported or was refused by the window manager. </p>
1402 <p>Example:</p>
1403 <pre> use SDL;
1404  use SDL::Video;
1405  use SDL::Surface;
1406
1407  SDL::init(SDL_INIT_VIDEO);
1408
1409  my $screen  = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
1410
1411  sleep(2);
1412
1413  SDL::Video::wm_iconify_window();
1414
1415  sleep(2); 
1416
1417  SDL::quit;
1418
1419 </pre>
1420
1421 </div>
1422 <h2 id="wm_toggle_fullscreen">wm_toggle_fullscreen</h2>
1423 <div id="wm_toggle_fullscreen_CONTENT">
1424 <pre> $toggle = SDL::Video::wm_toggle_fullscreen( $surface );
1425
1426 </pre>
1427 <p>Toggles the application between windowed and fullscreen mode, if supported. (X11 is the only target currently supported, BeOS support 
1428 is experimental).</p>
1429
1430 </div>
1431 <h1 id="AUTHOR">AUTHOR</h1><p><a href="#TOP" class="toplink">Top</a></p>
1432 <div id="AUTHOR_CONTENT">
1433 <p>magnet, Tobias Leich (FROGGS)</p>
1434
1435 </div>
1436 <h1 id="SEE_ALSO">SEE ALSO</h1><p><a href="#TOP" class="toplink">Top</a></p>
1437 <div id="SEE_ALSO_CONTENT">
1438
1439 </div>
1440 <h2 id="Category_Objects">Category Objects</h2>
1441 <div id="Category_Objects_CONTENT">
1442 <p><a href="SDL-Surface.html">SDL::Surface</a>, <a href="SDL-Overlay.html">SDL::Overlay</a>, <a href="SDL-Color.html">SDL::Color</a>,
1443 <a href="SDL-Rect.html">SDL::Rect</a>, <a href="SDL-Palette.html">SDL::Palette</a>, <a href="SDL-PixelFormat.html">SDL::PixelFormat</a>, 
1444 <a href="SDL-VideoInfo.html">SDL::VideoInfo</a></p>
1445
1446 </div>
1447 </div>