I'm trying to write a simple image slideshow using SDL. I can load images, move them around the screen, but I can't seem to scale the images. I'm trying to use the SDL::GFX::Rotozoom module but the surface I get back doesn't seem to have the "w" or "h" methods. Maybe I'm just missing something really simple. Any help would be greatly appreciated! Thanks!!
#!/usr/bin/perl use strict; use warnings; use SDL; use SDL::Video; use SDL::Rect; use SDL::Surface; use SDLx::Sprite; use SDL::GFX::Rotozoom; use SDLx::App; my $disp = SDLx::App->new( title => 'Ken Burns', width => 1024, height => 800, depth => 32, flags => SDL_ANYFORMAT, resizeable => 1, exit_on_quit => 1 ); #$disp->fullscreen(); my $x = 0; my $y = 0; # This photo is larger than the 1024x800 app size my $big_image = SDLx::Sprite->new( image => '/path/to/photo.jpg' ); my $lil_image = SDL::GFX::Rotozoom::surface( $big_image, 0, 0.7, SMOOT +HING_ON ); for $x ( 0 .. ($lil_image->w-$disp->w) ) { $lil_image->draw_xy( $disp, -$x,0 ); SDL::Video::update_rect( $disp, 0, 0, $disp->w, $disp->h ); # SDL::delay(2); } for $y ( 0 .. ($lil_image->h-$disp->h) ) { $lil_image->draw_xy( $disp, -($lil_image->w-$disp->w),-$y ); SDL::Video::update_rect( $disp, 0, 0, $disp->w, $disp->h ); # SDL::delay(2); } for $x ( 0 .. ($lil_image->w-$disp->w) ) { $lil_image->draw_xy( $disp, -($lil_image->w-$disp->w)+$x,-($lil_image->h-$disp->h) ); SDL::Video::update_rect( $disp, 0, 0, $disp->w, $disp->h ); # SDL::delay(2); } for $y ( 0 .. ($lil_image->h-$disp->h) ) { $lil_image->draw_xy( $disp, 0,-($lil_image->h-$disp->h)+$y ); SDL::Video::update_rect( $disp, 0, 0, $disp->w, $disp->h ); # SDL::delay(1); } #SDL::delay(200);

In reply to SDL Image Slideshow by Xenther

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.