(surface_ptr)
return bytematrix.ByteMatrix.view_from_buffer(surface.h, surface.w, surface.pitch, pxbuf)
Creates a 2D pixel array view of the passed 8-bit surface.
Creates a 2D pixel array view of the passed 8-bit surface.
Creates a 2D pixel array view of the passed 8 - bit surface .
def _pixels2d(surface_ptr):
    """Creates a 2D pixel array view of the passed 8-bit surface."""
    # based on pysdl2.ext.pixels2d by Marcus von Appen
    # original is CC0 public domain with zlib fallback licence
    # https://bitbucket.org/marcusva/py-sdl2
    surface = surface_ptr.contents
    srcsize = surface.h * surface.pitch
    pxbuf = ctypes.cast(surface.pixels, ctypes.POINTER(ctypes.c_ubyte * srcsize)).contents
    # I don't understand this line, but I need it in Python 3
    # see https://bugs.python.org/issue15944
    if not PY2:
        pxbuf = memoryview(pxbuf).cast('B')
    return bytematrix.ByteMatrix.view_from_buffer(surface.h, surface.w, surface.pitch, pxbuf)
def _pixels2d ( surface_ptr ) : # based on pysdl2.ext.pixels2d by Marcus von Appen # original is CC0 public domain with zlib fallback licence # https://bitbucket.org/marcusva/py-sdl2 surface = surface_ptr . contents srcsize = surface . h * surface . pitch pxbuf = ctypes . cast ( surface . pixels , ctypes . POINTER ( ctypes . c_ubyte * srcsize ) ) . contents # I don't understand this line, but I need it in Python 3 # see https://bugs.python.org/issue15944 if not PY2 : pxbuf = memoryview ( pxbuf ) . cast ( 'B' ) return bytematrix . ByteMatrix . view_from_buffer ( surface . h , surface . w , surface . pitch , pxbuf )