view release on metacpan or search on metacpan
t/config.t
t/core.t
t/core_audio.t
t/core_audiospec.t
t/core_cd.t
t/core_error.t
t/core_events.t
t/core_joystick.t
t/core_mouse.t
t/core_multi.t
t/core_overlay.t
t/core_palette.t
t/core_rect.t
t/core_rwops.t
t/core_surface.t
t/core_timer.t
t/core_version.t
t/core_video.t
t/core_video_convert_surface.t
t/core_video_gamma.t
t/extendingrect.t
lib/SDL/Color.pm view on Meta::CPAN
bootstrap SDL::Color;
use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Video'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
color => $SDL::Constants::EXPORT_TAGS{'SDL::Video/color'},
surface => $SDL::Constants::EXPORT_TAGS{'SDL::Video/surface'},
video => $SDL::Constants::EXPORT_TAGS{'SDL::Video/video'},
overlay => $SDL::Constants::EXPORT_TAGS{'SDL::Video/overlay'},
grab => $SDL::Constants::EXPORT_TAGS{'SDL::Video/grab'},
palette => $SDL::Constants::EXPORT_TAGS{'SDL::Video/palette'},
gl => $SDL::Constants::EXPORT_TAGS{'SDL::Video/gl'}
);
1;
lib/SDL/Constants.pm view on Meta::CPAN
SDL_RESIZABLE
SDL_NOFRAME
SDL_HWACCEL
SDL_SRCCOLORKEY
SDL_RLEACCELOK
SDL_RLEACCEL
SDL_SRCALPHA
SDL_PREALLOC
)
],
'SDL::Video/overlay' => [
qw(
SDL_YV12_OVERLAY
SDL_IYUV_OVERLAY
SDL_YUY2_OVERLAY
SDL_UYVY_OVERLAY
SDL_YVYU_OVERLAY
)
],
'SDL::Video/palette' => [
qw(
lib/SDL/Overlay.pm view on Meta::CPAN
bootstrap SDL::Overlay;
use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Video'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
color => $SDL::Constants::EXPORT_TAGS{'SDL::Video/color'},
surface => $SDL::Constants::EXPORT_TAGS{'SDL::Video/surface'},
video => $SDL::Constants::EXPORT_TAGS{'SDL::Video/video'},
overlay => $SDL::Constants::EXPORT_TAGS{'SDL::Video/overlay'},
grab => $SDL::Constants::EXPORT_TAGS{'SDL::Video/grab'},
palette => $SDL::Constants::EXPORT_TAGS{'SDL::Video/palette'},
gl => $SDL::Constants::EXPORT_TAGS{'SDL::Video/gl'}
);
1;
lib/SDL/Palette.pm view on Meta::CPAN
bootstrap SDL::Palette;
use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Video'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
color => $SDL::Constants::EXPORT_TAGS{'SDL::Video/color'},
surface => $SDL::Constants::EXPORT_TAGS{'SDL::Video/surface'},
video => $SDL::Constants::EXPORT_TAGS{'SDL::Video/video'},
overlay => $SDL::Constants::EXPORT_TAGS{'SDL::Video/overlay'},
grab => $SDL::Constants::EXPORT_TAGS{'SDL::Video/grab'},
palette => $SDL::Constants::EXPORT_TAGS{'SDL::Video/palette'},
gl => $SDL::Constants::EXPORT_TAGS{'SDL::Video/gl'}
);
1;
lib/SDL/PixelFormat.pm view on Meta::CPAN
bootstrap SDL::PixelFormat;
use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Video'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
color => $SDL::Constants::EXPORT_TAGS{'SDL::Video/color'},
surface => $SDL::Constants::EXPORT_TAGS{'SDL::Video/surface'},
video => $SDL::Constants::EXPORT_TAGS{'SDL::Video/video'},
overlay => $SDL::Constants::EXPORT_TAGS{'SDL::Video/overlay'},
grab => $SDL::Constants::EXPORT_TAGS{'SDL::Video/grab'},
palette => $SDL::Constants::EXPORT_TAGS{'SDL::Video/palette'},
gl => $SDL::Constants::EXPORT_TAGS{'SDL::Video/gl'}
);
1;
lib/SDL/Rect.pm view on Meta::CPAN
bootstrap SDL::Rect;
use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Video'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
color => $SDL::Constants::EXPORT_TAGS{'SDL::Video/color'},
surface => $SDL::Constants::EXPORT_TAGS{'SDL::Video/surface'},
video => $SDL::Constants::EXPORT_TAGS{'SDL::Video/video'},
overlay => $SDL::Constants::EXPORT_TAGS{'SDL::Video/overlay'},
grab => $SDL::Constants::EXPORT_TAGS{'SDL::Video/grab'},
palette => $SDL::Constants::EXPORT_TAGS{'SDL::Video/palette'},
gl => $SDL::Constants::EXPORT_TAGS{'SDL::Video/gl'}
);
1;
lib/SDL/Surface.pm view on Meta::CPAN
bootstrap SDL::Surface;
use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Video'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
color => $SDL::Constants::EXPORT_TAGS{'SDL::Video/color'},
surface => $SDL::Constants::EXPORT_TAGS{'SDL::Video/surface'},
video => $SDL::Constants::EXPORT_TAGS{'SDL::Video/video'},
overlay => $SDL::Constants::EXPORT_TAGS{'SDL::Video/overlay'},
grab => $SDL::Constants::EXPORT_TAGS{'SDL::Video/grab'},
palette => $SDL::Constants::EXPORT_TAGS{'SDL::Video/palette'},
gl => $SDL::Constants::EXPORT_TAGS{'SDL::Video/gl'}
);
1;
lib/SDL/Video.pm view on Meta::CPAN
bootstrap SDL::Video;
use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Video'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
color => $SDL::Constants::EXPORT_TAGS{'SDL::Video/color'},
surface => $SDL::Constants::EXPORT_TAGS{'SDL::Video/surface'},
video => $SDL::Constants::EXPORT_TAGS{'SDL::Video/video'},
overlay => $SDL::Constants::EXPORT_TAGS{'SDL::Video/overlay'},
grab => $SDL::Constants::EXPORT_TAGS{'SDL::Video/grab'},
palette => $SDL::Constants::EXPORT_TAGS{'SDL::Video/palette'},
gl => $SDL::Constants::EXPORT_TAGS{'SDL::Video/gl'}
);
1;
lib/SDL/VideoInfo.pm view on Meta::CPAN
bootstrap SDL::VideoInfo;
use base 'Exporter';
our @EXPORT = @{ $SDL::Constants::EXPORT_TAGS{'SDL::Video'} };
our %EXPORT_TAGS = (
all => \@EXPORT,
color => $SDL::Constants::EXPORT_TAGS{'SDL::Video/color'},
surface => $SDL::Constants::EXPORT_TAGS{'SDL::Video/surface'},
video => $SDL::Constants::EXPORT_TAGS{'SDL::Video/video'},
overlay => $SDL::Constants::EXPORT_TAGS{'SDL::Video/overlay'},
grab => $SDL::Constants::EXPORT_TAGS{'SDL::Video/grab'},
palette => $SDL::Constants::EXPORT_TAGS{'SDL::Video/palette'},
gl => $SDL::Constants::EXPORT_TAGS{'SDL::Video/gl'}
);
1;
lib/pods/SDL/Overlay.pod view on Meta::CPAN
=pod
=head1 NAME
SDL::Overlay - YUV Video overlay
=head2 CATEGORY
Core, Video, Structure
=head1 SYNOPSIS
First import the following modules to get access to constants and functions needed for overlay.
use SDL;
use SDL::Video;
use SDL::Overlay;
Init the video subsystem.
SDL::Init(SDL_INIT_VIDEO);
Create a display to use.
my $display = SDL::Video::set_video_mode(640, 480, 32, SDL_SWSURFACE);
Create and attach the display to a new overlay
my $overlay = SDL::Overlay->new( 100, 100, SDL_YV12_OVERLAY, $display);
=head1 DESCRIPTION
A C<SDL_Overlay> allows for video rendering on an C<SDL_Surface> which is a display.
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.
=head1 METHODS
=head2 new ( $width, $height, $YUV_flag, $display)
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.
Note the 'display' argument needs to actually be the surface created by C<SDL::Video::SetVideoMode> otherwise this function will segfault.
my $overlay = SDL::Overlay->new( $width, $height, $YUV_flag, $display );
=head3 YUV_Flags
More information on YUV formats can be found at L<http://www.fourcc.org/indexyuv.htm> .
=over 4
=item *
SDL_YV12_OVERLAY 0x32315659 /* Planar mode: Y + V + U */
lib/pods/SDL/Overlay.pod view on Meta::CPAN
=back
=head2 format
Overlay format (see YUV_Flags)
=head2 w, h
Width and height of overlay
=head2 planes
Number of planes in the overlay. Usually either 1 or 3
=head2 pitches
An array of pitches, one for each plane. Pitch is the length of a row in bytes.
=head2 pixels
As of release 2.3 direct right to overlay is disable.
An array of pointers to the data of each plane. The overlay should be locked before these pointers are used.
see L<SDL::Video::lock_YUV_overlay>, L<SDL::Video::unload_YUV_overlay>
=head2 hw_overlay
This will be set to 1 if the overlay is hardware accelerated.
=head1 AUTHORS
See L<SDL/AUTHORS>.
=cut
lib/pods/SDL/Video.pod view on Meta::CPAN
NOTE: This option is kept for compatibility only, and is not recommended for new code.
SDL_RESIZABLE Resizable surface
SDL_NOFRAME No window caption or edge frame
SDL_HWACCEL Use hardware acceleration blit
SDL_SRCCOLORKEY Use colorkey blitting
SDL_RLEACCELOK Private flag
SDL_RLEACCEL Accelerated colorkey blitting with RLE
SDL_SRCALPHA Use alpha blending blit
SDL_PREALLOC Use preallocated memory
Export tag ':overlay'
SDL_YV12_OVERLAY Planar mode: Y + V + U (3 planes)
SDL_IYUV_OVERLAY Planar mode: Y + U + V (3 planes)
SDL_YUY2_OVERLAY Packed mode: Y0+U0+Y1+V0 (1 plane)
SDL_UYVY_OVERLAY Packed mode: U0+Y0+V0+Y1 (1 plane)
SDL_YVYU_OVERLAY Packed mode: Y0+V0+Y1+U0 (1 plane)
Export tag ':palette'
SDL_LOGPAL Logical palette, which controls how blits are mapped to/from the surface
lib/pods/SDL/Video.pod view on Meta::CPAN
=item RGB->RGB without C<SDL_SRCALPHA>
The RGB data is copied from the source.
If SDL_SRCCOLORKEY is set, only the pixels not matching the colorkey value are copied.
=back
B<Note>: When blitting, the presence or absence of C<SDL_SRCALPHA> is relevant only on the source surface, not the destination.
B<Note>: Note that RGBA->RGBA blits (with C<SDL_SRCALPHA> set) keep the alpha of the destination surface. This means that you cannot compose
two arbitrary RGBA surfaces this way and get the result you would expect from "overlaying" them; the destination alpha will work as a mask.
B<Note>: Also note that per-pixel and per-surface alpha cannot be combined; the per-pixel alpha is always used if available.
C<SDL::Video::set_alpha> returns C<0> on success or C<-1> on error.
=head2 fill_rect
$fill_rect = SDL::Video::fill_rect( $dest, $dest_rect, $pixel );
This function performs a fast fill of the given L<SDL::Rect> with the given L<SDL::PixelFormat>. If dest_rect is NULL, the whole surface
lib/pods/SDL/Video.pod view on Meta::CPAN
SDL::Video::GL_swap_buffers();
Swap the OpenGL buffers, if double-buffering is supported.
C<SDL::Video::GL_swap_buffers> doesn't returns any value.
=head1 Video Overlay Functions
see L<SDL::Overlay>
=head2 lock_YUV_overlay
$lock_overlay = SDL::Video::lock_YUV_overlay( $overlay );
Much the same as L<SDL::Video::lock_surface|/lock_surface>, C<lock_YUV_overlay> locks the overlay for direct access to pixel data.
It returns C<0> on success or C<-1> on error.
=head2 unlock_YUV_overlay
SDL::Video::unlock_YUV_overlay( $overlay );
The opposite to L<SDL::Video::lock_YUV_overlay|/sock_YUV_overlay>. Unlocks a previously locked overlay. An overlay must be unlocked before it
can be displayed. C<unlock_YUV_overlay> does not return anything.
=head2 display_YUV_overlay
$display_overlay = SDL::Video::display_YUV_overlay( $overlay, $dstrect );
Blit the overlay to the display surface specified when the overlay was created. The L<SDL::Rect> structure, C<dstrect>, specifies a rectangle
on the display where the overlay is drawn. The C<x> and C<y> fields of C<dstrect> specify the upper left location in display coordinates.
The overlay is scaled (independently in x and y dimensions) to the size specified by dstrect, and is C<optimized> for 2x scaling
It returns C<0> on success or C<-1> on error.
=head1 Window Management Functions
=head2 wm_set_caption
SDL::Video::wm_set_caption( $title, $icon );
Sets the title-bar and icon name of the display window.
src/Core/Video.xs view on Meta::CPAN
void
get_clip_rect ( surface, rect )
SDL_Surface *surface
SDL_Rect *rect;
CODE:
SDL_GetClipRect(surface, rect);
int
video_lock_YUV_overlay ( overlay )
SDL_Overlay *overlay
CODE:
RETVAL = SDL_LockYUVOverlay(overlay);
OUTPUT:
RETVAL
void
video_unlock_YUV_overlay ( overlay )
SDL_Overlay *overlay
CODE:
SDL_UnlockYUVOverlay(overlay);
int
video_display_YUV_overlay ( overlay, dstrect )
SDL_Overlay *overlay
SDL_Rect *dstrect
CODE:
RETVAL = SDL_DisplayYUVOverlay ( overlay, dstrect );
OUTPUT:
RETVAL
int
video_GL_load_library ( path )
char *path
CODE:
RETVAL = SDL_GL_LoadLibrary(path);
OUTPUT:
src/Core/objects/Overlay.xs view on Meta::CPAN
#include "perl.h"
#include "XSUB.h"
#include "ppport.h"
#ifndef aTHX_
#define aTHX_
#endif
#include <SDL.h>
MODULE = SDL::Overlay PACKAGE = SDL::Overlay PREFIX = overlay_
=for documentation
SDL_Overlay -- YUV video overlay
typedef struct{
Uint32 format;
int w, h;
int planes;
Uint16 *pitches;
Uint8 **pixels;
Uint32 hw_overlay:1;
} SDL_Overlay;
=cut
SDL_Overlay *
overlay_new(CLASS, width, height, format, display)
char* CLASS
int width
int height
Uint32 format
SDL_Surface *display;
CODE:
RETVAL = SDL_CreateYUVOverlay(width, height, format, display);
OUTPUT:
RETVAL
int
overlay_w( overlay )
SDL_Overlay* overlay
CODE:
RETVAL = overlay->w;
OUTPUT:
RETVAL
int
overlay_h( overlay )
SDL_Overlay* overlay
CODE:
RETVAL = overlay->h;
OUTPUT:
RETVAL
int
overlay_planes( overlay )
SDL_Overlay* overlay
CODE:
RETVAL = overlay->planes;
OUTPUT:
RETVAL
Uint32
overlay_hwoverlay( overlay )
SDL_Overlay* overlay
CODE:
RETVAL = overlay->hw_overlay;
OUTPUT:
RETVAL
Uint32
overlay_format( overlay )
SDL_Overlay* overlay
CODE:
RETVAL = overlay->format;
OUTPUT:
RETVAL
void
overlay_DESTROY(overlay)
SDL_Overlay *overlay
CODE:
SDL_FreeYUVOverlay(overlay);
t/core_overlay.t view on Meta::CPAN
if ( !SDL::TestTool->init(SDL_INIT_VIDEO) ) {
plan( skip_all => 'Failed to init video' );
} else {
plan( tests => 2 );
}
use_ok('SDL::Overlay');
my $display = SDL::Video::set_video_mode( 640, 480, 32, SDL_ANYFORMAT );
my $overlay = SDL::Overlay->new( 100, 100, SDL_YV12_OVERLAY, $display );
isa_ok( $overlay, 'SDL::Overlay' );
if ($videodriver) {
$ENV{SDL_VIDEODRIVER} = $videodriver;
} else {
delete $ENV{SDL_VIDEODRIVER};
}
sleep(2);
t/core_video.t view on Meta::CPAN
set_color_key
set_alpha
get_RGB
get_RGBA
load_BMP
save_BMP
fill_rect
blit_surface
set_clip_rect
get_clip_rect
lock_YUV_overlay
unlock_YUV_overlay
display_YUV_overlay
GL_load_library
GL_get_proc_address
GL_get_attribute
GL_set_attribute
GL_swap_buffers
get_gamma_ramp
wm_set_caption
wm_get_caption
wm_set_icon
wm_toggle_fullscreen
t/core_video.t view on Meta::CPAN
'[set_palette] returns 0 trying to write to 32 bit surface'
);
}
SDL::delay(100);
my @b_w_colors;
for ( my $i = 0; $i < 256; $i++ ) {
$b_w_colors[$i] = SDL::Color->new( $i, $i, $i );
}
my $overlay = SDL::Overlay->new( 200, 220, SDL_IYUV_OVERLAY, $display );
is( SDL::Video::lock_YUV_overlay($overlay),
0, '[lock_YUV_overlay] returns a 0 on success'
);
SDL::Video::unlock_YUV_overlay($overlay);
pass '[unlock_YUV_overlay] ran';
my $display_at_rect = SDL::Rect->new( 0, 0, 100, 100 );
is( SDL::Video::display_YUV_overlay( $overlay, $display_at_rect ),
0, '[display_YUV_overlay] returns 0 on success'
);
my $bmp_surface;
my $hwdisplay;
SKIP:
{
skip( "No hardware surface available", 26 )
unless $video_info->hw_available();