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

Re: [pygame] fade out surfaces



Pete Shinners wrote:
> On Sun, 2005-09-11 at 10:05 +1000, Luke Miller wrote:
> 
>>Well, I might have a look at it in a few days (surfarray). It's really
>>just one of those luxury extras...
> 
> 
> The surfarray code for this would not be complicated. Off the top of my
> head, this should do the job
> 
> def multiply_alpha(surf, value):
>     """Multiple the pixel alphas. Value range is 0 - 255."""
>     alpha = pygame.surfarray.pixels_alpha(surf)
>     multAlpha = alpha * value
>     multAlpha >>= 8
>     alpha[:] = multAlpha.astype(Numeric.UInt8)
> 
> 
> 
Thanks a lot, although i'm not really sure how it does what it does, it
works great! My app won't be as great as others but it'll be free and I
think it'll fill some space better than others are doing, at least until
some nice hacker thinks he can do better and does something pro for real.