[SDL] blitting from-to surface with per-pixel alpha doesn't work...

D. Gyimesi dgyimesi at gmail.com
Thu Nov 17 09:56:39 PST 2005

On Thu, 2005-11-17 at 13:26 -0300, Gabriel wrote:
> El mié, 16-11-2005 a las 23:05 +0100, D. Gyimesi escribió:
> > I have four surfaces: screen, background, tank and its parts.
> > The order of blitting: screen<-background and in another cycle
> > screen<-tank<-parts. All surfaces are having per-pixel-data of course.
> > 
> > Despite of this, the result in the tank surface (the surface I blit into
> > the parts) draws a strange black 'belt' around the parts, but other
> > transparent areas of the surfaces are showing up well.
> > 
> > I know it's a little hard to imagine, but did anyone meet a problem similar
> > to this?
> No, and assuming you have everything set up correctly, it should work as
> you describe it. Are you completely sure that the problem isn't in the
> images themselves? If the "strange black belt" is not rectangular and
> contains the complete image, I'd say that's the most likely cause.
> How do you get SDL_Surfaces with alpha? Load from PNGs or are you doing
> something else? Are you messing with the surface flags after loading
> them?

Hi Gabriel!

All of the images are PNGs with initial transparency fill from Gimp.
The blit is working great with per-pixel alpha but only when I blit the
parts into 'display', not to the 'tank' and then to 'display' surface.
The black belt isn't rectangular, it is on the boundary of the
transparency and the image.

I don't know who to get SDL_Surfaces with alpha in SDL, because I'm
using PyGame, but I assuming there aren't much differences. In PyGame
one can get a surface like this:
	pygame.Surface((width, height), flags=0, depth=0, masks=None):return

More information about the SDL mailing list