[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Alpha blitting problems...answers anyone?



Thanks, that cleared it up nicely. Does this mean that any image can
be converted to alpha, with image.set_alpha() or is it just 32 bit
images?


On Wed, 30 Mar 2005 20:02:45 -0800, Pete Shinners <pete@xxxxxxxxxxxx> wrote:
> On Wed, 2005-03-30 at 23:10 +0100, Chris Smith wrote:
> > image=pygame.Surface((x,y),SWSURFACE|SRCALPHA,32)
> > image.set_alpha(128)
> > image.fill((128,83,83))
> 
> SDL has a potentially confusing split between Surfaces with perpixel
> alpha and surface alpha. You cannot mix the two, so once a surface has
> pixel alphas it no longer looks at the surface alpha value.
> 
> When creating a new Surface with the SRCALPHA flag you will actually get
> a surface with individual alphas per pixel. In this case the set_alpha()
> call can only be used to disable or enable the use of those alphas when
> blitting.
> 
> In your example, your best bet will be to use 0 for the Surface flags.
> Switch the call to this for better results.
> 
> image = pygame.Surface((x, y), 0, 32)
> 
> 


-- 
Science is open source religion