
    \bj                        d Z ddlmZ ddlmZ ddlmZmZmZm	Z	 ddl
mZ ddl
mZ ddlmZ  G d	 d
ej                  ZdddZdS )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   )Image	ImageFileImagePaletteUnidentifiedImageError)i16be)i32be)StrOrBytesPathc                  "    e Zd ZdZdZdZddZdS )	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.
    GDzGD uncompressed imagesreturnNonec                :   | j         J | j                             d          }t          |          dvrd}t          |          d| _        t          |d          t          |d          f| _        t          j        | j                   |d         }|rdnd}t          |d	|z             }|d
k     r
|| j
        d<   t          j        d|d	|z   dz   d	|z   dz   dz                      | _        t          j        dd| j        z   d	|z   dz   dz   d          g| _        d S )Ni  )i  i  zNot a valid GD 2.x .gd fileP         r         transparencyRGBXi   raw)r   r   L)fpreadi16SyntaxError_mode_sizer   _decompression_bomb_checksizei32infor   r   paletter   _Tiletile)selfsmsg
true_colortrue_color_offsettindexs         C/home/drrone/.local/lib/python3.11/site-packages/PIL/GdImageFile.py_openzGdImageFile._open2   s@   w"""GLLq66''/Cc"""
AYYAq		)
'	222qT
!+2AA Q--..C<<(.DIn%#'Aa++a/!6G2G!2Kg2UUV
 

 O"%%)G3	 
			    N)r   r   )__name__
__module____qualname____doc__formatformat_descriptionr1    r2   r0   r   r   '   s?          F1!
 !
 !
 !
 !
 !
r2   r   rr   StrOrBytesPath | IO[bytes]modestrr   c                    |dk    rd}t          |          	 t          |           S # t          $ r}d}t          |          |d}~ww xY w)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:   zbad modezcannot identify this image fileN)
ValueErrorr   r    r	   )r   r<   r,   es       r0   openrA   V   sc     s{{oo12 1 1 1/$S))q01s   ( 
A	AA	N)r:   )r   r;   r<   r=   r   r   )r6   
__future__r   typingr    r   r   r   r	   _binaryr
   r   r   r%   _typingr   r   rA   r9   r2   r0   <module>rG      s   "
 
 # " " " " "       D D D D D D D D D D D D ! ! ! ! ! ! ! ! ! ! ! ! # # # # # #,
 ,
 ,
 ,
 ,
)% ,
 ,
 ,
^1 1 1 1 1 1 1r2   