Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3
iaé8 ã @ sü d Z ddlZddlmZ ddlmZmZ dZdZdZ dZ
dZdZdZ
d d
„ Zd!dd
„Zdd„ Zdd„ ZG dd„ deƒZG dd„ dejƒZG dd„ dejƒZG dd„ deƒZG dd„ deƒZdd„ Zejejeeƒ ejejdƒ ejdeƒ ejd eƒ dS )"aÑ
Blizzard Mipmap Format (.blp)
Jerome Leclanche
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é é é c C s* | d? d@ d> | d? d@ d> | d@ d> fS )Né é r é é? r © )Úir
r
ú3/tmp/tmp5hum_rxs/lib64/python/PIL/BlpImagePlugin.pyÚ
unpack_5650 s r Fc C sÖ t | ƒd }tƒ tƒ tƒ tƒ f}�x®t|ƒD �] }|d }tjd| |ƒ\}}}t|ƒ\} }
}t|ƒ\}}
}�x`tdƒD �]R}�xJtdƒD �]<}|d@ }|d? }d}|dkr¼| |
| }}}nØ|dkrÖ||
| }}}n¾|dk�rB||k�rd| | d }d|
|
d }d| | d }n$| | d }|
|
d }|| d }nR|dk�r”||k�rˆd| | d }d|
|
d }d| | d }nd \}}}}|�r²|| j||||gƒ qˆ|| j|||gƒ qˆW qvW q,W |S )
zE
input: one "row" of data (i.e. will produce 4*width pixels)
é z