
    hH                        S r SSKJr  SSKJr  SSKJrJr  SSKJ	r
  SSKJr   " S S	\R                  5      rSS
 jrSrg)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)IO   )Image	ImageFile)i32le)StrOrBytesPathc                  0    \ rS rSrSrSrSS jrS	S jrSrg)
WalImageFile"   WALzQuake2 Texturec                   SU l         U R                  R                  S5      n[        US5      [        US5      4U l        [
        R                  " U R                  5        [        US5      nU R                  R                  U5        US S R                  SS5      S   U R                  S	'   US
S R                  SS5      S   nU(       a  X0R                  S'   g g )NPd       $   (       r   r   name8   X   	next_name)_modefpreadi32_sizer   _decompression_bomb_checksizeseeksplitinfo)selfheaderoffsetr   s       B/var/www/html/env/lib/python3.13/site-packages/PIL/WalImageFile.py_openWalImageFile._open&   s    
 /0_c&"o5
''		2 VRV #3BK--eQ7:		&2(..ua8;	%.IIk"     c                   U R                   c  [        R                  R                  U R                  U R
                  5      U l        U R                  U R                  R                  U R
                  S   U R
                  S   -  5      5        U R                  [        5        [        R                  R                  U 5      $ )Nr   r   )_imr   corenewmoder   im	frombytesr   r   
putpalettequake2paletteload)r#   s    r&   r3   WalImageFile.load8   sy    88jjnnTYY		:DGNN477<<		!tyy|(CDEOOM*{{%%r)   )r   r   r/   N)returnNone)r5   zImage.core.PixelAccess | None)	__name__
__module____qualname____firstlineno__formatformat_descriptionr'   r3   __static_attributes__ r)   r&   r   r   "   s    F)/$&r)   r   c                    [        U 5      $ )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 :py:func:`PIL.Image.Image.putpalette()` method.

:param filename: WAL file name, or an opened file handle.
:returns: An image instance.
)r   )filenames    r&   openrA   @   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)r@   zStrOrBytesPath | IO[bytes]r5   r   )__doc__
__future__r   typingr    r   r   _binaryr   r   _typingr	   r   rA   r2   r>   r)   r&   <module>rH      s=   	 #   ! #&9&& &<
"/H r)   