Hacked By AnonymousFox

Current Path : /opt/cloudlinux/venv/lib/python3.11/site-packages/pyvirtualdisplay/__pycache__/
Upload File :
Current File : //opt/cloudlinux/venv/lib/python3.11/site-packages/pyvirtualdisplay/__pycache__/smartdisplay.cpython-311.pyc

�

�܋fg
���ddlZddlZddlmZmZddlmZddlmZej	e
��ZGd�de��Z
d�ZGd�d	e��ZdS)
�N)�Image�
ImageChops)�grab)�Displayc��eZdZdS)�DisplayTimeoutErrorN)�__name__�
__module__�__qualname__���n/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/pyvirtualdisplay/smartdisplay.pyrrs�������Dr
rc��|jdkr|�d��}tjd|j|��}tj||��}|���}|r|�|��SdS)z�Crop borders off an image.

    :param im: Source image.
    :param bgcolor: Background color, using either a color tuple.
    :return: An image without borders, or None if there's no actual content in the image.
    �RGBN)	�mode�convertr�new�sizer�
difference�getbbox�crop)�im�bgcolor�bg�diff�bboxs     r�autocroprss��
�w�%���
�Z�Z��
�
��	��5�"�'�7�	+�	+�B�� ��R�(�(�D��<�<�>�>�D����w�w�t�}�}���4r
c�$�eZdZd�Zdd�Zdd�ZdS)	�SmartDisplayc�,�t||j��S)z�Crop borders off an image.

        :param im: Source image.
        :return: An image without borders, or None if there's no actual content in the image.
        )r�_bgcolor)�selfrs  rrzSmartDisplay.autocrop"s����D�M�*�*�*r
Tc�^�t|j���}|r|�|��}|S)N)�xdisplay)r�new_display_varr)r"r�imgs   rrzSmartDisplay.grab*s3���D�0�1�1�1���	%��-�-��$�$�C��
r
�<Nc��d}d}d}	t�dt|��z��tj|��||z
}|�d���}|�|��}|r|}|r|snL||��rn@|}|dz
}||krd|�d	|�d
�}	t|	���t�d����|sJ�|S)a�start process and create screenshot.
        Repeat screenshot until it is not empty and
        cb_imgcheck callback function returns True
        for current screenshot.

        :param autocrop: True -> crop screenshot
        :param timeout: int
        :param cb_imgcheck: None or callback for testing img,
                            True = accept img,
                            False = reject img
        rg333333�?g�?�zsleeping %s secsF)rzTimeout! elapsed time:z	 timeout:� zscreenshot is empty, next try..)�log�debug�str�time�sleeprrr)
r"�timeoutr�cb_imgcheck�t�
sleep_time�repeat_timer&�img_crop�msgs
          r�waitgrabzSmartDisplay.waitgrab2s��
���
���	9��I�I�(�3�z�?�?�:�;�;�;��J�z�"�"�"�
��O�A��)�)�U�)�+�+�C��}�}�S�)�)�H��
����
�"����;�s�#�#���$�J��3��K��7�{�{�{�@A���7�7�7�K��)�#�.�.�.�
�I�I�7�8�8�8�)	9�*�
�
�s��
r
)T)r'TN)r	r
rrrr7rr
rrr!sK������+�+�+�����'�'�'�'�'�'r
r)�loggingr.�PILrr�
PIL.ImageGrabr�pyvirtualdisplayr�	getLoggerr	r+�	Exceptionrrrrr
r�<module>r>s�����������!�!�!�!�!�!�!�!�������$�$�$�$�$�$��g���!�!��	�	�	�	�	�)�	�	�	����"8�8�8�8�8�7�8�8�8�8�8r

Hacked By AnonymousFox1.0, Coded By AnonymousFox