I don't know. What version of NumPy do you have installed? I cannot
reproduce this error message with version 1.2.1. Try adding these print
statements:
surface.convert(32,SRCALPHA)
print surface.get_size(), surface.get_masks(), surface.get_shifts()
array = pygame.surfarray.pixels_alpha(surface)
print array.dtype, array.shape, array.strides
Lenard
Ian Mallett wrote:
I only provided that much code because I thought it was something
simple. Hmmm. Here's my code:
#surface is loaded earlier with pygame.image.load()
surface.convert(32,SRCALPHA)
array = pygame.surfarray.pixels_alpha(surface)
array[:,:] = 255-array[:,:]
del array
It crashes with:
Traceback (most recent call last):
File "[path]", line 152, in OnFlipAlpha
array[:,:] = 255-array[:,:]
TypeError: Array can not be safely cast to required type