With pygame.surfarray
pygame.surfarray.pixels_alpha(surface)[...] = 0
Of course one needs Numeric.
René Dudfield wrote:
> I can't think of a way to set the alpha by itself, without setting the
> RGB.
>
> Say I wanted to set the alpha ONLY with fill() then I don't think I
> can do it.
>
> Is there some way you could do that by passing mask to a blit call?
>
> If there's no way to do it already, then perhaps we could create a
> separate function which only acts on one channel at once. eg, only R,
> or only A. This could be added as a 'special flag' the same way the
> BLEND_ADD etc have recently been added to Surface.fill()
>
> Or maybe I'm forgetting some way?
>
>
> On 6/21/07, John Eriksson <john@xxxxxxxxxxxx> wrote:
>> Hi,
>> I have a couple of questions regarding surfaces with an alpha channel.
>>
>> 1. Is this the correct way of creating an surface with an
>> alhpa-per-pixel channel?
>> surface = pygame.Surface((w, h), pygame.SRCALPHA)
>>
>> 2. How do you clear an alpha channel surface? I guesss you can't use the
>> fill method?
>>
>> Best Regards
>> /John
>>
>>
>>
>>
--
Lenard Lindstrom
<len-l@xxxxxxxxx>