
    0-Ph
                     z    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dS )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                 x     t          t          |           j        |i | t          j                    | _        d S N)superr   __init__	threadingRLock_lock)selfargskwargs	__class__s      T/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/imageio/plugins/grab.pyr
   zBaseGrabFormat.__init__   s8    ,nd##,d=f===_&&


    c                     dS )NF r   requests     r   
_can_writezBaseGrabFormat._can_write   s    ur   c                    | j         5  | j        sUd| _        dd l}t          |d          st	          d          	 ddlm} n# t          $ r Y d d d            d S w xY w|| _        d d d            n# 1 swxY w Y   | j        S )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   Z 	, 	,( 
,(,%


sM22 U%&STTT -------"      	, 	, 	, 	, 	, 	, 	, 	, "+	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, 	, s4   2A1AA1
AA1A
A11A58A5c                        e Zd Zd Zd Zd ZdS )BaseGrabFormat.Readerc                     d S r   r   r   s    r   _openzBaseGrabFormat.Reader._open)       Dr   c                     d S r   r   r%   s    r   _closezBaseGrabFormat.Reader._close,   r'   r   c                 6    | 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#   (   sA        	 	 		 	 		0 	0 	0 	0 	0r   r1   )r.   r/   r0   __doc__r   r    r
   r   r!   r   r1   __classcell__)r   s   @r   r   r      s        ''J' ' ' ' '    0 0 0 0 0 0 0 0 0 0 0 0r   r   c                       e Zd ZdZd Zd ZdS )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                 ^    |j         dk    rdS t          |                                           S )Nz<screen>Ffilenameboolr!   r   s     r   	_can_readzScreenGrabFormat._can_read?   s/    z))5D%%''(((r   c                     |                                  }|sJ |                                }|J t          j        |          }|i fS r   )r!   grabnpasarrayr   r-   r   pil_imims        r   r,   zScreenGrabFormat._get_dataD   sR    %%''	!!!!!Z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dS )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                 ^    |j         dk    rdS t          |                                           S )Nz<clipboard>Fr7   r   s     r   r:   zClipboardGrabFormat._can_readZ   s/    },,5D%%''(((r   c                     |                                  }|s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_   sd    %%''	((**>J   Z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                  $0 $0 $0 $0 $0V $0 $0 $0N    ~   6    .     r   