
    ⨽g
                     f    d Z ddlZddlZddlmZ  G d de      Z G d de      Z G d	 d
e      Zy)zD
PIL-based formats to take screenshots and grab from the clipboard.
    N   )Formatc                   `     e Zd ZdZdZdZ fdZd Zd Z G d de	j                        Z
 xZS )	BaseGrabFormatzBase format for grab formats.FNc                 ^    t        t        | 
  |i | t        j                         | _        y N)superr   __init__	threadingRLock_lock)selfargskwargs	__class__s      ]/var/www/it7/html/youtubeDownloader/venv/lib/python3.12/site-packages/imageio/plugins/grab.pyr
   zBaseGrabFormat.__init__   s%    nd,d=f=__&
    c                      y)NF r   requests     r   
_can_writezBaseGrabFormat._can_write   s    r   c                    | j                   5  | j                  s0d| _        dd l}t        |d      st	        d      	 ddlm} || _        d d d        | j                  S # t        $ r Y d d d        y w xY w# 1 sw Y   | j                  S xY w)NTr   __version__z(Imageio Pillow requires Pillow, not PIL!)	ImageGrab)r   _pillow_importedPILhasattrImportErrorr   
_ImageGrab)r   r   r   s      r   _init_pillowzBaseGrabFormat._init_pillow   s    ZZ 	,(((,%sM2%&STT - #,	,  #  	, 	, 	, s.   /A5AA5	A2'A51A22A55B	c                       e Zd Zd Zd Zd Zy)BaseGrabFormat.Readerc                      y r   r   r   s    r   _openzBaseGrabFormat.Reader._open)       r   c                      y r   r   r%   s    r   _closezBaseGrabFormat.Reader._close,   r'   r   c                 8    | j                   j                  |      S r   )format	_get_data)r   indexs     r   r,   zBaseGrabFormat.Reader._get_data/   s    ;;((//r   N)__name__
__module____qualname__r&   r)   r,   r   r   r   Readerr#   (   s    			0r   r1   )r.   r/   r0   __doc__r   r    r
   r   r!   r   r1   __classcell__)r   s   @r   r   r      s5    'J'0 0 0r   r   c                       e Zd ZdZd Zd Zy)ScreenGrabFormata  The ScreenGrabFormat provided a means to grab screenshots using
    the uri of "<screen>".

    This functionality is provided via Pillow. Note that "<screen>" is
    only supported on Windows and OS X.

    Parameters for reading
    ----------------------
    No parameters.
    c                 T    |j                   dk7  ryt        | j                               S )Nz<screen>Ffilenameboolr!   r   s     r   	_can_readzScreenGrabFormat._can_read?   s'    z)D%%'((r   c                     | j                         }|sJ |j                         }|J t        j                  |      }|i fS r   )r!   grabnpasarrayr   r-   r   pil_imims        r   r,   zScreenGrabFormat._get_dataD   sG    %%'	y!!!!ZZ2vr   Nr.   r/   r0   r2   r:   r,   r   r   r   r5   r5   3   s    	)
r   r5   c                       e Zd ZdZd Zd Zy)ClipboardGrabFormata(  The ClipboardGrabFormat provided a means to grab image data from
    the clipboard, using the uri "<clipboard>"

    This functionality is provided via Pillow. Note that "<clipboard>" is
    only supported on Windows.

    Parameters for reading
    ----------------------
    No parameters.
    c                 T    |j                   dk7  ryt        | j                               S )Nz<clipboard>Fr7   r   s     r   r:   zClipboardGrabFormat._can_readZ   s'    },D%%'((r   c                     | j                         }|sJ |j                         }|t        d      t        j                  |      }|i fS )Nz5There seems to be no image data on the clipboard now.)r!   grabclipboardRuntimeErrorr=   r>   r?   s        r   r,   zClipboardGrabFormat._get_data_   sT    %%'	y((*>J  ZZ2vr   NrB   r   r   r   rD   rD   N   s    	)

r   rD   )	r2   r   numpyr=   corer   r   r5   rD   r   r   r   <module>rK      s:      $0V $0N~ 6. r   