On 12 Sep 2006 11:43:25 +0200, Guillaume Cottenceau <[EMAIL PROTECTED]> wrote:
"Karl Dane" <karl 'at' rince.net> writes: > Hi all, > > I'm trying to write a simple alpha cross-fade app: basically a slideshow > that fades one image in and the other out. However, can not get alpha fades > to work. > > I'm very new to SDL, so please don't laugh at my code! But I'd be very > grateful if anyone could point out where I'm going wrong. The code snippet > below results in the image being displayed without any change. > > Many thanks, > > Karl Dane > > > #!/usr/bin/perl > > use warnings; > use SDL::App; > > our $app = SDL::App->new( > -width => 640, > -height => 480, > -depth => 24, > -fullscreen => 0, > ); > > for ($i=260; $i >=0; $i-=1) { > print "$i\n"; > > my $img1 = SDL::Surface->new( -name => "./img1.png" ); > > $img1->display_format(); > > $img1->set_alpha(SDL_SRCALPHA, $i); /usr/include/SDL/SDL_video.h says for this method: * The 'alpha' parameter is ignored for surfaces that have an alpha channel. One solution might be to remove the alpha by converting the surface or creating a new surface with proper properties then blitting the original surface to it. > $img1->blit( SDL::Rect->new( > -width => 640, -height => 480), $app, undef); > > $app->sync; > } -- Guillaume Cottenceau Create your personal SMS or WAP Service - visit http://mobilefriends.ch/
Hi Guillaume - Thanks for your prompt reply. You mention converting the surface, I assume to remove the alpha channel. Any ideas how I'd go about doing this? Is there an appropriate method? -- rince.net ltd e. [EMAIL PROTECTED] w. http://rince.net m. 07885 040959 t. 01273 770008