%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /usr/lib/python3/dist-packages/PIL/__pycache__/
Upload File :
Create Path :
Current File : //usr/lib/python3/dist-packages/PIL/__pycache__/PyAccess.cpython-312.pyc

�

��e�&����ddlmZddlZddlZddlmZ	ddlmZdZe�Z	e	je�ej e�ZGd�d	�ZGd
�de�ZGd�d
e�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Zide�de�d e�d!e�d"e�d#e�d$e�d%e�d&e�d'e�d(e�d)e�d*e�d+e�d,e�d-e�d.e�Zej>d/k(reed0<eed1<eed2<eed3<eed4<need0<eed1<eed2<eed3<eed4<d6d5�Zy#e$r%Zddl
mZeje�xZZ	YdZ[��+dZ[wwxYw)7�)�annotationsN�)�	deprecate)�FFIz|
    struct Pixel_RGBA {
        unsigned char r,g,b,a;
    };
    struct Pixel_I16 {
        unsigned char l,r;
    };
    )�
DeferredErrorc�4�eZdZdd�Zd�Zd�Zd�ZeZeZd�Z	y)�PyAccessc��tdd�t|jj�}||_t
j
d|d�|_t
j
d|d�|_t
j
d|d�|_	|jj\|_|_||_
|j|_|jjdvr|j |_|j%�y)	Nr	�zunsigned char **�image8zint **�image32�image��P�PA)r�dict�im�unsafe_ptrs�readonly�ffi�castrr
r�size�xsize�ysize�_img�_im�mode�palette�_palette�
_post_init)�self�imgr�valss    �./usr/lib/python3/dist-packages/PIL/PyAccess.py�__init__zPyAccess.__init__4s����*�b�!��C�F�F�&�&�'�� ��
��h�h�1�4��>�B����x�x��$�y�/�:����X�X�0�$�w�-�@��
�!$�������
�D�J���	��6�6����8�8�=�=�K�'��K�K�D�M�
	
����c��y�N�)r!s r$r zPyAccess._post_initHs��r&c�B�|jr
d}t|��|\}}|dkr|j|z}|dkr|j|z}|j	||f�\}}|j
jdvr�t|ttf�r�t|�dvrv|j
jdk(rt|�dk(r|dnd}|d	d}|jj||j�}|j
jdk(r|f}|j|||�S)
a0
        Modifies the pixel at x,y. The color is given as a single
        numerical value for single band images, and a tuple for
        multi-band images

        :param xy: The pixel coordinate, given as (x, y). See
           :ref:`coordinate-system`.
        :param color: The pixel value.
        z%Attempt to putpixel a read only imagerr)��rr,r+�N)r�
ValueErrorrr�check_xyrr�
isinstance�list�tuple�lenr�getcolorr�	set_pixel)r!�xy�color�msg�x�y�alphas       r$�__setitem__zPyAccess.__setitem__Ks���=�=�9�C��S�/�!����A��q�5��
�
�Q��A��q�5��
�
�Q��A�����1�v�&���A�
�H�H�M�M�[�(��5�4��-�0��E�
�f�$��x�x�}�}��$�$'��J�!�O��a�����b�q�	���M�M�*�*�5�$�)�)�<�E��x�x�}�}��$������~�~�a��E�*�*r&c��|\}}|dkr|j|z}|dkr|j|z}|j||f�\}}|j||�S)aq
        Returns the pixel at x,y. The pixel is returned as a single
        value for single band images or a tuple for multiple band
        images

        :param xy: The pixel coordinate, given as (x, y). See
          :ref:`coordinate-system`.
        :returns: a pixel value for single band images, a tuple of
          pixel values for multiband images.
        r)rrr/�	get_pixel)r!r6r9r:s    r$�__getitem__zPyAccess.__getitem__ns\�����A��q�5��
�
�Q��A��q�5��
�
�Q��A�����1�v�&���A��~�~�a��#�#r&c��|\}}d|cxkr|jkrnnd|cxkr|jksnd}t|��|S)Nrzpixel location out of range)rrr.)r!r6r9r:r8s     r$r/zPyAccess.check_xy�s@�����A��Q�#����#��Q�(;����(;�/�C��S�/�!��	r&N�F)
�__name__�
__module__�__qualname__r%r r<r?�putpixel�getpixelr/r)r&r$r	r	3s(���(
�!+�F$�&�H��H�r&r	c�"�eZdZdZd�Zd�Zd�Zy)�
_PyAccess32_2z7PA, LA, stored in first and last bytes of a 32 bit wordc�N�tjd|j�|_y�Nzstruct Pixel_RGBA **�rrr
�pixels�r!�args�kwargss   r$r z_PyAccess32_2._post_init�����h�h�5�t�|�|�D��r&c�V�|j||}|j|jfSr()rL�r�a�r!r9r:�pixels    r$r>z_PyAccess32_2.get_pixel�s'�����A��q�!���w�w�����r&c�x�|j||}t|dd�|_t|dd�|_y)Nrr-r)rL�minrRrS�r!r9r:r7rUs     r$r5z_PyAccess32_2.set_pixel�s8�����A��q�!���e�A�h��$����e�A�h��$��r&N�rBrCrD�__doc__r r>r5r)r&r$rHrH�s��A�E� �%r&rHc�"�eZdZdZd�Zd�Zd�Zy)�
_PyAccess32_3zARGB and friends, stored in the first three bytes of a 32 bit wordc�N�tjd|j�|_yrJrKrMs   r$r z_PyAccess32_3._post_init�rPr&c�l�|j||}|j|j|jfSr()rLrR�g�brTs    r$r>z_PyAccess32_3.get_pixel�s-�����A��q�!���w�w�������(�(r&c��|j||}t|dd�|_t|dd�|_t|dd�|_d|_y)Nrr-r��rLrWrRr_r`rSrXs     r$r5z_PyAccess32_3.set_pixel�sQ�����A��q�!���e�A�h��$����e�A�h��$����e�A�h��$�����r&NrYr)r&r$r\r\�s��K�E�)�r&r\c�"�eZdZdZd�Zd�Zd�Zy)�
_PyAccess32_4z&RGBA etc, all 4 bytes of a 32 bit wordc�N�tjd|j�|_yrJrKrMs   r$r z_PyAccess32_4._post_init�rPr&c��|j||}|j|j|j|jfSr()rLrRr_r`rSrTs    r$r>z_PyAccess32_4.get_pixel�s3�����A��q�!���w�w�������%�'�'�1�1r&c���|j||}t|dd�|_t|dd�|_t|dd�|_t|dd�|_y)Nrr-rrbr+rcrXs     r$r5z_PyAccess32_4.set_pixel�s\�����A��q�!���e�A�h��$����e�A�h��$����e�A�h��$����e�A�h��$��r&NrYr)r&r$rere�s��0�E�2�%r&rec�"�eZdZdZd�Zd�Zd�Zy)�
_PyAccess8z%1, L, P, 8 bit images stored as uint8c�&�|j|_yr()rrLrMs   r$r z_PyAccess8._post_init�s
���k�k��r&c�&�|j||Sr(�rL�r!r9r:s   r$r>z_PyAccess8.get_pixel�����{�{�1�~�a� � r&c��	t|d�|j||<y#t$r"t|dd�|j||<YywxYw)Nr-r�rWrL�	TypeError�r!r9r:r7s    r$r5z_PyAccess8.set_pixel�sK��	3� #�E�3��D�K�K��N�1����	3� #�E�!�H�c� 2�D�K�K��N�1��	3����(A
�	A
NrYr)r&r$rjrj�s��/�"�!�3r&rjc�"�eZdZdZd�Zd�Zd�Zy)�_PyAccessI16_Nz0I;16 access, native bitendian without conversionc�N�tjd|j�|_y)Nzunsigned short **�rrrrLrMs   r$r z_PyAccessI16_N._post_init�s���h�h�2�D�J�J�?��r&c�&�|j||Sr(rmrns   r$r>z_PyAccessI16_N.get_pixel�ror&c��	t|d�|j||<y#t$r"t|dd�|j||<YywxYw)N�rrqrss    r$r5z_PyAccessI16_N.set_pixel�sL��	5� #�E�5� 1�D�K�K��N�1����	5� #�E�!�H�e� 4�D�K�K��N�1��	5�rtNrYr)r&r$rvrv�s��:�@�!�5r&rvc�"�eZdZdZd�Zd�Zd�Zy)�_PyAccessI16_LzI;16L access, with conversionc�N�tjd|j�|_y�Nzstruct Pixel_I16 **rxrMs   r$r z_PyAccessI16_L._post_init�����h�h�4�d�j�j�A��r&c�^�|j||}|j|jdzzS�N��rL�lrRrTs    r$r>z_PyAccessI16_L.get_pixel�s+�����A��q�!���w�w����3��&�&r&c��|j||}	t|d�}|dz|_|dz	|_y#t$rt|dd�}Y�/wxYw)Nr{rr-�)rLrWrrr�rRrXs     r$r5z_PyAccessI16_L.set_pixel�s^�����A��q�!��	)���u�%�E��$�,����1�*����	�	)���a��%�(�E�	)���5�A�ANrYr)r&r$r}r}�s��'�B�'�r&r}c�"�eZdZdZd�Zd�Zd�Zy)�_PyAccessI16_BzI;16B access, with conversionc�N�tjd|j�|_yrrxrMs   r$r z_PyAccessI16_B._post_init�r�r&c�^�|j||}|jdz|jzSr�r�rTs    r$r>z_PyAccessI16_B.get_pixels+�����A��q�!���w�w��}�u�w�w�&�&r&c��|j||}	t|d�}|dz	|_|dz|_y#t$rt|dd�}Y�/wxYw)Nr{rr�r-)rLrW�	Exceptionr�rRrXs     r$r5z_PyAccessI16_B.set_pixels^�����A��q�!��	)���u�%�E��1�*����$�,����	�	)���a��%�(�E�	)�r�NrYr)r&r$r�r��s��'�B�'�r&r�c�"�eZdZdZd�Zd�Zd�Zy)�_PyAccessI32_Nz"Signed Int32 access, native endianc�&�|j|_yr(�r
rLrMs   r$r z_PyAccessI32_N._post_init�
���l�l��r&c�&�|j||Sr(rmrns   r$r>z_PyAccessI32_N.get_pixelror&c�(�||j||<yr(rmrss    r$r5z_PyAccessI32_N.set_pixels��!����A��q�r&NrYr)r&r$r�r�s��,�#�!�"r&r�c�(�eZdZdZd�Zd�Zd�Zd�Zy)�_PyAccessI32_Swapz,I;32L/B access, with byteswapping conversionc�&�|j|_yr(r�rMs   r$r z_PyAccessI32_Swap._post_init!r�r&c���tjd|�}tjd|�}|d|d|d|df\|d<|d<|d<|d<tjd|�dS)Nzint *zunsigned char *r+rbrr)r�newr)r!�i�orig�charss    r$�reversez_PyAccessI32_Swap.reverse$sq���w�w�w��"�����*�D�1��16�q��5��8�U�1�X�u�UV�x�1W�.��a��%��(�E�!�H�e�A�h��x�x���'��*�*r&c�D�|j|j||�Sr(�r�rLrns   r$r>z_PyAccessI32_Swap.get_pixel*s���|�|�D�K�K��N�1�-�.�.r&c�F�|j|�|j||<yr(r�rss    r$r5z_PyAccessI32_Swap.set_pixel-s�� �L�L��/����A��q�r&N)rBrCrDrZr r�r>r5r)r&r$r�r�s��6�#�+�/�0r&r�c�"�eZdZdZd�Zd�Zd�Zy)�
_PyAccessFz32 bit float accessc�N�tjd|j�|_y)Nzfloat **rKrMs   r$r z_PyAccessF._post_init4s���h�h�z�4�<�<�8��r&c�&�|j||Sr(rmrns   r$r>z_PyAccessF.get_pixel7ror&c�r�	||j||<y#t$r|d|j||<YywxYw)Nr)rLrrrss    r$r5z_PyAccessF.set_pixel:s>��	)� %�D�K�K��N�1����	)� %�a��D�K�K��N�1��	)�s��6�6NrYr)r&r$r�r�1s���9�!�)r&r��1�LrzI;16N�LA�Lar�RGB�LAB�HSV�YCbCr�RGBA�RGBa�RGBX�CMYK�F�I�littlezI;16zI;16LzI;16BzI;32LzI;32Bc��tj|jd�}|s!tj	d|j�y|||�S)NzPyAccess Not Implemented: %s)�mode_map�getr�logger�debug)r"r�access_types   r$r�r�gs<���,�,�s�x�x��.�K�����3�S�X�X�>���s�H�%�%r&rA) �
__future__r�logging�sys�
_deprecater�cffir�defsr�cdef�ImportError�ex�_utilrr��	getLoggerrBr�r	rHr\rerjrvr}r�r�r�r�r��	byteorderr)r&r$�<module>r�sD��*#��
�!�&���D��%�C��H�H�T�N�
��	�	�8�	$��V�V�r%�H�%�"�H��&%�H�%�&3��3�$5�X�5�$�X��*�X��*
"�X�
"�0��0�&)��)�$�����������^�	�
	�-��	�-�
�	�-��
�=��
�=��
�=���]���M���M���M���M�� ��!�"��#��(�=�=�H��%�H�V��&�H�W��&�H�W��&�H�W��)�H�W��%�H�V��&�H�W��&�H�W��)�H�W��&�H�W��&��}	�&�%�!�
�!�!�"�%�%�C�#��&�s� D<�<E&�E!�!E&

Zerion Mini Shell 1.0