a :jgú ã@s~dZddlmZddlmZddlmZmZmZddl m Z ddl m Z ddlmZGd d „d ejƒZdd d d dœdd„ZdS)a‚ .. note:: This format cannot be automatically recognized, so the class is not registered for use with :py:func:`PIL.Image.open()`. To open a gd file, use the :py:func:`PIL.GdImageFile.open()` function instead. .. warning:: THE GD FORMAT IS NOT DESIGNED FOR DATA INTERCHANGE. This implementation is provided for convenience and demonstrational purposes only. é)Ú annotations)ÚIOé)Ú ImageFileÚ ImagePaletteÚUnidentifiedImageError)Úi16be)Úi32be)ÚStrOrBytesPathc@s&eZdZdZdZdZddœdd„ZdS) Ú GdImageFilea% Image plugin for the GD uncompressed format. Note that this format is not supported by the standard :py:func:`PIL.Image.open()` function. To use this plugin, you have to import the :py:mod:`PIL.GdImageFile` module and use the :py:func:`PIL.GdImageFile.open()` function. ZGDzGD uncompressed imagesÚNone)ÚreturncCsÖ|jdusJ‚|j d¡}t|ƒdvr2d}t|ƒ‚d|_t|dƒt|dƒf|_|d}|r^dnd}t|d |ƒ}|d kr‚||jd <t  d |d |dd |dd …¡|_ t   dd|j d |dd d¡g|_dS)Ni )iþÿiÿÿzNot a valid GD 2.x .gd fileÚLééérééZ transparencyZXBGRiÚraw)rr)rrr)ÚfpÚreadÚi16Ú SyntaxErrorÚ_modeÚ_sizeÚi32ÚinforrÚpaletterZ_TileÚsizeZtile)ÚselfÚsÚmsgZ true_colorZtrue_color_offsetZtindex©r"ú9/usr/local/lib/python3.9/site-packages/PIL/GdImageFile.pyÚ_open1s,     ÿüÿzGdImageFile._openN)Ú__name__Ú __module__Ú __qualname__Ú__doc__ÚformatÚformat_descriptionr$r"r"r"r#r &sr ÚrzStrOrBytesPath | IO[bytes]Ústr)rÚmoder c CsV|dkrd}t|ƒ‚z t|ƒWStyP}zd}t|ƒ|‚WYd}~n d}~00dS)a# Load texture from a GD image file. :param fp: GD file name, or an opened file handle. :param mode: Optional mode. In this version, if the mode argument is given, it must be "r". :returns: An image instance. :raises OSError: If the image could not be read. r+zbad modezcannot identify this image fileN)Ú ValueErrorr rr)rr-r!Úer"r"r#ÚopenTs  r0N)r+)r(Ú __future__rÚtypingrÚrrrÚ_binaryrrr rZ_typingr r r0r"r"r"r#Ús     .