Skip to content

ipygame.pixelcopy

pygame-compatible pixelcopy module.

def surface_to_array(array: np.ndarray,
surface: Surface,
kind: str = "P",
opaque: int = 255,
clear: int = 0) -> None

Copy surface pixels into an existing array.

kind: 'P' mapped, 'R' red, 'G' green, 'B' blue, 'A' alpha, 'C' colorkey.

def array_to_surface(surface: Surface, array: np.ndarray) -> None

Copy an array into a surface’s pixel buffer.

def map_array(array1: np.ndarray, array2: np.ndarray,
surface: Surface) -> None

Map a (H,W,3) RGB array to a (H,W) mapped-pixel array.

def make_surface(array: np.ndarray) -> Surface

Create a new Surface from a numpy array.