On Fri, Feb 27, 2009 at 11:16:28AM +1100, René Dudfield wrote: > hey, > > is it possible to use numpy instead of Numeric? Numeric really is > dying now... even we are going to stop trying to keep it working. I suppose I should. Since I'm really clueless about Numeric/numarray/numpy, please tell me if this code has any obvious shortcomings: # initialization, done once import pygame import numpy image = pygame.image.load('title.png') # has an alpha channel mask = pygame.surfarray.array_alpha(image) # this is done once every frame array = pygame.surfarray.pixels_alpha(image) alpha = 42.5 # a float varying between 1 and 255 array[...] = (mask * alpha / 255).astype('b') Cheers! Marius Gedminas -- Never trust a computer you can't repair yourself.
Attachment:
signature.asc
Description: Digital signature