Merge branch 'master' of git.shadowcat.co.uk:SDL-Site
[sdlgit/SDL-Site.git] / pages / SDL-Overlay.html-inc
CommitLineData
162a0989 1<div class="pod">
2<!-- INDEX START -->
3<h3 id="TOP">Index</h3>
4
60f74f6f 5<ul><li><a href="#NAME">NAME</a>
6<ul><li><a href="#CATEGORY">CATEGORY</a></li>
7</ul>
8</li>
162a0989 9<li><a href="#SYNOPSIS">SYNOPSIS</a></li>
10<li><a href="#DESCRIPTION">DESCRIPTION</a></li>
11<li><a href="#METHODS">METHODS</a>
12<ul><li><a href="#new_width_height_YUV_flag_display">new ( $width, $height, $YUV_flag, $display) </a>
b968d0e8 13<ul><li><a href="#YUV_Flags">YUV_Flags</a></li>
162a0989 14</ul>
15</li>
b968d0e8 16<li><a href="#format">format</a></li>
17<li><a href="#w_h">w, h</a></li>
18<li><a href="#planes">planes</a></li>
19<li><a href="#pitches">pitches</a></li>
20<li><a href="#pixels">pixels</a></li>
c7e8d3c6 21<li><a href="#hw_overlay">hw_overlay</a></li>
162a0989 22</ul>
23</li>
c7e8d3c6 24<li><a href="#AUTHORS">AUTHORS</a>
25</li>
162a0989 26</ul><hr />
27<!-- INDEX END -->
28
29<h1 id="NAME">NAME</h1><p><a href="#TOP" class="toplink">Top</a></p>
30<div id="NAME_CONTENT">
31<p>SDL::Overlay - YUV Video overlay</p>
32
33</div>
60f74f6f 34<h2 id="CATEGORY">CATEGORY</h2>
35<div id="CATEGORY_CONTENT">
36<p>Core, Video, Structure</p>
37
38</div>
162a0989 39<h1 id="SYNOPSIS">SYNOPSIS</h1><p><a href="#TOP" class="toplink">Top</a></p>
40<div id="SYNOPSIS_CONTENT">
41<p>First import the following modules to get access to constants and functions needed for overlay.</p>
42<pre> use SDL;
43 use SDL::Video;
44 use SDL::Overlay;
45
46</pre>
47<p>Init the video susbsystem.</p>
48<pre> SDL::Init(SDL_INIT_VIDEO);
49
50</pre>
51<p>Create a display to use. </p>
b968d0e8 52<pre> my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
53
54</pre>
55<p>Create and attach the display to a new overlay</p>
56<pre> my $overlay = SDL::Overlay-&gt;new( 100, 100, SDL_YV12_OVERLAY, $display);
162a0989 57
58</pre>
162a0989 59
60</div>
61<h1 id="DESCRIPTION">DESCRIPTION</h1><p><a href="#TOP" class="toplink">Top</a></p>
62<div id="DESCRIPTION_CONTENT">
63<p>A <code>SDL_Overlay</code> allows for video rendering on an <code>SDL_Surface</code> which is a display. </p>
64<p>The term 'overlay' is a misnomer since, unless the overlay is created in hardware, the contents for the display surface underneath the area where the overlay is shown will be overwritten when the overlay is displayed.</p>
65
66</div>
67<h1 id="METHODS">METHODS</h1><p><a href="#TOP" class="toplink">Top</a></p>
68<div id="METHODS_CONTENT">
69
70</div>
71<h2 id="new_width_height_YUV_flag_display">new ( $width, $height, $YUV_flag, $display) </h2>
72<div id="new_width_height_YUV_flag_display_CO">
73<p>The constructor creates a SDL::Overlay of the specified width, height and format (see <code>YUV_Flags</code> list below of available formats), for the provided display.</p>
74<p>Note the 'display' argument needs to actually be the surface created by <code>SDL::Video::SetVideoMode</code> otherwise this function will segfault. </p>
75<pre> my $overlay = SDL::Overlay-&gt;new( $width, $height, $YUV_flag, $display );
76
77</pre>
78
79</div>
80<h3 id="YUV_Flags">YUV_Flags</h3>
81<div id="YUV_Flags_CONTENT">
82<p>More information on YUV formats can be found at <a href="http://www.fourcc.org/indexyuv.htm">http://www.fourcc.org/indexyuv.htm</a> . </p>
83<dl>
84 <dt>*
85SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U */</dt>
86 <dt>*
87SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V */</dt>
88 <dt>*
89SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 */</dt>
90 <dt>*
91SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 */</dt>
92 <dt>*
93SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 */</dt>
878ae663 94</dl>
b968d0e8 95
96
97
98
99
100</div>
101<h2 id="format">format</h2>
102<div id="format_CONTENT">
878ae663 103<p>Overlay format (see YUV_Flags)</p>
b968d0e8 104
105</div>
106<h2 id="w_h">w, h</h2>
107<div id="w_h_CONTENT">
878ae663 108<p>Width and height of overlay</p>
b968d0e8 109
110</div>
111<h2 id="planes">planes</h2>
112<div id="planes_CONTENT">
878ae663 113<p>Number of planes in the overlay. Usually either 1 or 3</p>
b968d0e8 114
115</div>
116<h2 id="pitches">pitches</h2>
117<div id="pitches_CONTENT">
878ae663 118<p>An array of pitches, one for each plane. Pitch is the length of a row in bytes.</p>
b968d0e8 119
120</div>
121<h2 id="pixels">pixels</h2>
122<div id="pixels_CONTENT">
878ae663 123<p>As of release 2.3 direct right to overlay is disable. </p>
124<p>An array of pointers to the data of each plane. The overlay should be locked before these pointers are used.</p>
0b221bb4 125<p>see <a href="SDL-Video::lock_YUV_overlay.html">SDL::Video::lock_YUV_overlay</a>, <a href="SDL-Video::unload_YUV_overlay.html">SDL::Video::unload_YUV_overlay</a></p>
b968d0e8 126
127</div>
128<h2 id="hw_overlay">hw_overlay</h2>
129<div id="hw_overlay_CONTENT">
878ae663 130<p>This will be set to 1 if the overlay is hardware accelerated.</p>
131
c7e8d3c6 132</div>
133<h1 id="AUTHORS">AUTHORS</h1><p><a href="#TOP" class="toplink">Top</a></p>
134<div id="AUTHORS_CONTENT">
1dbe1697 135<p>See <a href="/SDL.html#AUTHORS">/SDL.html#AUTHORS</a>.</p>
162a0989 136
137</div>
138</div>