
     f                    b    d Z ddlmZ ddlmZmZ ddlmZ  G d dej                  Z	d Z
d	Zd
S )a  
This reader is based on the specification available from:
https://www.flipcode.com/archives/Quake_2_BSP_File_Format.shtml
and has been tested with a few sample files found using google.

.. note::
    This format cannot be automatically recognized, so the reader
    is not registered for use with :py:func:`PIL.Image.open()`.
    To open a WAL file, use the :py:func:`PIL.WalImageFile.open()` function instead.
    )annotations   )Image	ImageFile)i32lec                  $    e Zd ZdZdZddZd ZdS )	WalImageFileWALzQuake2 TexturereturnNonec                   d| _         | j                            d          }t          |d          t          |d          f| _        t          j        | j                   t          |d          }| j                            |           |d d         	                    dd          d         | j
        d	<   |d
d         	                    dd          d         }|r|| j
        d<   d S d S )NPd       $   (       r   r   name8   X   	next_name)_modefpreadi32_sizer   _decompression_bomb_checksizeseeksplitinfo)selfheaderoffsetr   s       S/var/www/api.educacionweb.es/myenv/lib/python3.11/site-packages/PIL/WalImageFile.py_openzWalImageFile._open#   s    
 /00__c&"oo5
'	222 VRV #3B3K--eQ77:	&2<(..ua88;	 	/%.DIk"""	/ 	/    c                l   | j         st          j                            | j        | j                  | _         |                     | j                            | j        d         | j        d         z                       | 	                    t                     t          j                            |           S )Nr   r   )imr   corenewmoder   	frombytesr   r   
putpalettequake2paletteload)r"   s    r%   r0   zWalImageFile.load5   s    w 	+jnnTY	::DGNN47<<	!ty|(CDDEEEOOM***{%%%r'   N)r   r   )__name__
__module____qualname__formatformat_descriptionr&   r0    r'   r%   r	   r	      sB        F)/ / / /$& & & & &r'   r	   c                     t          |           S )a2  
    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 :py:func:`PIL.Image.Image.putpalette()` method.

    :param filename: WAL file name, or an opened file handle.
    :returns: An image instance.
    )r	   )filenames    r%   openr9   =   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" N)__doc__
__future__r    r   r   _binaryr   r   r	   r9   r/   r6   r'   r%   <module>r>      s   	 	 # " " " " "         ! ! ! ! ! !& & & & &9& & & &<
" 
" 
"/H r'   