def map_array(surface, array): """pygame.numpyarray.map_array(Surface, array3d): return array2d map a 3d array into a 2d array Convert a 3D array into a 2D array. This will use the given Surface format to control the conversion. Note: arrays do not need to be 3D, as long as the minor axis has three elements giving the component colours, any array shape can be used (for example, a single colour can be mapped, or an array of colours). The array shape is limited to eleven dimensions maximum, including the three element minor axis. """ if array.ndim == 0: raise ValueError("array must have at least 1 dimension") shape = array.shape if shape[-1] != 3: raise ValueError("array must be a 3d array of 3-value color data") target = numpy_empty(shape[:-1], numpy.int32) pix_map_array(target, array, surface) return target