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

�

��e�@��@�dZddlmZddlZddlZddlZddlmZmZddl	m
Z
mZmZddl
mZddl
mZdd	l
mZd
ZGd�de�ZGd
�de�ZGd�de�ZGd�de�ZGd�de�ZGd�de�Zej4eZeD]#Zeedej>zej@��%eD]#Zeedej>zej@��%eD]#Zeedej>zej@��%eD]#Zeedej>zej@��%ejBZ"ejFZ$ejFejJzZ&ejNZ(ejNejJzZ)ejTZ+ejXZ-ej\ej^zej`zejbzZ2ejfZ4ejjZ6ejnZ8ejrZ:ej^Z;ej`Z<ejzZ>ej~ej�zZAej~ZBej�ej�zZEej�ej�zZGej�ej�zZIej�ej�zZKej�ej�zZMej�ej�zZOej�ZQej�ZSej�ZUej�ZWej�ZYej�Z[ej�Z]ej�Z_ej�Zaej�Zcej�Zeej�Zgej�Ziej�ZkGd�dej�ZlGd�dej��Znd�Zod �Zpe
j�elj�elep�e
j�d!en�e
j�elj�eo�e
j�elj�d"�y)#a�
A Pillow loader for .dds files (S3TC-compressed aka DXTC)
Jerome Leclanche <jerome@leclan.ch>

Documentation:
https://web.archive.org/web/20170802060935/http://oss.sgi.com/projects/ogl-sample/registry/EXT/texture_compression_s3tc.txt

The contents of this file are hereby released in the public domain (CC0)
Full text of the CC0 license:
https://creativecommons.org/publicdomain/zero/1.0/
�)�annotationsN)�IntEnum�IntFlag�)�Image�	ImageFile�ImagePalette)�i32le)�o8)�o32leiDDS c�,�eZdZdZdZdZdZdZdZdZ	dZ
y	)
�DDSDr�����ii�N)�__name__�
__module__�__qualname__�CAPS�HEIGHT�WIDTH�PITCH�PIXELFORMAT�MIPMAPCOUNT�
LINEARSIZE�DEPTH���4/usr/lib/python3/dist-packages/PIL/DdsImagePlugin.pyrrs*���D�
�F��E��E��K��K��J��Er rc��eZdZdZdZdZy)�DDSCAPSrri@N)rrr�COMPLEX�TEXTURE�MIPMAPrr r!r#r#)s���G��G�
�Fr r#c�,�eZdZdZdZdZdZdZdZdZ	dZ
y	)
�DDSCAPS2i�iri i@i�i N)rrr�CUBEMAP�CUBEMAP_POSITIVEX�CUBEMAP_NEGATIVEX�CUBEMAP_POSITIVEY�CUBEMAP_NEGATIVEY�CUBEMAP_POSITIVEZ�CUBEMAP_NEGATIVEZ�VOLUMErr r!r(r(/s0���G�������������
�Fr r(c�$�eZdZdZdZdZdZdZdZy)�DDPFrrr� �@rN)	rrr�ALPHAPIXELS�ALPHA�FOURCC�PALETTEINDEXED8�RGB�	LUMINANCErr r!r3r3;s ���K��E�
�F��O�
�C��Ir r3c���eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Z<d;Z=d<Z>d=Z?d>Z@d?ZAd@ZBdAZCdBZDdCZEdDZFdEZGdFZHdGZIdHZJdIZKdJZLdKZMdLZNdMZOdNZPdOZQdPZRdQZSdRZTdSZUdTZVdUZWdVZXdWZYdXZZdYZ[dZZ\d[Z]d\Z^d]Z_d^Z`d_Zad`ZbdaZcdbZddcZeddZfdeZgdfZhdgZidhZjdiZkdjZldkZmdlZndmZodnZpdoZqdpZrdqZsdrZtdsZudtZvduZwdvZxdwZydxZzdyZ{yz){�DXGI_FORMATrrr�r���r�	�
���
������������������r4�!�"�#�$�%�&�'�(�)�*�+�,�-�.�/�0�1�2�3�4�5�6�7�8�9�:�;�<�=�>�?r5�A�B�C�D�E�F�G�H�I�J�K�L�M�N�O�P�Q�R�S�T�U�V�W�X�Y�Z�[�\�]�^�_�`�a�b�c�d�e�f�g�h�i�j�k�l�m�n�o�p�q�r�s�����N)|rrr�UNKNOWN�R32G32B32A32_TYPELESS�R32G32B32A32_FLOAT�R32G32B32A32_UINT�R32G32B32A32_SINT�R32G32B32_TYPELESS�R32G32B32_FLOAT�R32G32B32_UINT�R32G32B32_SINT�R16G16B16A16_TYPELESS�R16G16B16A16_FLOAT�R16G16B16A16_UNORM�R16G16B16A16_UINT�R16G16B16A16_SNORM�R16G16B16A16_SINT�R32G32_TYPELESS�R32G32_FLOAT�R32G32_UINT�R32G32_SINT�R32G8X24_TYPELESS�D32_FLOAT_S8X24_UINT�R32_FLOAT_X8X24_TYPELESS�X32_TYPELESS_G8X24_UINT�R10G10B10A2_TYPELESS�R10G10B10A2_UNORM�R10G10B10A2_UINT�R11G11B10_FLOAT�R8G8B8A8_TYPELESS�R8G8B8A8_UNORM�R8G8B8A8_UNORM_SRGB�
R8G8B8A8_UINT�R8G8B8A8_SNORM�
R8G8B8A8_SINT�R16G16_TYPELESS�R16G16_FLOAT�R16G16_UNORM�R16G16_UINT�R16G16_SNORM�R16G16_SINT�R32_TYPELESS�	D32_FLOAT�	R32_FLOAT�R32_UINT�R32_SINT�R24G8_TYPELESS�D24_UNORM_S8_UINT�R24_UNORM_X8_TYPELESS�X24_TYPELESS_G8_UINT�
R8G8_TYPELESS�
R8G8_UNORM�	R8G8_UINT�
R8G8_SNORM�	R8G8_SINT�R16_TYPELESS�	R16_FLOAT�	D16_UNORM�	R16_UNORM�R16_UINT�	R16_SNORM�R16_SINT�R8_TYPELESS�R8_UNORM�R8_UINT�R8_SNORM�R8_SINT�A8_UNORM�R1_UNORM�R9G9B9E5_SHAREDEXP�R8G8_B8G8_UNORM�G8R8_G8B8_UNORM�BC1_TYPELESS�	BC1_UNORM�BC1_UNORM_SRGB�BC2_TYPELESS�	BC2_UNORM�BC2_UNORM_SRGB�BC3_TYPELESS�	BC3_UNORM�BC3_UNORM_SRGB�BC4_TYPELESS�	BC4_UNORM�	BC4_SNORM�BC5_TYPELESS�	BC5_UNORM�	BC5_SNORM�B5G6R5_UNORM�B5G5R5A1_UNORM�B8G8R8A8_UNORM�B8G8R8X8_UNORM�R10G10B10_XR_BIAS_A2_UNORM�B8G8R8A8_TYPELESS�B8G8R8A8_UNORM_SRGB�B8G8R8X8_TYPELESS�B8G8R8X8_UNORM_SRGB�
BC6H_TYPELESS�	BC6H_UF16�	BC6H_SF16�BC7_TYPELESS�	BC7_UNORM�BC7_UNORM_SRGB�AYUV�Y410�Y416�NV12�P010�P016�
OPAQUE_420�YUY2�Y210�Y216�NV11�AI44�IA44�P8�A8P8�B4G4R4A4_UNORM�P208�V208�V408�SAMPLER_FEEDBACK_MIN_MIP_OPAQUE�'SAMPLER_FEEDBACK_MIP_REGION_USED_OPAQUErr r!r=r=Es~���G������������O��N��N��������������O��L��K��K�����!�� ���������O����N����M��N��M��O��L��L��K��L��K��L��I��I��H��H��N��������M��J��I��J��I��L��I��I��I��H��I��H��K��H��G��H��G��H��H����O��O��L��I��N��L��I��N��L��I��N��L��I��I��L��I��I��L��N��N��N�!#�����������M��I��I��L��I��N��D��D��D��D��D��D��J��D��D��D��D��D��D�	�B��D��N��D��D��D�&)�#�.1�+r r=c��eZdZdZdZdZdZdZdZdZ	dZ
d	Zd
ZdZ
dZd
ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9e:d8�Z;e:d9�Z<e:d:�Z=e:d;�Z>e:d<�Z?e:d=�Z@e:d>�ZAe:d?�ZBe:d@�ZCe:dA�ZDe:dB�ZEe:dC�ZFe:dD�ZGe:dE�ZHe:dF�ZIe:dG�ZJe:dH�ZKyI)J�D3DFMTrrMrNrOrPrQrRrSrTrUrVrWrXr4rYrZr[r\r`rarjrkrlrtrurvrwr5rzr}r~r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r�r��t�u�v�w��sUYVYsRGBGsYUY2sGRGBsDXT1sDXT2sDXT3sDXT4sDXT5sDX10sBC4SsBC4UsBC5SsBC5UsATI1sATI2sMET1N)Lrrrr��R8G8B8�A8R8G8B8�X8R8G8B8�R5G6B5�X1R5G5B5�A1R5G5B5�A4R4G4B4�R3G3B2�A8�A8R3G3B2�X4R4G4B4�A2B10G10R10�A8B8G8R8�X8B8G8R8�G16R16�A2R10G10B10�A16B16G16R16r"r!�L8�A8L8�A4L4�V8U8�L6V5U5�X8L8V8U8�Q8W8V8U8�V16U16�A2W10V10U10�D16_LOCKABLE�D32�D15S1�D24S8�D24X8�D24X4S4�D16�
D32F_LOCKABLE�D24FS8�D32_LOCKABLE�S8_LOCKABLE�L16�
VERTEXDATA�INDEX16�INDEX32�Q16W16V16U16�R16F�G16R16F�
A16B16G16R16F�R32F�G32R32F�
A32B32G32R32F�CxV8U8�A1�A2B10G10R10_XR_BIAS�BINARYBUFFER�i32�UYVY�	R8G8_B8G8r�	G8R8_G8B8�DXT1�DXT2�DXT3�DXT4�DXT5�DX10�BC4S�BC4U�BC5S�BC5U�ATI1�ATI2�MULTI2_ARGB8rr r!r*r*�s����G�
�F��H��H�
�F��H��H��H�
�F�	�B��H��H��K��H��H�
�F��K��L�
�D�	�B�	�B�
�D�
�D�
�D�
�F��H��H�
�F��K��L�
�C��E��E��E��G�
�C��M�
�F��L��K�
�C��J��G��G��L��D��G��M��D��G��M�
�F�	�B����L��w�<�D��G��I��w�<�D��G��I��w�<�D��w�<�D��w�<�D��w�<�D��w�<�D��w�<�D��w�<�D��w�<�D��w�<�D��w�<�D��w�<�D��w�<�D��w�<�Lr r*�DDSD_�DDSCAPS_�	DDSCAPS2_�DDPF_c� �eZdZdZdZd�Zd�Zy)�DdsImageFile�DDSzDirectDraw Surfacec�
�t|jjd��s
d}t|��t	j
d|jjd��\}|dk7rdt
|���}t|��|jj|dz
�}t|�dk7rdt|��d�}t|��tj|�}t	j
d	|jd
��\}}}||f|_d|jz}t	j
d	|jd
��\}	}
}t	j
d|jd
��t	j
d|jd��\}}
}}d}d}|
tjzra|
tjzr
d|_d}n	d|_d}t	j
d|�d�|j|dz��}d|d||ffg|_y|
tj$zrB|dk(r	d|_�n|dk(r|
tjzr	d|_�n�d|�d|
��}t|��|
tj&zr=d|_t)j*d|jjd��|_�n||
tj.z�rX|dz}|t0j2k(rd|_d|_d}�n>|t0j6k(rd|_d |_d!}�n|t0j8k(rd|_d"|_d}�n�|t0j:t0j<fvrd|_d#|_d}�n�|t0j>k(rd|_d$|_d%}�n�|t0j@t0jBfvrd|_d&|_d%}�ng|t0jDk(�r*|d'z
}t	j
d|jjd��\}|jjd�|tFjHtFjJfvrd|_d(|_d}�n�|tFjLtFjNfvrd|_d#|_d}�n�|tFjPtFjRfvrd|_d&|_d%}�nf|tFjTk(rd|_d$|_d%}�nA|tFjVk(rd|_d)|_d*}�n|tFjXk(rd|_d+|_d*}n�|tFjZtFj\tFj^fvr3d|_d,|_d-}|tFj^k(r�d.|j`d/<n�|tFjbtFjdtFjffvr*d|_|tFjfk(rId.|j`d/<n9d0|��}ti|��d1t
|���}ti|��d2|
��}ti|��|r+tkjld3|||j4f�g|_ytkjld4|d|xs|jn�g|_y)5Nrznot a DDS filez<I�|zUnsupported header size �xzIncomplete header: z bytesz<3IrE�rrz<11Ird�<4IrIr�RGBAr:r>�<�I�dds_rgbr�L�LAzUnsupported bitcount z for �Pr)rhrrjrrl�BC4rpr?�BC5rM�BC1�BC6Hr@�BC6HS�BC7rAg]t�E�?�gammazUnimplemented DXGI format zUnimplemented pixel format zUnknown pixel format flags �bcn�raw)8�_accept�fp�read�SyntaxError�struct�unpack�repr�OSError�len�io�BytesIO�_size�sizer3r:r6�_mode�tiler;r9r	r��paletter8r*rh�pixel_formatrjrlrorrrprqrsrmr=r�r�r�rrrrrrrrr�infor�r�r��NotImplementedErrorr�_Tile�mode)�self�msg�header_size�header_bytes�header�flags�height�width�extents�pitch�depth�mipmaps�pfsize�pfflags�fourcc�bitcount�n�rawmode�
mask_count�masks�offset�dxgi_formats                      r!�_openzDdsImageFile._openIs����t�w�w�|�|�A��'�"�C��c�"�"����t�T�W�W�\�\�!�_�=����#��,�T�+�->�,?�@�C��#�,���w�w�|�|�K�!�O�4���|���#�'��L�(9�':�&�A�C��#�,�����L�)��%�}�}�U�F�K�K��O�D���v�u��V�_��
��4�9�9�$�� &�
�
�e�V�[�[��_� E���u�g��
�
�f�f�k�k�"�o�.�-3�M�M�%����R��,Q�)�����
�����T�X�X����)�)�)�#��
��
�"��
��
��M�M�A�j�\��"3�V�[�[��a��5P�Q�E�#�W�a�(�E�1B�C�D�D�I��
�t�~�~�
%��1�}� ��
��R��G�d�.>�.>�$>�!��
�-�h�Z�u�W�I�F���c�l�"�
�t�+�+�
+��D�J�'�+�+�F�D�G�G�L�L��4F�G�D�L�
�t�{�{�
"� �1�_�F�����$�#��
�$*��!����6�;�;�&�#��
�$*��!����6�;�;�&�#��
�$*��!����F�K�K����5�5� ��
�$)��!����6�;�;�&�"��
�$*��!����F�K�K����5�5�"��
�$)��!����6�;�;�&��"���!'���t�T�W�W�\�\�!�_�!E��������R� ���)�)��,�,�#��"(�D�J�(-�D�%��A� �[�%=�%=�{�?T�?T�$U�U�!$�D�J�(-�D�%��A� �[�%=�%=�{�?T�?T�$U�U�!&�D�J�(-�D�%��A� �K�$9�$9�9�!&�D�J�(.�D�%��A� �K�$9�$9�9�!&�D�J�(.�D�%��A� �K�$9�$9�9�!&�D�J�(/�D�%��A� ��,�,��)�)��.�.�%��
"(�D�J�(-�D�%��A�"�k�&@�&@�@�-4��	�	�'�*� ��1�1��.�.��3�3�%��
"(�D�J�"�k�&E�&E�E�-4��	�	�'�*�6�{�m�D�C�-�c�2�2�3�D��L�>�B��)�#�.�.�/��y�9�C�%�c�*�*������w���D�<M�<M�8N�O��D�I�#������G�<P�t�y�y�Q�R�D�Ir c��y)Nr)r��poss  r!�	load_seekzDdsImageFile.load_seek�s��r N)rrr�format�format_descriptionr�r�rr r!rzrzEs��
�F�-��KS�Z
r rzc��eZdZdZd�Zy)�
DdsRgbDecoderTc	�"�|j\}}g}g}|D]V}d}|dk7r(||dzz	|dzz|k(r|dz
}||dzz	|dzz|k(r�|j|�|j||z	��Xt�}|dz}	t|�|jj
|jjzt|�zkr�tj|jj|	�d�}
t|�D]0\}}|
|z}|tt|||z	||zdz��z
}�2t|�|jj
|jjzt|�zkr��|jt|��y)Nrrr�little�)���r)�args�append�	bytearrayr��state�xsize�ysize�int�
from_bytes�fdr��	enumerater�
set_as_raw�bytes)
r��bufferr�r��mask_offsets�mask_totals�maskr��data�	bytecount�value�i�masked_values
             r!�decodezDdsRgbDecoder.decode�s����)�)���%������	/�D��F��q�y��v��z�*�v��z�:�d�B��a�K�F��v��z�*�v��z�:�d�B�����'����t�v�~�.�
	/��{����M�	��$�i�$�*�*�*�*�T�Z�Z�-=�-=�=��E�
�J�J��N�N�4�7�7�<�<�	�#:�H�E�E�$�U�+�
���4�$�t�|�����,�,�q�/�9�[��^�K�s�R�S����
��$�i�$�*�*�*�*�T�Z�Z�-=�-=�=��E�
�J�J�	
����d��$�r N)rrr�	_pulls_fdr�rr r!r�r��s���I�r r�c
��|jdvrd|j�d�}t|��|jddk(}|jddk(r(tj}|j}|rgd�}n\gd	�}nWtj}|jddd�}gd
�}|r/|j�\}}	}
}t
jd|||	|
f�}|r|tjz}|j|rdnd�tjtjztjztjztjz}t!|j#��d
z}
|j$|
zdzd
z}|j't)t*�t-j.dd||j0|j$|dd�zt-j.dgd���zt-j.dd|d|
�zt-j.dg|���zt-j.dt2j4dddd�z�t7j8||t7j:dd|j<zd|ddf�g�y)N)r:r�r�r�zcannot write mode z as DDSr��Arr�)r�r�r�)�~r�r�)i�i�r�r�r�rrAz<7Ir}�11I)rrrrrrrrrrrr�r4z<5Ir�rr)r�r�r3r;r:�splitr�merger6r�rrrrrrr��getbandsr��write�o32�	DDS_MAGICr��packr�r#r%r�_saver�r�)�imr��filenamer��alpha�pixel_flagsr��	rgba_mask�r�g�b�ar�r�r�s               r!r�r��s ��	�w�w�0�0�"�2�7�7�)�7�3���c�l���G�G�B�K�3��E�	�w�w�q�z�S���n�n���'�'���<�I�<�I��h�h���'�'�$�B�$�-��8�	������J�A�q�!�Q����V�a��A�q�\�2�B���t�'�'�'��
���5�Z�a�0��I�I����#�d�j�j�0�4�:�:�=��@P�@P�P�E��2�;�;�=�!�A�%�H�
�X�X��
 �1�
$��*�E��H�H��I��
�+�+�����I�I��H�H��
�
�	
�
	
��+�+�e�
*�y�
*�	+��+�+�e�R��a��
:�
	;��+�+�e�
(�i�
(�	)��+�+�e�W�_�_�a��A�q�
9�	:��$�O�O�
�B���������(8�!�g�q�!�_�M�N�r c��|dddk(S)NrsDDS r)�prefixs r!r�r�/s���"�1�:�� � r r�z.dds)v�__doc__�
__future__rr�r��sys�enumrr�rrr	�_binaryr
rdrrr�r�rr#r(r3r=r*�modulesr�module�item�setattr�namer�r8�
DDS_FOURCCr:�DDS_RGBr6�DDS_RGBAr;�
DDS_LUMINANCE�DDS_LUMINANCEAr7�	DDS_ALPHAr9�DDS_PAL8rrrr�DDS_HEADER_FLAGS_TEXTUREr�DDS_HEADER_FLAGS_MIPMAPr�DDS_HEADER_FLAGS_VOLUMEr�DDS_HEADER_FLAGS_PITCHr�DDS_HEADER_FLAGS_LINEARSIZE�
DDS_HEIGHT�	DDS_WIDTHr%�DDS_SURFACE_FLAGS_TEXTUREr$r&�DDS_SURFACE_FLAGS_MIPMAP�DDS_SURFACE_FLAGS_CUBEMAPr*r+�DDS_CUBEMAP_POSITIVEXr,�DDS_CUBEMAP_NEGATIVEXr-�DDS_CUBEMAP_POSITIVEYr.�DDS_CUBEMAP_NEGATIVEYr/�DDS_CUBEMAP_POSITIVEZr0�DDS_CUBEMAP_NEGATIVEZrh�DXT1_FOURCCrj�DXT3_FOURCCrl�DXT5_FOURCCr��DXGI_FORMAT_R8G8B8A8_TYPELESSr��DXGI_FORMAT_R8G8B8A8_UNORMr��DXGI_FORMAT_R8G8B8A8_UNORM_SRGBr�DXGI_FORMAT_BC5_TYPELESSr�DXGI_FORMAT_BC5_UNORMr�DXGI_FORMAT_BC5_SNORMr�DXGI_FORMAT_BC6H_UF16r�DXGI_FORMAT_BC6H_SF16r�DXGI_FORMAT_BC7_TYPELESSr�DXGI_FORMAT_BC7_UNORMr�DXGI_FORMAT_BC7_UNORM_SRGBrz�	PyDecoderr�r�r��
register_openr��register_decoder�
register_save�register_extensionrr r!�<module>r+s���
�#�	�
�
�!�,�,�!��!�
�	��7���g���w���7��y2�'�y2�xI �W�I �Z

���X�	���5�D��F�G�d�i�i�'����4�5��8�D��F�J����*�D�J�J�7�8��9�D��F�K�$�)�)�+�T�Z�Z�8�9��5�D��F�G�d�i�i�'����4�5��[�[�
�
�(�(���8�8�d�&�&�&�����
����$�"2�"2�2���J�J�	������9�9�t�{�{�2�T�Z�Z�?�$�BR�BR�R���*�*���*�*������"�o�o��
�[�[�
��J�J�	�#�O�O��"�?�?�W�^�^�;��#�O�O�� �(�(�8�+E�+E�E�� �(�(�8�+E�+E�E�� �(�(�8�+E�+E�E�� �(�(�8�+E�+E�E�� �(�(�8�+E�+E�E�� �(�(�8�+E�+E�E���k�k���k�k���k�k�� +� =� =��(�7�7��"-�"A�"A��&�3�3��#�-�-��#�-�-��#�-�-��#�-�-��&�3�3��#�-�-��(�7�7��R
�9�&�&�R
�j�I�'�'��B1�h!�����L�'�'��w�?�����y�-�0�����L�'�'��/������,�,�f�5r 

Zerion Mini Shell 1.0