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üdZddlZddlmZddlmZmZdZdZdZ dZ dZ dZ dZ d d „Zd!d d „Zdd„Zdd„ZGdd„deƒZGdd„dejƒZGdd„dejƒZGdd„deƒZGdd„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ééécCs*|d?d@d>|d?d@d>|d@d>fS)Né éréé?r©)Úir r ú3/tmp/tmp5hum_rxs/lib64/python/PIL/BlpImagePlugin.pyÚ unpack_5650srFcCsÖ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}n d \}}}}|�r²||j||||gƒqˆ||j|||gƒqˆWqvWq,W|S) zE input: one "row" of data (i.e. will produce 4*width pixels) ézB|dd>B|dd >B}|d |d d>B} tjd |dƒ\} } tjd |dƒ\} t| ƒ\} }}t| ƒ\}}}�xâtdƒD�]Ô}�xÌtdƒD�]¾}dd||}|dk�r2| |?d@}n0|dk�rR| d?|d >d@B}n||d?d@}|d k�rr|}nt|d k�r‚|}nd||k�rªd|||d |d}n<|dk�rºd }n,|dk�rÊd}nd|||d |d}| dd||?d@}|d k�r| ||}}}n’|d k�r6|||}}}nv|dk�rrd| |d}d||d}d||d}n:|dk�r¬d|| d}d||d}d||d}||j||||gƒ�qWqòWq,W|S)zG input: one "row" of data (i.e. will produce 4 * width pixels) r/zÚ__doc__ÚformatZformat_descriptionrMrEr r r rr?ês r?c@s0eZdZdZdd„Zdd„Zdd„Zdd „Zd S) Ú_BLPBaseDecoderTcCsby.|jjdƒ|jjdƒ|_|jƒ|jƒWn.tjk r\}ztdƒ|‚WYdd}~XnXdS)NrrzTruncated Blp file)rr) ÚfdÚseekrCrDrEÚ_loadrÚerrorÚOSError)rKÚbufferÚer r rÚdecodes  z_BLPBaseDecoder.decodecCstj|j|ƒS)N)rÚ _safe_readr[)rKÚlengthr r rrc!sz_BLPBaseDecoder._safe_readcCsdg}xZtdƒD]N}ytjd|jdƒƒ\}}}}Wntjk rHPYnX|j||||fƒqW|S)Néz<4Br)rrrOrcr^Úappend)rKrrr-r,r+r*r r rÚ _read_palette$sz_BLPBaseDecoder._read_palettecCsätjd|jdƒƒ\|_tjd|jdƒƒ\|_tjd|jdƒƒ\|_tjd|jdƒƒ\|_tjd|jdƒƒ\|_tjd|jdƒƒ|_|j dkr¸tjd|jdƒƒ\|_tjd|jdƒƒ\|_ tjd|jd ƒƒ|_ tjd|jd ƒƒ|_ dS) NzZ _pulls_fdrbrcrgrEr r r rrZs   rZc@seZdZdd„Zdd„ZdS)Ú BLP1Decoderc Csà|jtkr|jƒnÈ|jdkrÈ|jdkr²tƒ}|jƒ}t|j|jdƒƒ}xVyt j d|j dƒƒ\}Wnt j k r|PYnX||\}}}}|j |||gƒqLW|jt|ƒƒqÜtdt|jƒ›�ƒ‚ntdt|jƒ›�ƒ‚dS) Nrrr rzr]rjr r r rrhAsrhc@seZdZdd„ZdS)Ú BLP2Decoderc CsD|jƒ}tƒ}|jj|jdƒ|jdk�r|jtkr¦t|j |j dƒƒ}xVyt j d|j dƒƒ\}Wnt jk r|PYnX||\}}}}|j|||fƒqLW�q2|jtk�r|jtk�r"|jdddd} xJt|jdddƒD]0} x*t|j | ƒt|jƒd�D]} || 7}�q WqìWnä|jtk�rŠ|jdddd} xÀt|jdddƒD](} x t|j | ƒƒD]} || 7}�qpW�q\Wn||jtk�rò|jdddd} xXt|jdddƒD](} x t|j | ƒƒD]} || 7}�qØW�qÄWntd t|jƒ›�ƒ‚ntd t|jƒ›�ƒ‚ntd t|jƒ›�ƒ‚|jt|ƒƒdS) Nrrzr]r r r rrsmsrscCs|dd…dkS)NróBLP1óBLP2)r{r|r )Úprefixr r rÚ_accept¤sr~z.blpr@rA)F)rXrÚiorÚrrrirtruZ"BLP_ENCODING_UNCOMPRESSED_RAW_BGRArvrxryrr.r7r:ÚNotImplementedErrorr;r?Z PyDecoderrZrhrsr~Z register_openrYZregister_extensionZregister_decoderr r r rÚs0  75F*-,7