
    &hE8                     f   S r SSKJrJrJrJr  SSKrSSKJ	r
JrJrJr  SSKrSR%                  5        V s/ s H  n \" \U 5      (       d  M  \" \U 5      PM     sn r\R-                  \5        1 Skr/ SQrS rS	 rS
 rS rS rS rS rS r S r!S r"S r#S r$S r%S r&S r'S rS r(S r)S r*gs  sn f )a  pygame module for accessing surface pixel data using array interfaces

Functions to convert between NumPy arrays and Surface objects. This module
will only be functional when pygame can use the external NumPy package.
If NumPy can't be imported, surfarray becomes a MissingModule object.

Every pixel is stored as a single integer value to represent the red,
green, and blue colors. The 8bit images use a value that looks into a
colormap. Pixels with higher depth use a bit packing process to place
three or four values into a single number.

The arrays are indexed by the X axis first, followed by the Y
axis. Arrays that treat the pixels as a single integer are referred to
as 2D arrays. This module can also separate the red, green, and blue
color values into separate indices. These types of arrays are referred
to as 3D arrays, and the last index is 0 for red, 1 for green, and 2 for
blue.
    )array_to_surfacesurface_to_array	map_arraymake_surfaceN)arrayemptyuint32ndarrayzfloat32 float64 float96>             )array2darray3darray_alpha
array_bluearray_colorkeyarray_green	array_redr   
blit_arrayget_arraytypeget_arraytypesr   r   pixels2dpixels3dpixels_alphapixels_bluepixels_green
pixels_redr   use_arraytypec                     [        U[        5      (       a8  UR                  [        ;   a$  UR	                  S5      R                  [        5      n[        X5      $ )a  pygame.surfarray.blit_array(Surface, array): return None

Blit directly from a array values.

Directly copy values from an array into a Surface. This is faster than
converting the array into a Surface and blitting. The array must be the
same dimensions as the Surface and will completely replace all pixel
values. Only integer, ascii character and record arrays are accepted.

This function will temporarily lock the Surface as the new values are
copied.
r   )
isinstancenumpy_ndarraydtypenumpy_floatsroundastypenumpy_uint32r   )surfacer   s     H/var/www/auris/envauris/lib/python3.13/site-packages/pygame/surfarray.pyr   r   a   s?     %''EKK<,GA%%l3G++    c                     [        U [        5      (       a8  U R                  [        ;   a$  U R	                  S5      R                  [        5      n [        U 5      $ )zpygame.surfarray.make_surface (array): return Surface

Copy an array to a new surface.

Create a new Surface that best resembles the data and format on the
array. The array can be 2D or 3D with any sized integer values.
r   )r    r!   r"   r#   r$   r%   r&   pix_make_surface)r   s    r(   r   r   s   s?     %''EKK<,GA%%l3E""r)   c                 R   U R                  5       n [        R                  [        R                  [        R                  [        R                  4US-
     nU R                  5       n[        R                  " X25      n[        X@5        U$ ! [
         a    [        SUS-   S35      ef = f)a  pygame.surfarray.array2d(Surface): return array

copy pixels into a 2d array

Copy the pixels from a Surface into a 2D array. The bit depth of the
surface will control the size of the integer values, and will work
for any type of pixel format.

This function will temporarily lock the Surface as pixels are copied
(see the Surface.lock - lock the Surface memory for pixel access
method).
   zunsupported bit depth r   z for 2D array)
get_bytesizenumpyuint8uint16int32
IndexError
ValueErrorget_sizer   r   )r'   bppr"   sizer   s        r(   r   r      s     


 CJellEKKEcAgN DKK$EU$L  J1#'-HIIJs   AB	 	B&c                     U R                  5       [        ;  a  [        S5      e [        U R	                  S5      SS9$ ! [        [
        4 a    [        SU R                  5        S35      ef = f)a  pygame.surfarray.pixels2d(Surface): return array

reference pixels into a 2d array

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

Pixels from a 24-bit Surface cannot be referenced, but all other
Surface bit depths can.

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).
z,unsupported bit depth for 2D reference array2Fcopyz
bit depth z# unsupported for 2D reference array)get_bitsize_pixel2d_bitdepthsr4   numpy_arrayget_view	TypeErrorr'   s    r(   r   r      sw      $66GHH
7++C0u==	" 
,,.//RS
 	

s	   > .A,c                     U R                  5       u  p[        R                  " XS4[        R                  5      n[	        X05        U$ )a  pygame.surfarray.array3d(Surface): return array

copy pixels into a 3d array

Copy the pixels from a Surface into a 3D array. The bit depth of the
surface will control the size of the integer values, and will work
for any type of pixel format.

This function will temporarily lock the Surface as pixels are copied
(see the Surface.lock - lock the Surface memory for pixel access
method).
   r5   r/   r   r0   r   )r'   widthheightr   s       r(   r   r      s:     $$&MEKK*EKK8EU$Lr)   c                 4    [        U R                  S5      SS9$ )a  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).
3Fr:   )r>   r?   rA   s    r(   r   r      s      w'',599r)   c                     U R                  5       n[        R                  " U[        R                  5      n[	        X S5        U$ )a  pygame.surfarray.array_alpha(Surface): return array

copy pixel alphas into a 2d array

Copy the pixel alpha values (degree of transparency) from a Surface
into a 2D array. This will work for any type of Surface
format. Surfaces without a pixel alpha will return an array with all
opaque values.

This function will temporarily lock the Surface as pixels are copied
(see the Surface.lock - lock the Surface memory for pixel access
method).
ArD   r'   r7   r   s      r(   r   r      s5     DKKekk*EUS)Lr)   c                 J    [         R                  " U R                  S5      SS9$ )a  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.
rJ   Fr:   r/   r   r?   rA   s    r(   r   r      s      ;;w'',599r)   c                 J    [         R                  " U R                  S5      SS9$ )a  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.
RFr:   rM   rA   s    r(   r   r            ;;w'',599r)   c                     U R                  5       n[        R                  " U[        R                  5      n[	        X S5        U$ )aL  pygame.surfarray.array_red(Surface): return array

copy pixel red into a 2d array

Copy the pixel red values from a Surface into a 2D array. This will work
for any type of Surface format.

This function will temporarily lock the Surface as pixels are copied
(see the Surface.lock - lock the Surface memory for pixel access
method).
rO   rD   rK   s      r(   r   r     5     DKKekk*EUS)Lr)   c                 J    [         R                  " U R                  S5      SS9$ )a  pygame.surfarray.pixels_green(Surface): return array

Reference pixel green into a 2d array.

Create a new 2D array that directly references the green 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.
GFr:   rM   rA   s    r(   r   r   !  rP   r)   c                     U R                  5       n[        R                  " U[        R                  5      n[	        X S5        U$ )aR  pygame.surfarray.array_green(Surface): return array

copy pixel green into a 2d array

Copy the pixel green values from a Surface into a 2D array. This will work
for any type of Surface format.

This function will temporarily lock the Surface as pixels are copied
(see the Surface.lock - lock the Surface memory for pixel access
method).
rT   rD   rK   s      r(   r   r   2  rR   r)   c                 J    [         R                  " U R                  S5      SS9$ )a  pygame.surfarray.pixels_blue(Surface): return array

Reference pixel blue into a 2d array.

Create a new 2D array that directly references the blue 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.
BFr:   rM   rA   s    r(   r   r   D  rP   r)   c                     U R                  5       n[        R                  " U[        R                  5      n[	        X S5        U$ )aO  pygame.surfarray.array_blue(Surface): return array

copy pixel blue into a 2d array

Copy the pixel blue values from a Surface into a 2D array. This will work
for any type of Surface format.

This function will temporarily lock the Surface as pixels are copied
(see the Surface.lock - lock the Surface memory for pixel access
method).
rW   rD   rK   s      r(   r   r   U  rR   r)   c                     U R                  5       n[        R                  " U[        R                  5      n[	        X S5        U$ )a  pygame.surfarray.array_colorkey(Surface): return array

copy the colorkey values into a 2d array

Create a new array with the colorkey transparency value from each
pixel. If the pixel matches the colorkey it will be fully
transparent; otherwise it will be fully opaque.

This will work on any type of Surface format. If the image has no
colorkey a solid opaque array will be returned.

This function will temporarily lock the Surface as pixels are
copied.
CrD   rK   s      r(   r   r   g  s5     DKKekk*EUS)Lr)   c                     UR                   S:X  a  [        S5      eUR                  nUS   S:w  a  [        S5      e[        USS [        R
                  5      n[        X1U 5        U$ )a  pygame.surfarray.map_array(Surface, array3d): return array2d

map a 3d array into a 2d array

Convert a 3D array into a 2D array. This will use the given Surface
format to control the conversion.

Note: arrays do not need to be 3D, as long as the minor axis has
three elements giving the component colours, any array shape can be
used (for example, a single colour can be mapped, or an array of
colours). The array shape is limited to eleven dimensions maximum,
including the three element minor axis.
r   z$array must have at least 1 dimensionrC   z.array must be a 3d array of 3-value color dataN)ndimr4   shapenumpy_emptyr/   r2   pix_map_array)r'   r   r^   targets       r(   r   r   |  s`     zzQ?@@KKERyA~IJJsU[[1F&)Mr)   c                     [         R                  " [        S5      5        U R                  5       n U S:w  a  [	        S5      eg)zjpygame.surfarray.use_arraytype(arraytype): return None

DEPRECATED - only numpy arrays are now supported.
donly numpy arrays are now supported, this function will be removed in a future version of the moduler/   zinvalid array typeN)warningswarnDeprecationWarninglowerr4   )	arraytypes    r(   r   r     sD    
 MM+	
 !IG-.. r)   c                  B    [         R                  " [        S5      5        g)z`pygame.surfarray.get_arraytype(): return str

DEPRECATED - only numpy arrays are now supported.
rc   r/   rd   re   rf    r)   r(   r   r     s"    
 MM+	
 r)   c                  B    [         R                  " [        S5      5        g)zcpygame.surfarray.get_arraytypes(): return tuple

DEPRECATED - only numpy arrays are now supported.
rc   )r/   rj   rk   r)   r(   r   r     s"    
 MM+	
 r)   )+__doc__pygame.pixelcopyr   r   r   r`   r   r+   r/   r   r>   r   r_   r	   r&   r
   r!   rd   splithasattrgetattrr#   appendfloatr=   __all__r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   )	type_names   0r(   <module>rv      s   *(     /4466	ui  GE96   E  ! 2,$
#0
4&:&(:$:"$:"$:"$*0/"ss   B.B.