예제 #1
0
def pixels_alpha (surface):
    """pygame.surfarray.pixels_alpha (Surface): return array

    Reference pixel alphas into a 2d array.

    Create a new 2D array that directly references the alpha values
    (degree of transparency) 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 32-bit Surfaces with a per-pixel alpha value.

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

    Reference pixel alphas into a 2d array.

    Create a new 2D array that directly references the alpha values
    (degree of transparency) 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 32-bit Surfaces with a per-pixel alpha value.

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

    Reference pixel alphas into a 2d array.

    Create a new 2D array that directly references the alpha values
    (degree of transparency) 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 32-bit Surfaces with a per-pixel alpha value.

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