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

Re: [pygame] Get a transparent Surface



Quoting Luca <lucafbb@xxxxxxxxx>:

> Hi all.
> 
> I wanna obtain a transparent surface where I want to use base draw
> functions, then blit this surface onto images.
> 
> After trying a lot I found only this combination is working:
> 
> s2 = pygame.Surface( (250,250), flags=SRCALPHA, depth=32 ).convert_alpha()
> s2.fill( (127,127,127,0,) )
> 
> In facts I must create a surface, then fill a transparent color on
> it... Is this the right way?
> 
For one, convert_alpha is unnecessary. For another, a new per-pixel 
alpha surface has all pixels set to (0, 0, 0, 0). As the color of a fully 
transparent pixel is irrelevant the fill is also unnecessary.

-- 
Lenard Lindstrom
<len_l@xxxxxxxxx>