§
    aÒ³g•  ã                  ó¢   — d dl mZ ddlmZ  G d„ d¦  «        Z G d„ d¦  «        Z G d„ d	¦  «        Z G d
„ d¦  «        Z G d„ de¦  «        ZdS )é    )Úannotationsé   )ÚImagec                  ó"   — e Zd ZdZd	d„Zd
d„ZdS )Ú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.
    ÚdcÚintÚreturnÚNonec                ó   — || _         d S ©N©r   )Úselfr   s     úJ/var/www/html/mpstechhub/venv/lib/python3.11/site-packages/PIL/ImageWin.pyÚ__init__zHDC.__init__   s   € ØˆŒˆˆó    c                ó   — | j         S r   r   ©r   s    r   Ú__int__zHDC.__int__"   s	   € ØŒwˆr   N)r   r	   r
   r   ©r
   r	   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   © r   r   r   r      sF   € € € € € ðð ðð ð ð ðð ð ð ð ð r   r   c                  ó"   — e Zd ZdZd	d„Zd
d„ZdS )Ú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.
    Úwndr	   r
   r   c                ó   — || _         d S r   ©r   )r   r   s     r   r   zHWND.__init__-   s   € ØˆŒˆˆr   c                ó   — | j         S r   r!   r   s    r   r   zHWND.__int__0   s	   € ØŒxˆr   N)r   r	   r
   r   r   r   r   r   r   r   r   &   sF   € € € € € ðð ðð ð ð ðð ð ð ð ð r   r   c                  óV   — e Zd ZdZ	 ddd	„Zdd„Z	 ddd„Zd d„Z	 dd!d„Zd"d„Z	d#d„Z
dS )$Ú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.
    NÚimageúImage.Image | strÚsizeútuple[int, int] | Noner
   r   c                ór  — t          |t          ¦  «        r|}d}|€d}t          |¦  «        ‚n|j        }|j        }|dvrt          j        |¦  «        }t
          j                             ||¦  «        | _	        || _        || _        |r.t          |t          ¦  «        rJ ‚|  
                    |¦  «         d S d S )NÚ z+If first argument is mode, size is required)Ú1ÚLÚPÚRGB)Ú
isinstanceÚstrÚ
ValueErrorÚmoder'   r   ÚgetmodebaseÚcoreÚdisplayr%   Úpaste)r   r%   r'   r2   Úmsgs        r   r   zDib.__init__H   sÎ   € õ �e�SÑ!Ô!ð 	ØˆDØˆEØˆ|ØC�Ý  ‘o”oÐ%ð ð ”:ˆDØ”:ˆDØÐ-Ð-Ð-ÝÔ$ TÑ*Ô*ˆDÝ”Z×'Ò'¨¨dÑ3Ô3ˆŒ
ØˆŒ	ØˆŒ	Øð 	Ý! %­Ñ-Ô-Ð-Ð-Ð-Ø�JŠJ�uÑÔÐÐÐð	ð 	r   Úhandleúint | HDC | HWNDc                óf  — t          |¦  «        }t          |t          ¦  «        rr| j                             |¦  «        }	 | j                             |¦  «         | j                             ||¦  «         dS # | j                             ||¦  «         w xY w| j                             |¦  «         dS )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)r	   r/   r   r%   ÚgetdcÚexposeÚ	releasedc)r   r8   Ú
handle_intr   s       r   r<   z
Dib.expose]   s©   € õ ˜‘[”[ˆ
Ý�f�dÑ#Ô#ð 	*Ø”×!Ò! *Ñ-Ô-ˆBð5Ø”
×!Ò! "Ñ%Ô%Ð%à”
×$Ò$ Z°Ñ4Ô4Ð4Ð4Ð4ø�”
×$Ò$ Z°Ñ4Ô4Ð4Ð4øøøàŒJ×Ò˜jÑ)Ô)Ð)Ð)Ð)s   Á A7 Á7BÚdstútuple[int, int, int, int]Úsrcú tuple[int, int, int, int] | Nonec                ó†  — |€
d| j         z   }t          |¦  «        }t          |t          ¦  «        rt| j                             |¦  «        }	 | j                             |||¦  «         | j                             ||¦  «         dS # | j                             ||¦  «         w xY w| j                             |||¦  «         dS )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)r   r   )r'   r	   r/   r   r%   r;   Údrawr=   )r   r8   r?   rA   r>   r   s         r   rD   zDib.drawo   s¾   € ð ˆ;Ø˜4œ9Ñ$ˆCÝ˜‘[”[ˆ
Ý�f�dÑ#Ô#ð 	2Ø”×!Ò! *Ñ-Ô-ˆBð5Ø”
—’  C¨Ñ-Ô-Ð-à”
×$Ò$ Z°Ñ4Ô4Ð4Ð4Ð4ø�”
×$Ò$ Z°Ñ4Ô4Ð4Ð4øøøàŒJ�OŠO˜J¨¨SÑ1Ô1Ð1Ð1Ð1s   ÁB ÂB"r	   c                ód  — t          |¦  «        }t          |t          ¦  «        rq| j                             |¦  «        }	 | j                             |¦  «        }| j                             ||¦  «         n:# | j                             ||¦  «         w xY w| j                             |¦  «        }|S )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).
        )r	   r/   r   r%   r;   Úquery_paletter=   )r   r8   r>   Úresults       r   rF   zDib.query_paletteŠ   s£   € õ ˜‘[”[ˆ
Ý�f�dÑ#Ô#ð 	:Ø”Z×%Ò% jÑ1Ô1ˆFð5Øœ×1Ò1°&Ñ9Ô9�à”
×$Ò$ V¨VÑ4Ô4Ð4Ð4ø�”
×$Ò$ V¨VÑ4Ô4Ð4Ð4øøøà”Z×-Ò-¨jÑ9Ô9ˆFØˆs   Á A6 Á6BÚimúImage.ImageÚboxc                ó  — |                      ¦   «          | j        |j        k    r|                     | j        ¦  «        }|r"| j                             |j        |¦  «         dS | j                             |j        ¦  «         dS )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)Úloadr2   Úconvertr%   r6   rH   )r   rH   rJ   s      r   r6   z	Dib.paste¤   sy   € ð 	�Š‰	Œ	ˆ	ØŒ9˜œÒÐØ—’˜DœIÑ&Ô&ˆBØð 	$ØŒJ×Ò˜RœU CÑ(Ô(Ð(Ð(Ð(àŒJ×Ò˜RœUÑ#Ô#Ð#Ð#Ð#r   ÚbufferÚbytesc                ó:   — | j                              |¦  «         d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`)
        N)r%   Ú	frombytes)r   rN   s     r   rQ   zDib.frombytesº   s    € ð 	Œ
×Ò˜VÑ$Ô$Ð$Ð$Ð$r   c                ó4   — | j                              ¦   «         S )zy
        Copy display memory contents to bytes object.

        :return: A bytes object containing display data.
        )r%   Útobytesr   s    r   rS   zDib.tobytesÃ   s   € ð Œz×!Ò!Ñ#Ô#Ð#r   r   )r%   r&   r'   r(   r
   r   )r8   r9   r
   r   )r8   r9   r?   r@   rA   rB   r
   r   )r8   r9   r
   r	   )rH   rI   rJ   rB   r
   r   )rN   rO   r
   r   )r
   rO   )r   r   r   r   r   r<   rD   rF   r6   rQ   rS   r   r   r   r$   r$   4   sÌ   € € € € € ðð ð( HLðð ð ð ð ð**ð *ð *ð *ð, 15ð	2ð 2ð 2ð 2ð 2ð6ð ð ð ð6 HLð$ð $ð $ð $ð $ð,%ð %ð %ð %ð$ð $ð $ð $ð $ð $r   r$   c                  óV   — e Zd ZdZ	 ddd„Zdd„Zdd„Zdd„Zd d„Zdd„Z	d!d„Z
d d„ZdS )"ÚWindowz*Create a Window with the given title size.ÚPILNÚtitler0   Úwidthú
int | NoneÚheightr
   r   c                óf   — t           j                             || j        |pd|pd¦  «        | _        d S )Nr   )r   r4   ÚcreatewindowÚ_Window__dispatcherÚhwnd)r   rW   rX   rZ   s       r   r   zWindow.__init__Ï   s5   € õ ”J×+Ò+Ø�4Ô$ e j¨q°&°+¸Añ
ô 
ˆŒ	ˆ	ˆ	r   ÚactionÚargsr	   c                ó2   —  t          | d|› �¦  «        |Ž  d S )NÚ
ui_handle_)Úgetattr)r   r_   r`   s      r   Ú__dispatcherzWindow.__dispatcherÖ   s(   € Ø,��Ð+ 6Ð+Ð+Ñ,Ô,¨dÐ3Ð3Ð3Ð3r   r   Úx0Úy0Úx1Úy1c                ó   — d S r   r   ©r   r   re   rf   rg   rh   s         r   Úui_handle_clearzWindow.ui_handle_clearÙ   ó   € Øˆr   c                ó   — d S r   r   )r   re   rf   rg   rh   s        r   Úui_handle_damagezWindow.ui_handle_damageÜ   rl   r   c                ó   — d S r   r   r   s    r   Úui_handle_destroyzWindow.ui_handle_destroyß   rl   r   c                ó   — d S r   r   rj   s         r   Úui_handle_repairzWindow.ui_handle_repairâ   rl   r   c                ó   — d S r   r   )r   rX   rZ   s      r   Úui_handle_resizezWindow.ui_handle_resizeå   rl   r   c                óB   — t           j                             ¦   «          d S r   )r   r4   Ú	eventloopr   s    r   ÚmainloopzWindow.mainloopè   s   € ÝŒ
×ÒÑÔÐÐÐr   )rV   NN)rW   r0   rX   rY   rZ   rY   r
   r   )r_   r0   r`   r	   r
   r   ©r   r	   re   r	   rf   r	   rg   r	   rh   r	   r
   r   )
re   r	   rf   r	   rg   r	   rh   r	   r
   r   )r
   r   )rX   r	   rZ   r	   r
   r   )r   r   r   r   r   r]   rk   rn   rp   rr   rt   rw   r   r   r   rU   rU   Ì   sÆ   € € € € € Ø4Ð4ð RVð
ð 
ð 
ð 
ð 
ð4ð 4ð 4ð 4ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ðð ð ð ð ð r   rU   c                  ó.   ‡ — e Zd ZdZddˆ fd	„Zdd„Zˆ xZS )ÚImageWindowz6Create an image window which displays the given image.rV   r%   úImage.Image | DibrW   r0   r
   r   c                óº   •— t          |t          ¦  «        st          |¦  «        }|| _        |j        \  }}t	          ¦   «                              |||¬¦  «         d S )N)rX   rZ   )r/   r$   r%   r'   Úsuperr   )r   r%   rW   rX   rZ   Ú	__class__s        €r   r   zImageWindow.__init__ï   sW   ø€ Ý˜%¥Ñ%Ô%ð 	Ý˜‘J”JˆEØˆŒ
Øœ
‰ˆˆvÝ‰Œ×Ò˜ e°FÐÑ;Ô;Ð;Ð;Ð;r   r   r	   re   rf   rg   rh   c                óD   — | j                              |||||f¦  «         d S r   )r%   rD   rj   s         r   rr   zImageWindow.ui_handle_repairö   s'   € ØŒ
�Š˜˜R  R¨Ð,Ñ-Ô-Ð-Ð-Ð-r   )rV   )r%   r{   rW   r0   r
   r   rx   )r   r   r   r   r   rr   Ú__classcell__)r~   s   @r   rz   rz   ì   s\   ø€ € € € € Ø@Ð@ð<ð <ð <ð <ð <ð <ð <ð.ð .ð .ð .ð .ð .ð .ð .r   rz   N)	Ú
__future__r   r*   r   r   r   r$   rU   rz   r   r   r   ú<module>r‚      s	  ðð& #Ð "Ð "Ð "Ð "Ð "à Ð Ð Ð Ð Ð ðð ð ð ð ñ ô ð ðð ð ð ð ñ ô ð ðU$ð U$ð U$ð U$ð U$ñ U$ô U$ð U$ðpð ð ð ð ñ ô ð ð@.ð .ð .ð .ð .�&ñ .ô .ð .ð .ð .r   