Xenther has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to put together a simple "Ken Burns" style slideshow using SDL, however when I try and move the image inside of the app the portion of the image that was cropped because the app window is smaller than the image doesn't get drawn and the portion of the app window I'm moving away from doesn't update -- these leads to a neat streaking effect that I'd like to get rid of. Here's the proof of concept I've been playing around with:
#!/usr/bin/perl use SDL; use SDL::Event; use SDL::App; use SDL::Rect; use SDL::Surface; use warnings; use strict; my $app = new SDL::App ( -title => 'Ken Burns Slideshow', -width => 640, -height => 480, -depth => 32, ); my $frame = SDL::Surface->new( -name => '/path/to/testimage.jpg' ); my $frame_rect = SDL::Rect->new( -height => $frame->height(), -width => $frame->width(), -x => 0, -y => 0, ); my $dest_rect = SDL::Rect->new( -height => $frame->height(), -width => $frame->width(), -x => 0, -y => 0, ); $frame->blit( $frame_rect, $app, $dest_rect ); $app->update( $dest_rect ); for my $x ( 1 .. 200 ) { $dest_rect->x( $x ); $dest_rect->y( $x ); $frame->blit( $frame_rect, $app, $dest_rect ); $app->update( $dest_rect ); $app->sync; $app->delay( 10 ); }
What am I missing? Thanks!!

Replies are listed 'Best First'.
Re: "Ken Burns" effect using SDL
by zentara (Cardinal) on Jun 10, 2012 at 13:27 UTC
    Hi, SDL has gone thru quite a bit of changes lately, with the current version being 2.541. Your program seems to use an older version, as SDL::App is from version SDL_Perl-v2.2.6 from 2009. Maybe someone knows the proper code usage for you, but you might want to upgrade to the latest 2012 version, and rewrite. I'm not inclined to install an older SDL version just to test your code.