%PDF- %PDF-
Mini Shell

Mini Shell

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

�

��e6-���ddlmZddlZddlmZddlmZmZddlm	Z	m
Z
mZmZddl
mZddl
mZdd	l
mZdd
l
mZddl
mZdZd
�Zd�ZGd�d�ZGd�dej�Ze
j8ej:ee�e
j<ej:e�e
j>ej:d�e
j@ej:d�y)�)�annotationsN)�BytesIO)�ceil�log�)�BmpImagePlugin�Image�	ImageFile�PngImagePlugin)�i16le)�i32le)�o8)�o16le)�o32lesc	��|jt�|jjd�dk(}|jjdgd��}g}|g|jjdg�z}|j\}}tt
|��D�]}	|	d|kDs|	d|kDs|	ddkDs|	ddkDr�%|D]�}
|
j|	k7r�|j|
�|r�tj|
jd}|g}|D]Y}
|
j|	k7r�tj|
jd}||vs�8|j|
�|j|��[��
j�}|j|	tjjd�	�|j|��� |jt!t#|���|j%�t#|�d
zz}|D�]}|j\}}|jt'|dkr|nd��|jt'|dkr|nd��|r tj|jddnd\}}|jt'|��|jd�|jd
�|jt!|��t)�}|rM|j+|d�|dk7rHtj,d	�}t/j0||dd|	zddfg�n|j+|d�|j3d�|j5�}|r|ddt7|dz�z|ddz}t#|�}|jt7|��|jt7|��|j%�}|j3|�|j|�||z}|j3|���y)N�
bitmap_format�bmp�sizes))�r)�r)� r)�0r)�@r)�r)�r�
append_imagesrrr)�reducing_gapr)rr�s�dibr�1�raw�rr)r r����png���)�write�_MAGIC�encoderinfo�get�size�sorted�set�appendr�SAVE�mode�copy�	thumbnailr	�
Resampling�LANCZOS�o16�len�tellrr�save�newr
�_save�seek�read�o32)�im�fp�filenamerr�frames�provided_ims�width�heightr,�provided_im�bits�	bits_used�other_im�frame�offset�colors�image_io�and_mask�image_bytes�	bytes_len�currents                      �4/usr/lib/python3/dist-packages/PIL/IcoImagePlugin.pyr;r;*s}���H�H�V��
�.�.�
�
�_�
-��
6�C��N�N����R�
�E��F��4�"�.�.�,�,�_�b�A�A�L��G�G�M�E�6��s�5�z�"�!����7�U�?�d�1�g��.�$�q�'�C�-�4��7�S�=��'�	!�K����4�'���M�M�+�&��%�*�*�;�+;�+;�<�Q�?��!�F�	� ,�/�H��}�}��,� �)�.�.�x�}�}�=�a�@�D��9�,��
�
�h�/�!�(�(��.�/�
�!	!�& �$�$�&�E��O�O�D�%�"2�"2�":�":��O�N��M�M�%� �3!�4�H�H�S��V��
��
�W�W�Y��V��r�)�
)�F��"���
�
�
��v�
����U�S�[�E�a�0�1�
����f�s�l�F��2�3�>A�~�*�*�5�:�:�6�q�r�:�w���f�
����F���
�����
�����
����T����9����J�J�x��'��r�z� �9�9�S�$�/������h�%��$���<�)P�(Q��
�J�J�x��'��
�
�a���m�m�o���%�b�q�/�C���
�O�;�k�"�#�>N�N�K���$�	�
����Y�� �
����V����'�'�)��
�����
������)�#��
�����E"�c��|ddtk(S)N�)r))�prefixs rR�_acceptrWus���"�1�:���rSc�.�eZdZd�Zd�Zdd�Zdd�Zd�Zy)�IcoFilec���|jd�}t|�s
d}t|��||_g|_t|d�|_t|j�D]�}|jd�}|d|d|d|dt|d�t|d�t|d	�t|d
�d�}dD]
}||r�	d
||<�|dxs&|ddk7xrtt|dd��xsd
|d<|d|df|d<|d|dz|d<|jj|���t|jd���|_t|jd�d��|_y)zL
        Parse image from file-like object containing ico file data
        �znot an ICO filerUrrrr&�r%r')rDrE�nb_color�reserved�planes�bppr,rK)rDrErr`r]�color_depthrDrE�dim�squarec��|dS)Nra���xs rR�<lambda>z"IcoFile.__init__.<locals>.<lambda>�s��a�
�6F�rS)�keyc��|dS)Nrcrerfs rRrhz"IcoFile.__init__.<locals>.<lambda>�s
��a��k�rST)ri�reverseN)
r=rW�SyntaxError�buf�entry�i16�nb_items�range�i32rrr/r-)�selfrm�s�msg�i�icon_header�js       rR�__init__zIcoFile.__init__zs���
�H�H�Q�K���q�z�#�C��c�"�"������
��A�q�	��
��t�}�}�%�!	+�A������A��1���A�$��a�D��a�D��a��)��1�a�y��A�q�	��a��*�	�K�)�
)��"�1�~�%(�K��N�
)��E�"���
�+�q�0�>��S��Z�!8�!�<�=��
�

�
�&�#.�g�"6��H�8M�!N�K���$/��$8�;�x�;P�$P�K��!��J�J���k�*�C!	+�F�D�J�J�,F�G��
��D�J�J�,A�4�P��
rSc�P�|jD�chc]}|d|df��c}Scc}w)zJ
        Get a list of all available icon sizes and color depths.
        rDrE)rn)rs�hs  rRrz
IcoFile.sizes�s)��48�:�:�>�a��7��Q�x�[�)�>�>��>s�#c�p�t|j�D]\}}||dk(s�|dus	||dk(s�|cSy)NrbFrar)�	enumeratern)rsr,r`rvr{s     rR�
getentryindexzIcoFile.getentryindex�sF���d�j�j�)�	�D�A�q��q��x��S�E�\�S�A�m�<L�5L���	�rSc�D�|j|j||��S)z,
        Get an image from the icon
        )rJr~)rsr,r`s   rR�getimagezIcoFile.getimage�s ���z�z�$�,�,�T�3�7�8�8rSc��|j|}|jj|d�|jjd�}|jj|d�|ddtj
k(r@t	j|j�}tj|j�|Stj|j�}tj|j�|jdt|jddz�f|_
|jd\}}}}|d|jz||f|jd<|d}	d	|	k(r�|jj|�|jj|jd|jdzd
z�ddd
�}
tjd|j|
d
d�}n�|jd}|d	zdkDr|d	|jdd	zz
z
}t||jdzdz�}
|d|dz|
z
}|jj|�|jj|
�}tjd|j|d
dt|dz�df�}|j!d�}|j#|�|S)z-
        Get an image from frame idx
        rKr%Nrrr&r"r`rrUr\�Lr!)r�rr#r,r z1;Ir#�RGBA)rnrmr<r=rr)�PngImageFiler	�_decompression_bomb_checkr,r�DibImageFile�int�_size�tile�
frombuffer�convert�putalpha)rs�idx�header�datar?�d�e�o�ar`�alpha_bytes�mask�w�total_bytes�and_mask_offset�	mask_datas                rRrJz
IcoFile.frame�st��
���C������
�
�f�X�&�'��x�x�}�}�Q������
�
�f�X�&�'����8�~�,�,�,��,�,�T�X�X�6�B��+�+�B�G�G�4�~�	�y �,�,�T�X�X�6�B��+�+�B�G�G�4�����
�C�����
�Q��$7�8�B�H������J�A�q�!�Q��F�R�W�W�,�a��2�B�G�G�A�J���-�C��S�y����
�
�a� �"�h�h�m�m�B�G�G�A�J������,C�a�,G�H���A��N���'�'���G�G��� ����G�G�A�J����F�a�<���r�w�w�q�z�B��/�/�A�
"�1�r�w�w�q�z�>�Q�"6�7��"(��"2�V�F�^�"C�k�"Q�����
�
�o�.� �H�H�M�M�+�6�	��'�'���G�G����C��A��J��+������F�#�B��K�K����	rSN)F)�__name__�
__module__�__qualname__ryrr~r�rJrerSrRrYrYys��7Q�r?��9�MrSrYc�^�eZdZdZdZdZd�Zed��Zejd��Zd�Z
d�Zy	)
�IcoImageFilea�
    PIL read-only image support for Microsoft Windows .ico files.

    By default the largest resolution image in the file will be loaded. This
    can be changed by altering the 'size' attribute before calling 'load'.

    The info dictionary has a key 'sizes' that is a list of the sizes available
    in the icon file.

    Handles classic, XP and Vista icon formats.

    When saving, PNG compression is used. Support for this was only added in
    Windows Vista. If you are unable to view the icon in Windows, convert the
    image to "RGBA" mode before saving.

    This plugin is a refactored version of Win32IconImagePlugin by Bryan Davis
    <casadebender@gmail.com>.
    https://code.google.com/archive/p/casadebender/wikis/Win32IconImagePlugin.wiki
    �ICOzWindows Iconc���t|j�|_|jj�|jd<|jj
dd|_|j�y)Nrrrb)rYr@�icor�infornr,�load�rss rR�_openzIcoImageFile._open1sM���4�7�7�#���!�X�X�^�^�-��	�	�'���H�H�N�N�1�%�e�,��	��	�	�rSc��|jS�N)r�r�s rRr,zIcoImageFile.size7s���z�z�rSc�N�||jdvr
d}t|��||_y)Nrz2This is not one of the allowed sizes of this image)r��
ValueErrorr�)rs�valuerus   rRr,zIcoImageFile.size;s)����	�	�'�*�*�F�C��S�/�!���
rSc��|j�B|jj|jk(rtjj|�S|jj|j�}|j�|j|_d|_|j|_|j|jk7r�tjd�|jj|j�}t|jd�}|j||<t|�|jd<|j|_yy)NzImage was not the expected sizer)r?r,r	r�r�r��pyaccessr1�_mode�warnings�warnr~�listr�r.)rsr?�indexrs    rRr�zIcoImageFile.loadBs����7�7��4�7�7�<�<�4�9�9�#<��;�;�#�#�D�)�)�
�X�X�
�
�t�y�y�
)��
���	��%�%�����
��W�W��
�
�7�7�d�i�i���M�M�;�<��H�H�*�*�4�9�9�5�E�����7�+�,�E��7�7�E�%�L�!$�U��D�I�I�g�����D�I� rSc��yr�rer�s rR�	load_seekzIcoImageFile.load_seekVs��	
rSN)r�r�r��__doc__�format�format_descriptionr��propertyr,�setterr�r�rerSrRr�r�sO���(�F�'�������
�[�[���� �(
rSr�z.icozimage/x-icon)!�
__future__rr��ior�mathrr�rr	r
r�_binaryrror
rrrrr6rr>r)r;rWrYr��
register_openr��
register_save�register_extension�
register_mimererSrR�<module>r�s���.#����>�>�!�!��!�!�

��H�V �Y�Y�@@
�9�&�&�@
�N����L�'�'��w�?�����L�'�'��/������,�,�f�5�����L�'�'��8rS

Zerion Mini Shell 1.0