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

    Reference pixels into a 3d array.

    Create a new 3D 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.

    This will only work on Surfaces that have 24-bit or 32-bit
    formats. Lower pixel formats cannot be referenced.

    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).
    """
    global numpysf
    try:
        return numpysf.pixels3d(surface)
    except AttributeError:
        import pygame._numpysurfarray as numpysf
        return numpysf.pixels3d(surface)
Пример #2
0
def pixels3d (surface):
    """pygame.surfarray.pixels3d (Surface): return array

    Reference pixels into a 3d array.

    Create a new 3D 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.

    This will only work on Surfaces that have 24-bit or 32-bit
    formats. Lower pixel formats cannot be referenced.

    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).
    """
    return numpysf.pixels3d (surface)
Пример #3
0
def pixels3d(surface):
    """pygame.surfarray.pixels3d (Surface): return array

    Reference pixels into a 3d array.

    Create a new 3D 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.

    This will only work on Surfaces that have 24-bit or 32-bit
    formats. Lower pixel formats cannot be referenced.

    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.pixels3d(surface)
    elif __arraytype == "numpy":
        return numpysf.pixels3d(surface)
    raise NotImplementedError("surface arrays are not supported")