Hi,

I thought it was going to be user error. Yes, changing the set_pixel to
use an 0xRRGGBB value now makes the image perfect.

Thanks for your help,

On Fri, 2012-02-24 at 15:28 +0100, Tobias Leich wrote:
> Hi,
> 
> set_pixel() doesnt expect an SDL::Color object. It expects to get a
> color value.
> 
> So if you have 24bit surface like you have for $app, then you have to
> pass 0xRRGGBB values.
> If you change the red/green/blumasks to something else, you have to pass
> appropriate color values.
> 
> Please note that your $app surface doesnt have an alpha channel, even
> when giving it a depth of 32.
> If you are going to draw a pixel on a real 32bit surface you have to
> pass colors in 0xRRGGBBAA format.
> 
> If you have an 8bit surface (with a palette) then you cant pass color
> values but palette indexes.
> 
> Cheers, FROGGS
> 
> Am 24.02.2012 08:13, schrieb Jon Mitchell:
> > Hi,
> >
> > I'm trying to convert some of my old SDL perl programs to use SDL perl
> > version 2.536 on 64bit gentoo with perl-5.12.4. Unexpectedly
> > everything that gets drawn using comes out with an blue tinge. For
> > example:
> >
> > #!/usr/bin/perl -w
> >
> > use strict;
> >
> > use SDL;
> > use SDL::Color;
> > use SDLx::App;
> >
> > my $app = SDLx::App->new (title => 'Test', width => 320, height => 320);
> > my $colour = SDL::Color->new (0,0,0);
> >
> > for my $x (0..319) {
> >    $app->set_pixel(10, $x, $colour);
> > }
> > $app->sync;
> > sleep(5);
> >
> > This draws a blue line, where I would have expected a black line. I've
> > tried adding redmask, bluemask, greenmask and alphamask options to the
> > App new call, without any noticeable effect.
> >
> > I wondered if someone could try the above code to see if it's
> > something to do with my set up, or a bug in my code.
> >
> > Thanks,
> 


Reply via email to