Пример #1
0
def pixels2d(surface):
    """pygame.surfarray.pixels2d (Surface): return array

    Reference pixels into a 2d array.
    
    Create a new 2D array that directly references the pixel values in a
    Surface. Any changes to the array will affect the pixels in the
    Surface. This is a fast operation since no data is copied.

    Pixels from a 24-bit Surface cannot be referenced, but all other
    Surface bit depths can.

    The Surface this references will remain locked for the lifetime of
    the array (see the Surface.lock - lock the Surface memory for pixel
    access method).
    """
    if __arraytype == "numeric":
        return numericsf.pixels2d(surface)
    elif __arraytype == "numpy":
        return numpysf.pixels2d(surface)
    raise NotImplementedError("surface arrays are not supported")
Пример #2
0
def pixels2d(surface):
    """pygame.surfarray.pixels2d (Surface): return array

    Reference pixels into a 2d array.
    
    Create a new 2D array that directly references the pixel values in a
    Surface. Any changes to the array will affect the pixels in the
    Surface. This is a fast operation since no data is copied.

    Pixels from a 24-bit Surface cannot be referenced, but all other
    Surface bit depths can.

    The Surface this references will remain locked for the lifetime of
    the array (see the Surface.lock - lock the Surface memory for pixel
    access method).
    """
    if __arraytype == "numeric":
        return numericsf.pixels2d(surface)
    elif __arraytype == "numpy":
        return numpysf.pixels2d(surface)
    raise NotImplementedError("surface arrays are not supported")