Sindbad~EG File Manager

Current Path : /proc/2233733/root/usr/local/lib/python3.12/site-packages/PIL/__pycache__/
Upload File :
Current File : //proc/2233733/root/usr/local/lib/python3.12/site-packages/PIL/__pycache__/ImageWin.cpython-312.pyc

�

&ٜg����ddlmZddlmZGd�d�ZGd�d�ZGd�d	�ZGd
�d�ZGd�d
e�Zy)�)�annotations�)�Imagec� �eZdZdZdd�Zdd�Zy)�HDCz�
    Wraps an HDC integer. The resulting object can be passed to the
    :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`
    methods.
    c��||_y�N��dc)�selfrs  �7/usr/local/lib/python3.12/site-packages/PIL/ImageWin.py�__init__zHDC.__init__s	�����c��|jSr	r
�rs r
�__int__zHDC.__int__"s���w�w�rN)r�int�return�None�rr��__name__�
__module__�__qualname__�__doc__rr�rr
rrs����rrc� �eZdZdZdd�Zdd�Zy)�HWNDz�
    Wraps an HWND integer. The resulting object can be passed to the
    :py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`
    methods, instead of a DC.
    c��||_yr	��wnd)rr!s  r
rz
HWND.__init__-s	����rc��|jSr	r rs r
rzHWND.__int__0s���x�x�rN)r!rrrrrrrr
rr&s����rrc�v�eZdZdZ	d
					dd�Zdd�Z	d
							d
d�Zdd�Z	d
					dd�Zdd�Z	dd	�Z
y)�Diba&
    A Windows bitmap with the given mode and size.  The mode can be one of "1",
    "L", "P", or "RGB".

    If the display requires a palette, this constructor creates a suitable
    palette and associates it with the image. For an "L" image, 128 graylevels
    are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together
    with 20 graylevels.

    To make sure that palettes work properly under Windows, you must call the
    ``palette`` method upon certain events from Windows.

    :param image: Either a PIL image, or a mode string. If a mode string is
                  used, a size must also be given.  The mode can be one of "1",
                  "L", "P", or "RGB".
    :param size: If the first argument is a mode string, this
                 defines the size of the image.
    Nc�^�t|t�r|}d}|�%d}t|��|j}|j}|dvrtj|�}t
jj||�|_	||_||_|r$t|t�rJ�|j|�yy)N�z+If first argument is mode, size is required)�1�L�P�RGB)�
isinstance�str�
ValueError�mode�sizer�getmodebase�core�display�image�paste)rr3r/r.�msgs     r
rzDib.__init__Hs����e�S�!��D��E��|�C�� ��o�%��:�:�D��:�:�D��-�-��$�$�T�*�D��Z�Z�'�'��d�3��
���	���	��!�%��-�-�-��J�J�u��rc�Z�t|�}t|t�rT|jj	|�}	|jj|�|jj
||�y|jj|�y#|jj
||�wxYw)a 
        Copy the bitmap contents to a device context.

        :param handle: Device context (HDC), cast to a Python integer, or an
                       HDC or HWND instance.  In PythonWin, you can use
                       ``CDC.GetHandleAttrib()`` to get a suitable handle.
        N)rr+rr3�getdc�expose�	releasedc)r�handle�
handle_intrs    r
r8z
Dib.expose]s�����[�
��f�d�#����!�!�*�-�B�
5��
�
�!�!�"�%��
�
�$�$�Z��4��J�J���j�)���
�
�$�$�Z��4�s�B�B*c��|�d|jz}t|�}t|t�rV|jj|�}	|jj
|||�|jj||�y|jj
|||�y#|jj||�wxYw)am
        Same as expose, but allows you to specify where to draw the image, and
        what part of it to draw.

        The destination and source areas are given as 4-tuple rectangles. If
        the source is omitted, the entire image is copied. If the source and
        the destination have different sizes, the image is resized as
        necessary.
        N)rr)r/rr+rr3r7�drawr9)rr:�dst�srcr;rs      r
r=zDib.drawos����;��4�9�9�$�C���[�
��f�d�#����!�!�*�-�B�
5��
�
����C��-��
�
�$�$�Z��4��J�J�O�O�J��S�1���
�
�$�$�Z��4�s�	B!�!B?c�^�t|�}t|t�rU|jj	|�}	|jj|�}|jj
||�|S|jj|�}|S#|jj
||�wxYw)at
        Installs the palette associated with the image in the given device
        context.

        This method should be called upon **QUERYNEWPALETTE** and
        **PALETTECHANGED** events from Windows. If this method returns a
        non-zero value, one or more display palette entries were changed, and
        the image should be redrawn.

        :param handle: Device context (HDC), cast to a Python integer, or an
                       HDC or HWND instance.
        :return: The number of entries that were changed (if one or more entries,
                 this indicates that the image should be redrawn).
        )rr+rr3r7�
query_paletter9)rr:r;�results    r
rAzDib.query_palette�s�����[�
��f�d�#��Z�Z�%�%�j�1�F�
5����1�1�&�9���
�
�$�$�V�V�4��
��Z�Z�-�-�j�9�F��
���
�
�$�$�V�V�4�s�B�B,c�(�|j�|j|jk7r|j|j�}|r'|jj	|j
|�y|jj	|j
�y)a�
        Paste a PIL image into the bitmap image.

        :param im: A PIL image.  The size must match the target region.
                   If the mode does not match, the image is converted to the
                   mode of the bitmap image.
        :param box: A 4-tuple defining the left, upper, right, and
                    lower pixel coordinate.  See :ref:`coordinate-system`. If
                    None is given instead of a tuple, all of the image is
                    assumed.
        N)�loadr.�convertr3r4�im)rrF�boxs   r
r4z	Dib.paste�s`��	���	��9�9��������D�I�I�&�B���J�J���R�U�U�C�(��J�J���R�U�U�#rc�:�|jj|�y)z�
        Load display memory contents from byte data.

        :param buffer: A buffer containing display data (usually
                       data returned from :py:func:`~PIL.ImageWin.Dib.tobytes`)
        N)r3�	frombytes)r�buffers  r
rIz
Dib.frombytes�s��	
�
�
���V�$rc�6�|jj�S)zy
        Copy display memory contents to bytes object.

        :return: A bytes object containing display data.
        )r3�tobytesrs r
rLzDib.tobytes�s���z�z�!�!�#�#rr	)r3zImage.Image | strr/ztuple[int, int] | Nonerr)r:�int | HDC | HWNDrr)r:rMr>ztuple[int, int, int, int]r?� tuple[int, int, int, int] | Nonerr)r:rMrr)rFzImage.ImagerGrNrr)rJ�bytesrr)rrO)rrrrrr8r=rAr4rIrLrrr
r$r$4s����(HL��&��.D��	
��**�,15�	2� �2�'�2�.�	2�

�2�6�6HL�$��$�$D�$�	
�$�,%�$rr$c�b�eZdZdZ	d							dd�Zd
d�Zdd�Zdd�Zdd�Zdd�Z	dd	�Z
dd
�Zy)�Windowz*Create a Window with the given title size.Nc�v�tjj||j|xsd|xsd�|_y)Nr)rr1�createwindow�_Window__dispatcher�hwnd)r�title�width�heights    r
rzWindow.__init__�s1���J�J�+�+��4�$�$�e�j�q�&�+�A�
��	rc�(�t|d|���|�y)N�
ui_handle_)�getattr)r�action�argss   r
�__dispatcherzWindow.__dispatcher�s��,���
�6�(�+�,�d�3rc��yr	r�rr�x0�y0�x1�y1s      r
�ui_handle_clearzWindow.ui_handle_clear����rc��yr	r)rrarbrcrds     r
�ui_handle_damagezWindow.ui_handle_damage�rfrc��yr	rrs r
�ui_handle_destroyzWindow.ui_handle_destroy�rfrc��yr	rr`s      r
�ui_handle_repairzWindow.ui_handle_repair�rfrc��yr	r)rrWrXs   r
�ui_handle_resizezWindow.ui_handle_resize�rfrc�@�tjj�yr	)rr1�	eventlooprs r
�mainloopzWindow.mainloop�s��
�
�
���r)�PILNN)rVr,rW�
int | NonerXrsrr)r\r,r]rrr�rrrarrbrrcrrdrrr)
rarrbrrcrrdrrr)rr)rWrrXrrr)rrrrrrTrerhrjrlrnrqrrr
rQrQ�sT��4�RV�
��
�)3�
�DN�
�	
�
�4�
�
�
�
�
�rrQc�.��eZdZdZdd�fd�
Zdd�Z�xZS)�ImageWindowz6Create an image window which displays the given image.c���t|t�st|�}||_|j\}}t�|�|||��y)N)rWrX)r+r$r3r/�superr)rr3rVrWrX�	__class__s     �r
rzImageWindow.__init__�s>����%��%���J�E���
��
�
�
��v�
����e�F��;rc�D�|jj|||||f�yr	)r3r=r`s      r
rlzImageWindow.ui_handle_repair�s���
�
����R��R��,�-r)rr)r3zImage.Image | DibrVr,rrrt)rrrrrrl�
__classcell__)rys@r
rvrv�s���@�<�.rrvN)	�
__future__rr&rrrr$rQrvrrr
�<module>r}sE��&#������U$�U$�p��@.�&�.r

Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists