pygame   documentation
||  Home  ||  Help Contents  ||
 
|| pygame || cdrom || constants || cursor || display || draw ||
|| event || font || image || joystick || key || mixer ||
|| mixer_music || mouse || movie || sndarray || surfarray || time ||
|| transform ||
 
|| CD || Channel || Clock || Font || Joystick || Movie ||
|| Overlay || Rect || Sound || Surface ||
 
|| color || cursors || sprite ||

pygame.surfarray

Contains routines for mixing numeric arrays with surfaces. You can create arrays that directly reference the pixel data of an image. Sometimes this can be limited to the pixel format of the Surface, so you can also create independent copies from any format.
 
The image arrays are indexes 'X' axis first. This is different than traditional C memory access, where images are often indexed with the 'Y' axis first. All this means is to access pixel values in the array, you index them as 'X, Y' pairs. myarray[10,20] will provide you the pixel at 10, 20 in the image. If you prefer to work with the traditional framebuffer indices, use the arrays 'transpose()' method to create the alternate view of the pixel data.
 

array2d - get a 2d array copied from a surface
array3d - get a 3d array copied from a surface
array_alpha - get an array with a surface pixel alpha values
array_colorkey - get an array with a surface colorkey values
blit_array - quickly transfer an array to a Surface
make_surface - create a new Surface from array data
map_array - map an array with RGB values into mapped colors
pixels2d - get a 2d reference array to a surface
pixels3d - get a 3d reference array to a surface
pixels_alpha - get a reference array to a surface alpha data

array2d
pygame.surfarray.array2d(Surface) -> Array
 
array3d
pygame.surfarray.array3d(Surface) -> Array
 
array_alpha
pygame.surfarray.array_alpha(Surface) -> Array
 
array_colorkey
pygame.surfarray.array_colorkey(Surface) -> Array
 
blit_array
pygame.surfarray.blit_array(surf, array) -> None
 
make_surface
pygame.surfarray.make_surface(array) -> Surface
 
map_array
pygame.surfarray.map_array(surf, array3d) -> array2d
 
pixels2d
pygame.surfarray.pixels2d(Surface) -> Array
 
pixels3d
pygame.surfarray.pixels3d(Surface) -> Array
 
pixels_alpha
pygame.surfarray.pixels_alpha(Surface) -> Array