U
    ?h
                     @  s~   d Z ddlmZ ddlmZ ddlmZmZmZ ddl	m
Z ddl	mZ ddlmZ G d	d
 d
ejZdddd
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   )	ImageFileImagePaletteUnidentifiedImageError)i16be)i32be)StrOrBytesPathc                   @  s&   e Zd ZdZdZdZdd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.
    ZGDzGD uncompressed imagesNone)returnc                 C  s   | j d k	st| j d}t|dkr2d}t|d| _t|dt|df| _|d }|r^dnd}t|d	| }|d
k r|| jd< t	
d|d	| d d	| d d  | _dd| j d	| d d dfg| _d S )Ni  )i  i  zNot a valid GD 2.x .gd fileL         r         ZtransparencyZXBGRi   raw)r   r   )r   r   r   )fpAssertionErrorreadi16SyntaxError_mode_sizei32infor   r   palettesizeZtile)selfsmsgZ
true_colorZtrue_color_offsetZtindex r#   A/var/www/html/venv/lib/python3.8/site-packages/PIL/GdImageFile.py_open1   s,    
 zGdImageFile._openN)__name__
__module____qualname____doc__formatformat_descriptionr%   r#   r#   r#   r$   r   &   s   r   rzStrOrBytesPath | IO[bytes]str)r   moder   c              
   C  sT   |dkrd}t |z
t| W S  tk
rN } zd}t||W 5 d}~X Y nX dS )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"   er#   r#   r$   openT   s    

r1   N)r,   )r)   
__future__r   typingr    r   r   r   _binaryr   r   r	   r   Z_typingr
   r   r1   r#   r#   r#   r$   <module>   s   .