示例#1
0
def pixels_red (surface):
    """pygame.surfarray.pixels_red (Surface): return array

    Reference pixel red into a 2d array.

    Create a new 2D array that directly references the red 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 can only work on 24-bit or 32-bit Surfaces.

    The Surface this array references will remain locked for the
    lifetime of the array.
    """
    global numpysf
    try:
        return numpysf.pixels_red(surface)
    except AttributeError:
        import pygame._numpysurfarray as numpysf
        return numpysf.pixels_red(surface)
示例#2
0
def pixels_red (surface):
    """pygame.surfarray.pixels_red (Surface): return array

    Reference pixel red into a 2d array.

    Create a new 2D array that directly references the red 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 can only work on 24-bit or 32-bit Surfaces.

    The Surface this array references will remain locked for the
    lifetime of the array.
    """
    return numpysf.pixels_red (surface)
示例#3
0
def pixels_red (surface):
    """pygame.surfarray.pixels_red (Surface): return array

    Reference pixel red into a 2d array.

    Create a new 2D array that directly references the red 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 can only work on 24-bit or 32-bit Surfaces.

    The Surface this array references will remain locked for the
    lifetime of the array.
    """
    if __arraytype == "numpy":
        return numpysf.pixels_red (surface)
    raise NotImplementedError("surface arrays are not supported")