%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__/IcnsImagePlugin.cpython-312.pyc

�

��e�.����ddlmZddlZddlZddlZddlZddlmZmZm	Z	m
Z
e
jd�Zerddlm
Z
dZdZd	�Zd
�Zd�Zd�Zd
�ZGd�d�ZGd�dej�Zd�Zd�Zej2ej4ee�ej6ej4d�ej8ej4e�ej:ej4d�edk(r�eej@�dkre!d�ejD�e#ej@dd�5Z$ee$�Z%e%jLdD]*Z'e'x\Z(Z)Z*e%_'e%jWde(�de)�de*�d���,ejFej@d�5Z,e,jWd�ddd�ejZdk(rej\d�ddd�yy#1swY�4xYw#1swYyxYw) �)�annotationsN�)�Image�	ImageFile�PngImagePlugin�features�jpg_2000)�Jpeg2KImagePluginsicns�c�T�tjd|jt��S)Nz>4sI)�struct�unpack�read�
HEADERSIZE)�fobjs �5/usr/lib/python3/dist-packages/PIL/IcnsImagePlugin.py�
nextheaderr$s���=�=�����:�!6�7�7�c��|\}}|j|�|jd�}|dk7r
d}t|��t||dz|dz
f|�S)N�sz'Unknown signature, expecting 0x00000000)�seekr�SyntaxError�read_32)r�start_length�size�start�length�sig�msgs       r�read_32tr (sY��"�O�U�F��I�I�e��
�)�)�A�,�C�
�!�!�7���#����4�%�!�)�V�a�Z�0�$�7�7rc
�B�|\}}|j|�|d|dz|d|dzf}|d|dz}||dzk(r0|j|�}tjd||dddd�}d|iStjd|d�}td�D�]}	g}
|}|dkDr�|jd�}|snx|d}|dzr8|d	z
}
|jd�}t|
�D]}|
j
|��n%|dz}
|
j
|j|
��||
z}|dkrn|dkDr��|dk7rd
t|��d�}t|��tjd|d
j|
�dddd�}|jj|j|	���
d|iS)zn
    Read a 32bit RGB icon resource.  Seems to be either uncompressed or
    an RLE packbits-like scheme.
    r�r��RGB�rawN��}zError reading channel [z left]�Lr)rrr�
frombuffer�new�range�append�reprr�join�im�putband)rrrrr�
pixel_size�sizesq�indatar/�band_ix�data�	bytesleft�byte�	blocksize�ir�bands                 rrr3s���
#�O�U�F��I�I�e���q�'�D��G�#�T�!�W�t�A�w�%6�7�J�
��]�Z��]�
*�F�
��!������6�"��
�
�
�e�Z����q�!�
L��8
�2�;��3�Y�Y�u�j�$�
/���Q�x�	,�G��D��I��a�-��y�y��|�����A�w���$�;� $�s�
�I��9�9�Q�<�D�"�9�-�*�����D�)�*�!%�q��I��K�K��	�	�)� 4�5��Y�&�	���>���a�-� �A�~�/��Y��/@��G��!�#�&�&��#�#�C��S�X�X�d�^�U�C�QR�TU�V�D��E�E�M�M�$�'�'�7�+�/	,�0
�2�;�rc	���|d}|j|�|d|dz|d|dzf}|d|dz}tjd||j|�dddd�}d|iS)Nrr"rr(r%�A)rrr)r)rrrrr1r2r:s       r�read_mkr=^s|����O�E��I�I�e���q�'�D��G�#�T�!�W�t�A�w�%6�7�J�
��]�Z��]�
*�F����C��T�Y�Y�v�->��s�A�q�Q�D���;�rc�z�|\}}|j|�|jd�}|dddk(rI|j|�tj|�}t	j
|j�d|iS|dddk(s
|dddk(s|dk(r�ts
d	}t|��|j|�|j|�}tj|�}	tj|	�}t	j
|j�|jdk7r|jd�}d|iSd
}t|��)N�rs�PNG

�RGBArs�O�Qs
�
sjP  
�
zQUnsupported icon subimage format (rebuild PIL with JPEG 2000 support to fix this)z Unsupported icon subimage format)rrr�PngImageFiler�_decompression_bomb_checkr�
enable_jpeg2k�
ValueError�io�BytesIOr
�Jpeg2KImageFile�mode�convert)
rrrrrrr/r�
jp2kstream�fs
          r�read_png_or_jpeg2000rLhs(��"�O�U�F��I�I�e��
�)�)�B�-�C�
�2�A�w�,�,��	�	�%��
�
(�
(��
.��
�'�'����0���|���B�Q��&�&��r��7�)�)��9�9��6�
��S�/�!��	�	�%���Y�Y�v�&�
��J�J�z�"��
�
.�
.�q�
1��
�'�'����0�
�7�7�f�����F�#�B���|��0����o�rc��eZdZdefgdefgdefgdefgdefgdefdefdefgd	efgd
efgdefdefgd
efdefdefgdefgdefdefdefgd�Zd�Zd�Z	d�Z
d�Zdd�Zy)�IcnsFile�ic10�ic09�ic14�ic08�ic13�ic07sit32st8mksicp6�ic12sih32sh8mksicp5sil32sl8mk�ic11sicp4sis32ss8mk))�rWr")rWrWr)�rXr")rXrXr)r&r&r")r&r&r)�@rYr)� rZr")�0r[r)rZrZr)�r\r")r\r\rc�P�ix|_}||_t|�\}}t|�s
d}t	|��t
}||kret|�\}}|dkr
d}t	|��|t
z
}|t
z}||f||<|j
|tj�||z
}||kr�dyy)z@
        fobj is a file-like object as an icns resource
        znot an icns filerzinvalid block headerN)	�dctrr�_acceptrrrrE�SEEK_CUR)�selfrr^r�filesizerr9r8s        r�__init__zIcnsFile.__init__�s���
����3���	�"�4�(�
��X��s�|�$�C��c�"�"����(�l�'��-�N�C���A�~�,��!�#�&�&�
��O�A���#�I��9�~�C��H��I�I�i����-�
��N�A��(�lrc��g}|jj�D]0\}}|D]&\}}||jvs�|j|��0�2|S�N)�SIZES�itemsr^r,)ra�sizesr�fmts�fmt�readers      r�	itersizeszIcnsFile.itersizes�s[�����*�*�*�*�,�	�J�D�$�#�
���V��$�(�(�?��L�L��&��
�	�
�rc�V�|j�}|s
d}t|��t|�S)NzNo 32bit icon resources found)rlr�max)rarhrs   r�bestsizezIcnsFile.bestsize�s+����� ���1�C��c�"�"��5�z�rc��i}|j|D]F\}}|jj|�}|��$|j||j||���H|S)z�
        Get an icon resource as {channel: array}.  Note that
        the arrays are bottom-up like windows bitmaps and will likely
        need to be flipped or transposed in some way.
        )rfr^�get�updater)rarr^�coderk�descs      r�dataforsizezIcnsFile.dataforsize�s]���� �J�J�t�,�	:�L�D�&��8�8�<�<��%�D����
�
�6�$�)�)�T�4�8�9�	:��
rNc�2�|�|j�}t|�dk(r|d|ddf}|j|�}|jdd�}|r|S|jd�j	�}	|j|d�|S#t$rY|SwxYw)Nr"rrr@r$r<)ro�lenrurq�copy�putalpha�KeyError)rar�channelsr/s    r�getimagezIcnsFile.getimage�s����<��=�=�?�D��t�9��>���G�T�!�W�a�(�D��#�#�D�)��
�\�\�&�$�
'��
��I�
�\�\�%�
 �
%�
%�
'��	��K�K���
�&��	���	���	�	�s�3B	�		B�Bre)
�__name__�
__module__�__qualname__rLr r=rrfrcrlrorur|�rrrNrN�s��� �"6�7�8� �"6�7�8� �"6�7�8� �"6�7�8� �"6�7�8�
�*�+�
�h��
�g��
�
� 4�5�6�� 4�5�6���(�7�G�*<�=�
�*�+�
�g��
�g��
�
� 4�5�6�
�*�+�
�g��
�g��
�)
�E�6�.���rrNc�X�eZdZdZdZdZd�Zed��Zejd��Zd�Z
y)	�
IcnsImageFilea!
    PIL image support for Mac OS .icns files.
    Chooses the best resolution, but will possibly load
    a different size image if you mutate the size attribute
    before calling 'load'.

    The info dictionary has a key 'sizes' that is a list
    of sizes that the icns file has.
    �ICNSzMac OS icns resourcec�X�t|j�|_d|_|jj	�|j
d<|jj
�|_|jd|jdz|jd|jdzf|_y)Nr@rhrr"r)	rN�fp�icns�_moderl�inforo�	best_sizer�ras r�_openzIcnsImageFile._open�s����T�W�W�%��	���
�!�Y�Y�0�0�2��	�	�'�����+�+�-����N�N�1�����q� 1�1��N�N�1�����q� 1�1�
��	rc��|jSre)�_sizer�s rrzIcnsImageFile.size	s���z�z�rc��|}||jdvrt|�dk(r|d|ddf}||jdvrkt|�dk(r]|ddk(rU|jdD�cgc]}|d|dz|d|dzf��}}||vr!|jd|j|�}||jdvr
d}t|��||_ycc}w)Nrhr"rrr#z2This is not one of the allowed sizes of this image)r�rw�indexrDr�)ra�value�	info_sizer�simple_sizesrs      rrzIcnsImageFile.size
s����	��D�I�I�g�.�.�3�y�>�Q�3F�"�1��y��|�Q�7�I��T�Y�Y�w�/�/��I��!�#��!���!�DH�9�9�W�CU��;?��a��4��7�"�D��G�d�1�g�$5�6��L����$� �I�I�g�.�|�/A�/A�%�/H�I�	��D�I�I�g�.�.�F�C��S�/�!���
��s�%Cc�n�t|j�dk(rT|j|_|jd|jdz|jd|jdzf|_tjj	|�}|j
�%|j
j|jk(r|S|j
�|jj|j�}|j	�}|j
|_|j|_
|j|_|S)Nr#rr"r)rwrr�r�loadr/�load_preparer�r|rHr�)ra�pxr/s   rr�zIcnsImageFile.load!s����t�y�y�>�Q��!�Y�Y�D�N����q�!�D�N�N�1�$5�5����q�!�D�N�N�1�$5�5��D�I�
�[�[�
�
�d�
#���7�7��4�7�7�<�<�4�9�9�#<��I�����
�Y�Y�
�
����
/���W�W�Y���%�%����W�W��
��G�G��	��	rN)r}r~r�__doc__�format�format_descriptionr��propertyr�setterr�r�rrr�r��sJ����F�/��
�����
�[�[����&rr�c	��t|d�r|j�ddddddddd�}|jjd	g�D�cic]}|j|��}}i}t|j
��D]W}||vr||nj||f�}tj�}|j|d
�|j�||<�Yg}	|j�D]/\}
}||}|	j|
tt|�z|d���1|j!t"�t}|tdt|	�zzz
}|t%d
�|	D��z
}|j!t'j(d|��|j!d�|j!t'j(dtt|	�tzz��|	D]>}
|j!|
d�|j!t'j(d|
d���@|	D]R}
|j!|
d�|j!t'j(d|
d��|j!|
d��Tt|d�r|j�yycc}w)za
    Saves the image as a series of PNG files,
    that are then combined into a .icns file.
    �flushr&rXrWirZrY)rTrRrPrOrVrUrSrQ�
append_images�png)�typer�streamrc3�&K�|]	}|d���y�w)rNr�)�.0�entrys  r�	<genexpr>z_save.<locals>.<genexpr>es����:��u�V�}�:�s�z>isTOC r�rr�N)�hasattrr��encoderinforq�width�set�values�resizerErF�save�getvaluergr,rrw�write�MAGIC�sumr
�pack)r/r��filenamerh�provided_images�size_streamsr�image�temp�entriesr�r��file_lengthr�s              r�_saver�;sS��
�r�7��
���
���������	
�E�/1�n�n�.@�.@��RT�.U�V��r�x�x��|�V�O�V��L��E�L�L�N�#�	-����&�
�D�!����D�$�<�(�	��z�z�|��
�
�
�4���!�]�]�_��T��	-��G��k�k�m�
�
��d��d�#������:��F��#;�v�N�	
�
��H�H�U�O��K��:��C��L� 0�0�0�K��3�:�'�:�:�:�K��H�H�V�[�[��{�
+�,��H�H�W���H�H�V�[�[��z�C��L�:�,E�E�
F�G��3��
����v���
������T�5��=�1�2�3�
�"��
����v���
������T�5��=�1�2�
����x��!�"�
�r�7��
���
���QWs�Jc��|ddtk(S)Nr)r�)�prefixs rr_r_ys���"�1�:���rz.icnsz
image/icns�__main__r"z)Syntax: python3 IcnsImagePlugin.py [file]�rbrhzout-�-z.pngzout.png�windows)/�
__future__rrE�osr
�sys�rrrr�check_codecrCr
r�rrr rr=rLrNr�r�r_�
register_openr��register_extension�
register_save�
register_mimer}rw�argv�print�exit�openr��imfr�rr��height�scaler�r/�platform�	startfiler�rr�<module>r�s���&#�	�	�
�
�8�8�$��$�$�Z�0�
��#���
�
�8�8�(�V��D`�`�NG�I�'�'�G�T;�|�����M�(�(�-��A������-�-�w�7�����M�(�(�%�0�����M�(�(�,�7��z��
�3�8�8�}�q��
�9�:�����
�	
�c�h�h�q�k�4�	 �$�B��B����H�H�W�%�	:�D�.2�2� �E�6�5�3�8��H�H�t�E�7�!�F�8�1�U�G�4�8�9�	:��U�Z�Z������
$�	���G�G�I��	��<�<�9�$��B�L�L��#�$�$��	�	��$�$�s%�3A$G(�G�))G(�G%	�!G(�(G1

Zerion Mini Shell 1.0