î
úÙ X)  ã               @   s|   d  d l  m Z d  d l m Z m Z y d  d l Z Wn$ e k
 r\ d  d l Z e Z Yn Xe j Z	 d d „  Z
 d Z d S)é    )Úprint_function)ÚImageÚ_binaryNc             C   s  t  |  d ƒ r |  } n t j |  d ƒ } | j d ƒ } t | d ƒ t | d ƒ f } t | d ƒ } | j | ƒ t j d | | j | d	 | d
 ƒ ƒ } | j t	 ƒ d | _
 d | _ | d d … j d d
 ƒ d	 | j d <| d d … j d d
 ƒ d	 } | r| | j d <n  | S)a  
    Load texture from a Quake2 WAL texture file.

    By default, a Quake2 standard palette is attached to the texture.
    To override the palette, use the <b>putpalette</b> method.

    :param filename: WAL file name, or an opened file handle.
    :returns: An image instance.
    ÚreadÚrbé    é   é   é$   é(   ÚPr   é   ZWALzQuake2 TextureNs    Únameé8   Ú	next_namer   éX   éd   r   )ÚhasattrÚbuiltinsÚopenr   Úi32Úseekr   Z	frombytesZ
putpaletteÚquake2paletteÚformatZformat_descriptionÚsplitÚinfo)ÚfilenameÚfpÚheaderÚsizeÚoffsetZimr   © r!   úM/home/ubuntu/projects/ifolica/lib/python3.4/site-packages/PIL/WalImageFile.pyr   %   s     	*		' r   s   """&&&))),,,///222555777:::<<<$" 


##&""%" #!"  -( )$'"%8.1),%& <07,3(-$("
10.,*'
%!


)#'!& %#! 

&# 

3"5)&7/-95479:379046+14'.1"+/(,%* &%"
 
,!!*)'&$"!


.0)-.'+,&**$()#''!&&$$""
0-,*(&$!



()8&'6%&4$$1""/ !-*'%!
/2)-0&+.$),!'*%(#&!%"

?<9 5#1#-#)?????9??1??*?? ???<?9?5?2?-=*;&9!742/-*'#=???<.*6' 0!)<9772/1,(+&!0" )Ú
__future__r   ZPILr   r   r   ÚImportErrorÚ__builtin__Zi32ler   r   r   r!   r!   r!   r"   Ú<module>   s   	+