Ë
    ¦üà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y)é    )Úannotationsé   )ÚImagec                  ó    — e Zd ZdZdd„Zdd„Zy)Ú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)Úselfr   s     úJ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/PIL/ImageWin.pyÚ__init__zHDC.__init__   s	   € Øˆ�ó    c                ó   — | j                   S r	   r
   ©r   s    r   Ú__int__zHDC.__int__"   s   € Ø�w‰wˆr   N)r   ÚintÚreturnÚNone©r   r   ©Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   © r   r   r   r      s   „ ñóôr   r   c                  ó    — e Zd ZdZdd„Zdd„Zy)Ú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                ó   — || _         y r	   ©Úwnd)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‰xˆr   N)r!   r   r   r   r   r   r   r   r   r   r   &   s   „ ñóô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
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                  }|dvrt        j                  |«      }t
        j                  j                  ||«      | _	        || _        || _        |r$t        |t        «      rJ ‚| j                  |«       y y )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   r3   r/   r.   Úmsgs        r   r   zDib.__init__H   s¡   € ô �eœSÔ!ØˆDØˆEØˆ|ØC�Ü  “oÐ%à—:‘:ˆDØ—:‘:ˆDØÐ-Ñ-Ü×$Ñ$ TÓ*ˆDÜ—Z‘Z×'Ñ'¨¨dÓ3ˆŒ
ØˆŒ	ØˆŒ	ÙÜ! %¬Ô-Ð-Ð-Ø�J‰J�uÕð r   c                óZ  — t        |«      }t        |t        «      rT| j                  j	                  |«      }	 | j                  j                  |«       | j                  j                  ||«       y| j                  j                  |«       y# | j                  j                  ||«       w xY w)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   r3   ÚgetdcÚexposeÚ	releasedc)r   ÚhandleÚ
handle_intr   s       r   r8   z
Dib.expose]   s€   € ô ˜“[ˆ
Ü�fœdÔ#Ø—‘×!Ñ! *Ó-ˆBð5Ø—
‘
×!Ñ! "Ô%à—
‘
×$Ñ$ Z°Õ4à�J‰J×Ñ˜jÕ)øð —
‘
×$Ñ$ Z°Õ4ús   ¸B ÂB*c                ó„  — |€d| j                   z   }t        |«      }t        |t        «      rV| j                  j                  |«      }	 | j                  j                  |||«       | j                  j                  ||«       y| j                  j                  |||«       y# | j                  j                  ||«       w xY w)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   r3   r7   Údrawr9   )r   r:   ÚdstÚsrcr;   r   s         r   r=   zDib.drawo   s—   € ð ˆ;Ø˜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| j                  j	                  |«      }	 | j                  j                  |«      }| j                  j                  ||«       |S | j                  j                  |«      }|S # | j                  j                  ||«       w xY w)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   r3   r7   Úquery_paletter9   )r   r:   r;   Úresults       r   rA   zDib.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                  |j                  k7  r|j                  | j                  «      }|r'| j                  j	                  |j
                  |«       y| j                  j	                  |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.   Úconvertr3   r4   Úim)r   rF   Úboxs      r   r4   z	Dib.paste¤   s`   € ð 	�‰Œ	Ø�9‰9˜Ÿ™ÒØ—‘˜DŸI™IÓ&ˆBÙØ�J‰J×Ñ˜RŸU™U CÕ(à�J‰J×Ñ˜RŸU™UÕ#r   c                ó:   — | j                   j                  |«       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   rI   zDib.frombytesº   s   € ð 	�
‰
×Ñ˜VÕ$r   c                ó6   — | j                   j                  «       S )zy
        Copy display memory contents to bytes object.

        :return: A bytes object containing display data.
        )r3   Útobytesr   s    r   rL   zDib.tobytesÃ   s   € ð �z‰z×!Ñ!Ó#Ð#r   r	   )r3   zImage.Image | strr/   ztuple[int, int] | Noner   r   )r:   úint | HDC | HWNDr   r   )r:   rM   r>   ztuple[int, int, int, int]r?   ú tuple[int, int, int, int] | Noner   r   )r:   rM   r   r   )rF   zImage.ImagerG   rN   r   r   )rJ   Úbytesr   r   )r   rO   )r   r   r   r   r   r8   r=   rA   r4   rI   rL   r   r   r   r$   r$   4   s“   „ ñð( HLðØ&ðØ.Dðà	óó**ð, 15ð	2à ð2ð 'ð2ð .ð	2ð
 
ó2ó6ð6 HLð$Øð$Ø$Dð$à	ó$ó,%ô$r   r$   c                  ób   — 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y)ÚWindowz*Create a Window with the given title size.Nc                óv   — t         j                  j                  || j                  |xs d|xs d«      | _        y )Nr   )r   r1   ÚcreatewindowÚ_Window__dispatcherÚhwnd)r   ÚtitleÚwidthÚheights       r   r   zWindow.__init__Ï   s1   € ô —J‘J×+Ñ+Ø�4×$Ñ$ e¢j¨q°&²+¸Aó
ˆ�	r   c                ó(   —  t        | d|› �«      |Ž  y )NÚ
ui_handle_)Úgetattr)r   ÚactionÚargss      r   Ú__dispatcherzWindow.__dispatcherÖ   s   € Ø,Œ�˜
 6 (Ð+Ó,¨dÒ3r   c                 ó   — y r	   r   ©r   r   Úx0Úy0Úx1Úy1s         r   Úui_handle_clearzWindow.ui_handle_clearÙ   ó   € Ør   c                 ó   — y r	   r   )r   ra   rb   rc   rd   s        r   Úui_handle_damagezWindow.ui_handle_damageÜ   rf   r   c                 ó   — y r	   r   r   s    r   Úui_handle_destroyzWindow.ui_handle_destroyß   rf   r   c                 ó   — y r	   r   r`   s         r   Úui_handle_repairzWindow.ui_handle_repairâ   rf   r   c                 ó   — y r	   r   )r   rW   rX   s      r   Úui_handle_resizezWindow.ui_handle_resizeå   rf   r   c                ó@   — t         j                  j                  «        y r	   )r   r1   Ú	eventloopr   s    r   ÚmainloopzWindow.mainloopè   s   € Ü�
‰
×ÑÕr   )ÚPILNN)rV   r,   rW   ú
int | NonerX   rs   r   r   )r\   r,   r]   r   r   r   ©r   r   ra   r   rb   r   rc   r   rd   r   r   r   )
ra   r   rb   r   rc   r   rd   r   r   r   )r   r   )rW   r   rX   r   r   r   )r   r   r   r   r   rT   re   rh   rj   rl   rn   rq   r   r   r   rQ   rQ   Ì   sT   „ Ù4ð RVð
Øð
Ø)3ð
ØDNð
à	ó
ó4óóóóóôr   rQ   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.c                óŒ   •— t        |t        «      st        |«      }|| _        |j                  \  }}t        ‰| �  |||¬«       y )N)rW   rX   )r+   r$   r3   r/   Úsuperr   )r   r3   rV   rW   rX   Ú	__class__s        €r   r   zImageWindow.__init__ï   s>   ø€ Ü˜%¤Ô%Ü˜“JˆEØˆŒ
ØŸ
™
‰ˆˆvÜ‰Ñ˜ e°FÐÕ;r   c                óD   — | j                   j                  |||||f«       y r	   )r3   r=   r`   s         r   rl   zImageWindow.ui_handle_repairö   s   € Ø�
‰
�‰˜˜R  R¨Ð,Õ-r   )rr   )r3   zImage.Image | DibrV   r,   r   r   rt   )r   r   r   r   r   rl   Ú__classcell__)ry   s   @r   rv   rv   ì   s   ø„ Ù@ö<÷.r   rv   N)	Ú
__future__r   r&   r   r   r   r$   rQ   rv   r   r   r   ú<module>r}      sE   ðõ& #å ÷ñ ÷ñ ÷U$ñ U$÷pñ ô@.�&õ .r   