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

D. Gyimesi dgyimesi at gmail.com
Thu Nov 17 10:12:46 PST 2005


> 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?

There's a method in the Surface class that can convert the pixel data of
the surface to per-pixel alpha. The following line loads the image, then
(if hasn't got per-pixel alpha values) it converts it:
	image = pygame.image.load(filename).convert_alpha()

All of the surfaces initialized with convert_alpha(), so they must have
alpha values.
I don't touch the surface flags anyway.

self.original =
pygame.Surface(self.rect.size,SRCALPHA,32).convert_alpha() is the way
I'm making surfaces.





More information about the SDL mailing list