Moved Video to SMPGEG. Maybe move this to SDL::Game::Video later
[sdlgit/SDL_perl.git] / lib / SDL / Overlay.pm
CommitLineData
fcd68a90 1package SDL::Overlay;
2use strict;
3use warnings;
4require Exporter;
5require DynaLoader;
6our @ISA = qw(Exporter DynaLoader);
7bootstrap SDL::Overlay;
8
91;
10
11__END__
12
b175f397 13=pod
14
15=head1 NAME
16
17SDL::Overlay - YUV Video overlay
18
19=head1 SYNOPSIS
20
21First 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
27Init the video susbsystem.
28
29 SDL::Init(SDL_INIT_VIDEO);
30
31Create a display to use.
32
33 my $display = SDL::SetVideoMore(640, 480, 32, SDL_SWSURFACE);
34
35Create 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
40A C<SDL_Overlay> allows for video rendering on an C<SDL_Surface> which is a display.
41
42The 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
48The 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
50Note 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
56More information on YUV formats can be found at L<http://www.fourcc.org/indexyuv.htm> .
57
58=over 4
59
60=item *
61SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U */
62
63=item *
64SDL_IYUV_OVERLAY 0x56555949 /* Planar mode: Y + U + V */
65
66=item *
67SDL_YUY2_OVERLAY 0x32595559 /* Packed mode: Y0+U0+Y1+V0 */
68
69=item *
70SDL_UYVY_OVERLAY 0x59565955 /* Packed mode: U0+Y0+V0+Y1 */
71
72=item *
73SDL_YVYU_OVERLAY 0x55595659 /* Packed mode: Y0+V0+Y1+U0 */
74
75=back
76