File: //usr/lib/python3/dist-packages/PIL/__pycache__/DdsImagePlugin.cpython-38.pyc
U
g�
^Z � @ sp d Z ddlZddlmZ ddlmZmZ dZdZdZ dZ
d Zd
ZdZ
dZd
Zd Zd
ZdZdZdZdZd
ZdZdZdZdZdZdZdZdZdZdZ eZ!eZ"eeB Z#e Z$e eB Z%eZ&eZ'ee B e
B eB Z(e
Z)eZ*eZ+eZ,e Z-e
Z.eZ/eeB Z0eZ1eeB Z2eeB Z3eeB Z4eeB Z5eeB Z6eeB Z7dZ8dZ9dZ:dZ;dZ<dZ=G dd� dej�Z>d d!� Z?e�@e>jAe>e?� e�Be>jAd"� dS )#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/
� N)�BytesIO� )�Image� ImageFileiDDS � � � i i i i � i @ i i i i i @ i � i � �@ iDXT1iDXT3iDXT5�a �b �c c @ s$ e Zd ZdZdZdd� Zdd� ZdS )�DdsImageFileZDDSzDirectDraw Surfacec C s\ t �d| j�d��\}}|dkr,td| ��| j�|d �}t|�dkrXtdt|� ��t|�}t �d|�d ��\}}}||f| _d
| _t �d|�d ��\}} }
t �d|�d�� t �d
|�d��\}}|�d�}
t �d|�d��\}t �d|�d��}|d@ �rhdd� t |�D �}d}|dk�r.||d 7 }||d |d |d 7 }dd| j
d|ddffg| _n�|d }d}|
dk�r�d| _d}n�|
d k�r�d!| _d"}n�|
d#k�r�d$| _d%}n�|
d&k�r6|d'7 }t| j�d'��}t �d|�d��\}}|t
tfk�rd(| _d)}n,|tk�r(d(| _d*| jd+<