403Webshell
Server IP : 127.0.0.1  /  Your IP : 216.73.216.109
Web Server : Apache/2.4.54 (Win64) OpenSSL/1.1.1q PHP/8.1.10
System : Windows NT DESKTOP-E5T4RUN 10.0 build 19045 (Windows 10) AMD64
User : SERVERWEB ( 0)
PHP Version : 8.1.10
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : OFF |  Perl : OFF |  Python : OFF |  Sudo : OFF |  Pkexec : OFF
Directory :  C:/cygwin64/lib/python3.9/site-packages/PIL/__pycache__/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : C:/cygwin64/lib/python3.9/site-packages/PIL/__pycache__/BlpImagePlugin.cpython-39.pyc
a

h�a�8�@s�dZddlZddlmZddlmZmZdZdZdZ	dZ
dZdZdZ
d	d
�Zd!dd
�Zdd�Zdd�ZGdd�de�ZGdd�dej�ZGdd�dej�ZGdd�de�ZGdd�de�Zdd�Ze�ejee�e�ejd�e�de�e�d e�dS)"a�
Blizzard Mipmap Format (.blp)
Jerome Leclanche <jerome@leclan.ch>

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/

BLP1 files, used mostly in Warcraft III, are not fully supported.
All types of BLP2 files used in World of Warcraft are supported.

The BLP file structure consists of a header, up to 16 mipmaps of the
texture

Texture sizes must be powers of two, though the two dimensions do
not have to be equal; 512x256 is valid, but 512x200 is not.
The first mipmap (mipmap #0) is the full size image; each subsequent
mipmap halves both dimensions. The final mipmap should be 1x1.

BLP files come in many different flavours:
* JPEG-compressed (type == 0) - only supported for BLP1.
* RAW images (type == 1, encoding == 1). Each mipmap is stored as an
  array of 8-bit values, one per pixel, left to right, top to bottom.
  Each value is an index to the palette.
* DXT-compressed (type == 1, encoding == 2):
- DXT1 compression is used if alpha_encoding == 0.
  - An additional alpha bit is used if alpha_depth == 1.
  - DXT3 compression is used if alpha_encoding == 1.
  - DXT5 compression is used if alpha_encoding == 7.
�N)�BytesIO�)�Image�	ImageFile���cCs*|d?d@d>|d?d@d>|d@d>fS)N��r��?r�)�ir
r
�6/usr/lib/python3.9/site-packages/PIL/BlpImagePlugin.py�
unpack_5650srFc	Cs�t|�d}t�t�t�t�f}t|�D�]�}|d}t�d||�\}}}t|�\}	}
}t|�\}}
}td�D�]L}td�D�]<}|d@}|d?}d}|dkr�|	|
|}}}n�|dkr�||
|}}}n�|dk�r6||k�rd|	|d}d|
|
d}d||d}n$|	|d}|
|
d}||d}nR|dk�r�||k�r|d||	d}d|
|
d}d||d}nd	\}}}}|�r�||�||||g�q|||�|||g�q|qnq(|S)
�E
    input: one "row" of data (i.e. will produce 4*width pixels)
    �z<HHI�rr�rr)rrrr��len�	bytearray�range�struct�unpack_fromr�extend)�data�alpha�blocks�ret�block�idx�color0�color1�bits�r0�g0�b0�r1�g1�b1�jrZcontrol�a�r�g�br
r
r�decode_dxt14sD



r0c	Cs�t|�d}t�t�t�t�f}t|�D�]�}|d}|||d�}t�d|�}t�d|d�\}}t�d|d�\}t|�\}	}
}t|�\}}
}td�D�]2}d}td�D�]}d||d	}||}|r�d}|dL}nd
}|dM}|d9}|d	d||?d
@}|dk�r"|	|
|}}}n�|dk�r>||
|}}}nv|d	k�rzd	|	|d
}d	|
|
d
}d	||d
}n:|d
k�r�d	||	d
}d	|
|
d
}d	||d
}||�||||g�q�q�q(|S)r�z<8B�<HHr�<I�rFrT��rrrr)rrrr r!r$r"r#�coder%r&r'r(r)r*r+Zhighr�alphacode_indexr,�
color_coder-r.r/r
r
r�decode_dxt3ksH




r:c	Cs�t|�d}t�t�t�t�f}t|�D�]�}|d}|||d�}t�d|�\}}t�d|d�}|d|dd>B|dd>B|dd	>B}|d
|dd>B}	t�d|d�\}
}t�d
|d�\}t|
�\}
}}t|�\}}}td�D�]�}td�D�]�}dd||}|dk�r&|	|?d@}n0|dk�rF|	d?|d>d@B}n||d?d@}|d
k�rf|}nt|dk�rv|}nd||k�r�d|||d|d}n<|dk�r�d
}n,|dk�r�d}nd|||d|d}|dd||?d@}|d
k�r|
||}}}n�|dk�r*|||}}}nv|dk�rfd|
|d}d||d}d||d}n:|dk�r�d||
d}d||d}d||d}||�||||g�q�q�q(|S)zG
    input: one "row" of data (i.e. will produce 4 * width pixels)
    r1z<BBz<6Brrrrr�rrr2r3r4rr5�rr)rrrr r!Za0Za1r$Z
alphacode1Z
alphacode2r"r#r7r%r&r'r(r)r*r+rr8Z	alphacoder,r9r-r.r/r
r
r�decode_dxt5�s^,










r=c@seZdZdS)�BLPFormatErrorN)�__name__�
__module__�__qualname__r
r
r
rr>�sr>c@s(eZdZdZdZdZdd�Zdd�ZdS)	�BlpImageFilez 
    Blizzard Mipmap Format
    ZBLPzBlizzard Mipmap FormatcCs�|j�d�|_|��|jdkr,d}d|_n4|jdkrLd}|jrDdnd|_ntdt|j�����|d	|jd
|jd
dffg|_	dS)Nr�BLP1�BLP1ZRGB�BLP2�BLP2ZRGBAzBad BLP magic �rrrr)
�fp�read�magic�_read_blp_header�mode�_blp_alpha_depthr>�repr�size�tile)�self�decoderr
r
r�_open�s

zBlpImageFile._opencCs�t�d|j�d��\|_t�d|j�d��\|_t�d|j�d��\|_t�d|j�d��\|_t�d|j�d��\|_t�d|j�d��|_	|j
dkr�t�d|j�d��\|_t�d|j�d��\|_t�d|j�d	��|_t�d|j�d	��|_
dS�
Nz<irz<brz<IIrrCz<16I�@)r�unpackrHrI�_blp_compression�
_blp_encodingrM�_blp_alpha_encoding�	_blp_mips�_sizerJ�_blp_subtype�_blp_offsets�_blp_lengths�rQr
r
rrKs
zBlpImageFile._read_blp_headerN)r?r@rA�__doc__�formatZformat_descriptionrSrKr
r
r
rrB�s
rBc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_BLPBaseDecoderTc
Csdz.|j�d�|j�d�|_|��|��Wn0tjy^}ztd�|�WYd}~n
d}~00dS)NrrzTruncated Blp filerG)	�fd�seekrIrJrK�_loadr�error�OSError)rQ�buffer�er
r
r�decodes z_BLPBaseDecoder.decodecCst�|j|�S)N)r�
_safe_readrc)rQ�lengthr
r
rrk!sz_BLPBaseDecoder._safe_readc	Csbg}td�D]P}zt�d|�d��\}}}}WntjyHYq^Yn0|�||||f�q|S)N�z<4Br)rrrVrkrf�append)rQrrr/r.r-r,r
r
r�
_read_palette$sz_BLPBaseDecoder._read_palettecCs�t�d|�d��\|_t�d|�d��\|_t�d|�d��\|_t�d|�d��\|_t�d|�d��\|_t�d|�d��|_|j	dkr�t�d|�d��\|_t�d|�d��\|_
t�d|�d	��|_t�d|�d	��|_dSrT)
rrVrkrWrXrMrYrZrOrJr\r]r^r_r
r
rrK.s
z _BLPBaseDecoder._read_blp_headerN)r?r@rAZ	_pulls_fdrjrkrorKr
r
r
rrbs


rbc@seZdZdd�Zdd�ZdS)�BLP1Decoderc	Cs�|jtkr|��n�|jdkr�|jdvr�t�}|��}t|�|jd��}zt	�
d|�d��\}Wnt	jyzYq�Yn0||\}}}}|�
|||g�qJ|�t|��q�tdt|j�����ntdt|j�����dS)Nr)rrr�<BzUnsupported BLP encoding zUnsupported BLP compression )rW�BLP_FORMAT_JPEG�_decode_jpeg_streamrXrrorrkr^rrVrIrfr�
set_as_raw�bytesr>rN)	rQr�palette�_data�offsetr/r.r-r,r
r
rreBs(




��zBLP1Decoder._loadcCs�ddlm}t�d|�d��\}|�|�}|�|jd|j���|�|jd�}||}t	|�}||�}t
�|j�|j
|_
|j|_|j|_dS)Nr)�
JpegImageFiler3r)ZPIL.JpegImagePluginryrrVrkr]rc�tellr^rrZ_decompression_bomb_checkrOrPrHrL)rQryZjpeg_header_sizeZjpeg_headerrZimager
r
rrs]s
zBLP1Decoder._decode_jpeg_streamN)r?r@rArersr
r
r
rrpAsrpc@seZdZdd�ZdS)�BLP2DecodercCs(|��}t�}|j�|jd�|jdk�r|jtkr�t|�	|j
d��}zt�d|�
d��\}WntjyzYq�Yn0||\}}}}|�|||f�qJ�q|jtk�r�|jtk�r|jdddd}	t|jddd�D],}
t|�	|	�t|j�d�D]}||7}�qq�n�|jtk�rv|jdddd}	t|jddd�D]$}
t|�	|	��D]}||7}�q`�qNnt|jtk�r�|jdddd}	t|jddd�D]$}
t|�	|	��D]}||7}�q��q�ntd	t|j�����ntd
t|j�����ntdt|j�����|�t|��dS)Nrrrqrrr)rr1zUnsupported alpha encoding zUnknown BLP encoding zUnknown BLP compression ) rorrcrdr]rWrX�BLP_ENCODING_UNCOMPRESSEDrrkr^rrVrIrfr�BLP_ENCODING_DXTrY�BLP_ALPHA_ENCODING_DXT1rOrr0�boolrM�BLP_ALPHA_ENCODING_DXT3r:�BLP_ALPHA_ENCODING_DXT5r=r>rNrtru)rQrvrrwrxr/r.r-r,ZlinesizeZyb�dr
r
rrensL

�
��zBLP2Decoder._loadN)r?r@rArer
r
r
rr{msr{cCs|dd�dvS)Nr)rCrEr
)�prefixr
r
r�_accept�sr�z.blprDrF)F)r`r�ior�rrrrr|r}Z"BLP_ENCODING_UNCOMPRESSED_RAW_BGRAr~r�r�rr0r:r=�NotImplementedErrorr>rBZ	PyDecoderrbrpr{r�Z
register_openraZregister_extensionZregister_decoderr
r
r
r�<module>s0
75F*-,7

Youez - 2016 - github.com/yon3zu
LinuXploit