o
�J�h�B � @ s� d Z ddlmZ ddlZddlZddlZddlmZ ddlm Z ddl
mZ ddlm
Z
mZ G d d
� d
e�ZG dd� de�ZG d
d� de�Zd=dd�Z d>d?dd�Zd@dd�Zd@dd �ZG d!d"� d"e�ZdAd$d%�ZG d&d'� d'ej�ZG d(d)� d)ej�ZG d*d+� d+e�ZG d,d-� d-e�ZG d.d/� d/ej�ZdBd7d8�Z e
�!ej"ee� e
�#ej"d9� e
�$d:e� e
�$d;e� e
�%ej"e � e
�&d<e� dS )Ca�
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.
� )�annotationsN)�IntEnum)�BytesIO)�IO� )�Image� ImageFilec @ s e Zd ZdZdS )�Formatr N)�__name__�
__module__�__qualname__�JPEG� r r �PC:\pinokio\api\whisper-webui.git\app\env\lib\site-packages\PIL\BlpImagePlugin.pyr , s r c @ � e Zd ZdZdZdZdS )�Encodingr � � N)r
r r �UNCOMPRESSED�DXTZUNCOMPRESSED_RAW_BGRAr r r r r 0 � r c @ r )�
AlphaEncodingr r � N)r
r r �DXT1�DXT3�DXT5r r r r r 6 r r �i�int�return�tuple[int, int, int]c C s* | d? d@ d>