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

Re: [pygame] Questions about surface with alpha channel



John Eriksson wrote:
1. Is this the correct way of creating an surface with an
alhpa-per-pixel channel?
surface = pygame.Surface((w, h), pygame.SRCALPHA)

This is the easiest. It will create an 32bit RGBA image for you. If you want more control over the pixel format, you can pass more arguments. But generally not necessary.

2. How do you clear an alpha channel surface? I guesss you can't use the
fill method?

Fill is really the only way to do it. Fill will set all the pixels in an image to a given value. You can set the alpha channel to invisible (0) or solid (255).