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

Re: [pygame] Create alpha surfaces



Pete Shinners wrote:

> When you create the Surface, include the SRCALPHA flag. This will pretty
> much do what you want. The best way to test if the Surface really has
> per pixel alphas is to see if there is an alpha mask.
> 
> size = 100, 100
> surf_with_alpha = pygame.Surface(size, pygame.SRCALPHA, 32)
> test_perpixel_alpha = surf_with_alpha.get_masks()[3] != 0
> 
> Also, in the case where you already have an image and want to add
> perpixel alpha, you can call Surface.convert_alpha().
>

It works now, but then again, I had tried every possible combination of
flags and depth and I couldn't make it work before, I don't know.

Thanks again,

--willem