Ejemplo n.º 1
0
def array2d (surface):
    """pygame.surfarray.array2d (Surface): return array

    Copy pixels into a 2d array.

    Copy the pixels from a Surface into a 2D array. The bit depth of the
    surface will control the size of the integer values, and will work
    for any type of pixel format.

    This function will temporarily lock the Surface as pixels are copied
    (see the Surface.lock - lock the Surface memory for pixel access
    method).
    """
    global numpysf
    try:
        return numpysf.array2d (surface)
    except AttributeError:
        import pygame._numpysurfarray as numpysf
        return numpysf.array2d (surface)
Ejemplo n.º 2
0
def array2d (surface):
    """pygame.surfarray.array2d (Surface): return array

    Copy pixels into a 2d array.

    Copy the pixels from a Surface into a 2D array. The bit depth of the
    surface will control the size of the integer values, and will work
    for any type of pixel format.

    This function will temporarily lock the Surface as pixels are copied
    (see the Surface.lock - lock the Surface memory for pixel access
    method).
    """
    return numpysf.array2d (surface)
Ejemplo n.º 3
0
def array2d(surface):
    """pygame.surfarray.array2d (Surface): return array

    Copy pixels into a 2d array.

    Copy the pixels from a Surface into a 2D array. The bit depth of the
    surface will control the size of the integer values, and will work
    for any type of pixel format.

    This function will temporarily lock the Surface as pixels are copied
    (see the Surface.lock - lock the Surface memory for pixel access
    method).
    """
    if __arraytype == "numeric":
        return numericsf.array2d(surface)
    elif __arraytype == "numpy":
        return numpysf.array2d(surface)
    raise NotImplementedError("surface arrays are not supported")
Ejemplo n.º 4
0
def array2d(surface):
    """pygame.surfarray.array2d (Surface): return array

    Copy pixels into a 2d array.

    Copy the pixels from a Surface into a 2D array. The bit depth of the
    surface will control the size of the integer values, and will work
    for any type of pixel format.

    This function will temporarily lock the Surface as pixels are copied
    (see the Surface.lock - lock the Surface memory for pixel access
    method).
    """
    if __arraytype == "numeric":
        return numericsf.array2d(surface)
    elif __arraytype == "numpy":
        return numpysf.array2d(surface)
    raise NotImplementedError("surface arrays are not supported")