%PDF- %PDF-
Mini Shell

Mini Shell

Direktori : /lib/python3/dist-packages/PIL/__pycache__/
Upload File :
Create Path :
Current File : //lib/python3/dist-packages/PIL/__pycache__/ImageWin.cpython-312.pyc

�

��e:���ddlmZddlmZGd�d�ZGd�d�ZGd�d	�ZGd
�d�ZGd�d
e�Zy)�)�annotations�)�Imagec��eZdZdZd�Zd�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  �./usr/lib/python3/dist-packages/PIL/ImageWin.py�__init__zHDC.__init__s	�����c��|jSr	r
�rs r
�__int__zHDC.__int__"s���w�w�rN��__name__�
__module__�__qualname__�__doc__rr�rr
rrs����rrc��eZdZdZd�Zd�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rs  r
rz
HWND.__init__-s	����rc��|jSr	rrs r
rzHWND.__int__0s���x�x�rNrrrr
rr&s����rrc�@�eZdZdZd
d�Zd�Zd
d�Zd�Zd
d�Zd�Z	d	�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|d�r%t|d�r|j}|j}n|}d}|dvrtj|�}tj
j
||�|_||_||_|r|j|�yy)N�mode�size)�1�L�P�RGB)	�hasattrr"r#r�getmodebase�core�display�image�paste)rr,r#r"s    r
rzDib.__init__Hs����5�&�!�g�e�V�&<��:�:�D��:�:�D��D��E��-�-��$�$�T�*�D��Z�Z�'�'��d�3��
���	���	���J�J�u��rc�H�t|t�rU|jj|�}	|jj	|�}|jj||�|S|jj	|�}|S#|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.
        )�
isinstancerr,�getdc�expose�	releasedc)r�handler�results    r
r1z
Dib.exposeWs����f�d�#����!�!�&�)�B�
1����*�*�2�.���
�
�$�$�V�R�0��
��Z�Z�&�&�v�.�F��
���
�
�$�$�V�R�0���B�B!c�r�|sd|jz}t|t�rW|jj	|�}	|jj|||�}|jj
||�|S|jj|||�}|S#|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.
        )rr)r#r/rr,r0�drawr2)rr3�dst�srcrr4s      r
r7zDib.drawis�����4�9�9�$�C��f�d�#����!�!�&�)�B�
1�������S�#�6���
�
�$�$�V�R�0��
��Z�Z�_�_�V�S�#�6�F��
���
�
�$�$�V�R�0�s�B�B6c�H�t|t�rU|jj|�}	|jj	|�}|jj||�|S|jj	|�}|S#|jj||�wxYw)ae
        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: A true value if one or more entries were changed (this
                 indicates that the image should be redrawn).
        )r/rr,r0�
query_paletter2)rr3r4s   r
r;zDib.query_palettes����f�d�#��Z�Z�%�%�f�-�F�
5����1�1�&�9���
�
�$�$�V�V�4��
��Z�Z�-�-�f�5�F��
���
�
�$�$�V�V�4�r5c�(�|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"�convertr,r-�im)rr?�boxs   r
r-z	Dib.paste�s`��	���	��9�9��������D�I�I�&�B���J�J���R�U�U�C�(��J�J���R�U�U�#rc�8�|jj|�S)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`)
        )r,�	frombytes)r�buffers  r
rBz
Dib.frombytes�s���z�z�#�#�F�+�+rc�6�|jj�S)zy
        Copy display memory contents to bytes object.

        :return: A bytes object containing display data.
        )r,�tobytesrs r
rEzDib.tobytes�s���z�z�!�!�#�#rr	)rrrrrr1r7r;r-rBrErrr
r r 4s*���&
��$�,�2$�(,�$rr c�B�eZdZdZdd�Zd�Zd�Zd�Zd�Zd�Z	d	�Z
d
�Zy)�Windowz*Create a Window with the given title size.Nc�v�tjj||j|xsd|xsd�|_y)Nr)rr*�createwindow�_Window__dispatcher�hwnd)r�title�width�heights    r
rzWindow.__init__�s/���J�J�+�+��4�$�$�e�j�q�&�+�A�
��	rc�&�t|d|z�|�S)N�
ui_handle_)�getattr)r�action�argss   r
�__dispatcherzWindow.__dispatcher�s��3�w�t�\�F�2�3�T�:�:rc��yr	r�rr�x0�y0�x1�y1s      r
�ui_handle_clearzWindow.ui_handle_clear����rc��yr	r)rrWrXrYrZs     r
�ui_handle_damagezWindow.ui_handle_damage�r\rc��yr	rrs r
�ui_handle_destroyzWindow.ui_handle_destroy�r\rc��yr	rrVs      r
�ui_handle_repairzWindow.ui_handle_repair�r\rc��yr	r)rrMrNs   r
�ui_handle_resizezWindow.ui_handle_resize�r\rc�@�tjj�yr	)rr*�	eventlooprs r
�mainloopzWindow.mainloop�s��
�
�
���r)�PILNN)rrrrrrJr[r^r`rbrdrgrrr
rGrG�s-��4�
�
;�
�
�
�
�
�rrGc�*��eZdZdZd�fd�	Zd�Z�xZS)�ImageWindowz6Create an image window which displays the given image.c���t|t�st|�}||_|j\}}t�|�|||��y)N)rMrN)r/r r,r#�superr)rr,rLrMrN�	__class__s     �r
rzImageWindow.__init__�s>����%��%���J�E���
��
�
�
��v�
����e�F��;rc�D�|jj|||||f�yr	)r,r7rVs      r
rbzImageWindow.ui_handle_repair�s���
�
����R��R��,�-r)rh)rrrrrrb�
__classcell__)rms@r
rjrj�s���@�<�.rrjN)	�
__future__r�rrrr rGrjrrr
�<module>rrsD��&#������G$�G$�T��<.�&�.r

Zerion Mini Shell 1.0