a :jgH@sndZddlmZddlmZddlmZmZddlm Z ddl m Z Gdd d ejZ d d d d d ZdZdS)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@s0eZdZdZdZddddZdddd Zd S) WalImageFileZWALzQuake2 TextureNone)returncCsd|_|jd}t|dt|df|_t|jt|d}|j||dd ddd|j d <|d d  ddd}|r||j d <dS) NPd $(rrname8X next_name) _modefpreadi32_sizerZ_decompression_bomb_checksizeseeksplitinfo)selfheaderoffsetrr":/usr/local/lib/python3.9/site-packages/PIL/WalImageFile.py_open&s    zWalImageFile._openzImage.core.PixelAccess | NonecCsV|jdurJtj|j|j|_||j |jd|jd| t tj |S)Nrr) Z_imrcorenewmoderZim frombytesrrZ putpalette quake2paletteload)rr"r"r#r*8s  " zWalImageFile.loadN)__name__ __module__ __qualname__formatformat_descriptionr$r*r"r"r"r#r "sr zStrOrBytesPath | IO[bytes])filenamer cCst|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 )r0r"r"r#open@s r1s """&&&))),,,///222555777:::<<<$"         ##&""%" #!"   -( )$'"%8.1),%& <07,3(-$("  10., * ' %!        )#'!& %#!    &#    3"5)&7/-95479:379046+14'.1"+/(,%* & % "    ,!!*)'&$"!  .0)-.'+,&**$()#''!&&$$"" 0-,*(&$!       ()8&'6%&4$$1""/ !-*'%!  /2)-0&+.$),!'*%(#&!%"    ?< 9 5#1#-#)?????9??1??*?? ???<?9?5 ?2?-=*;&9!742/-* '#=??? <.*6' 0!)<9772/1,(+&!0" N)__doc__ __future__rtypingrrr_binaryrrZ_typingrr r1r)r"r"r"r#s