def TestNumeric():
global pic2
pic2 = GetPic()
array = pygame.surfarray.array3d(pic2).astype(Numeric.Int)
alphaarray = pygame.surfarray.array_alpha(pic).astype(Numeric.UInt8)
starttime = time.time()
for i in range(10):
array[:, :] = Numeric.clip(array + [20, 0, 0], 0, 255)
pygame.surfarray.blit_array(pic2, array)
pygame.surfarray.pixels_alpha(pic2)[:, :] = alphaarray
Update()
print 'Numeric time: %f seconds' % (time.time() - starttime)
def TestNumpy():
global pic2
pic2 = GetPic()
array = pygame.surfarray.array3d(pic2).astype(numpy.int)
alphaarray =
pygame.surfarray.array_alpha(pic).astype(numpy.unsignedinteger)
starttime = time.time()
for i in range(10):
array[:, :] = numpy.clip(array + [20, 0, 0], 0, 255)
pygame.surfarray.blit_array(pic2, array)
pygame.surfarray.pixels_alpha(pic2)[:, :] = alphaarray
Update()
print 'numpy time: %f seconds' % (time.time() - starttime)