Applied Magnet's Patch
[sdlgit/SDL_perl.git] / lib / docs / Overlay.pod
1 =pod 
2
3 =head1 NAME
4
5 SDL::Overlay - YUV Video overlay
6
7 =head1 SYNOPSIS
8
9 First import the following modules to get access to constants and functions needed for overlay.
10
11    use SDL;
12    use SDL::Video;
13    use SDL::Overlay;
14
15 Init the video susbsystem.
16
17    SDL::Init(SDL_INIT_VIDEO);
18
19 Create a display to use.  
20
21    my $display = SDL::SetVideoMore(640, 480, 32, SDL_SWSURFACE);
22
23 Create and attach the display to a new overlay
24    my $overlay = SDL::Overlay->new( 100, 100, SDL_YV12_OVERLAY, $display);
25    
26 =head1 DESCRIPTION
27
28 A C<SDL_Overlay> allows for video rendering on an C<SDL_Surface> which is a display.  
29
30 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.
31
32 =head1 METHODS
33
34 =head2 new ( $width, $height, $YUV_flag, $display) 
35
36 The constructor creates a SDL::Overlay of the specified width, height and format (see C<YUV_Flags> list below of available formats), for the provided display.
37
38 Note the 'display' argument needs to actually be the surface created by C<SDL::Video::SetVideoMode> otherwise this function will segfault. 
39     
40    my $overlay = SDL::Overlay->new( $width, $height, $YUV_flag, $display );
41
42 =head3 YUV_Flags
43
44 More information on YUV formats can be found at L<http://www.fourcc.org/indexyuv.htm> . 
45
46 =over 4
47
48 =item *
49 SDL_YV12_OVERLAY  0x32315659  /* Planar mode: Y + V + U */
50
51 =item *
52 SDL_IYUV_OVERLAY  0x56555949  /* Planar mode: Y + U + V */
53
54 =item *
55 SDL_YUY2_OVERLAY  0x32595559  /* Packed mode: Y0+U0+Y1+V0 */
56
57 =item *
58 SDL_UYVY_OVERLAY  0x59565955  /* Packed mode: U0+Y0+V0+Y1 */
59
60 =item *
61 SDL_YVYU_OVERLAY  0x55595659  /* Packed mode: Y0+V0+Y1+U0 */
62
63 =back
64