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