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

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



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)