ipygame.pixelcopy
pygame-compatible pixelcopy module.
surface_to_array
Section titled “surface_to_array”def surface_to_array(array: np.ndarray, surface: Surface, kind: str = "P", opaque: int = 255, clear: int = 0) -> NoneCopy surface pixels into an existing array.
kind: 'P' mapped, 'R' red, 'G' green, 'B' blue,
'A' alpha, 'C' colorkey.
array_to_surface
Section titled “array_to_surface”def array_to_surface(surface: Surface, array: np.ndarray) -> NoneCopy an array into a surface’s pixel buffer.
map_array
Section titled “map_array”def map_array(array1: np.ndarray, array2: np.ndarray, surface: Surface) -> NoneMap a (H,W,3) RGB array to a (H,W) mapped-pixel array.
make_surface
Section titled “make_surface”def make_surface(array: np.ndarray) -> SurfaceCreate a new Surface from a numpy array.