[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] fade out surfaces
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)