ó
    ©RjŒ   ã                  ó‚   • S SK Jr  SSKJr   " S S5      r " S S5      r " S S	5      r " S
 S5      r " S S\5      rg)é    )Úannotationsé   )ÚImagec                  ó,   • \ rS rSrSrSS jrSS jrSrg)	ÚHDCé   z”
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                ó   • Xl         g ©N©Údc)Úselfr   s     Ú8D:\diplom_project\venv\Lib\site-packages\PIL/ImageWin.pyÚ__init__ÚHDC.__init__   s   € Ø�ó    c                ó   • U R                   $ r
   r   ©r   s    r   Ú__int__ÚHDC.__int__"   s   € Ø�w‰wˆr   r   N)r   ÚintÚreturnÚNone©r   r   ©Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   Ú__static_attributes__© r   r   r   r      s   † ñô÷r   r   c                  ó,   • \ rS rSrSrSS jrSS jrSrg)	ÚHWNDé&   z¦
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                ó   • Xl         g r
   ©Úwnd)r   r'   s     r   r   ÚHWND.__init__-   s   € Ø�r   c                ó   • U R                   $ r
   r&   r   s    r   r   ÚHWND.__int__0   s   € Ø�x‰xˆr   r&   N)r'   r   r   r   r   r   r!   r   r   r#   r#   &   s   † ñô÷r   r#   c                  ó’   • \ rS rSrSr S     SS jjrSS jr S       SS jjrSS jr S     SS jjr	SS	 jr
SS
 jrSrg)ÚDibé4   aî  
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                ó€  • [        U[        5      (       a  UnSnUc  Sn[        U5      eOUR                  nUR                  nUS;  a  [
        R                  " U5      n[
        R                  R                  X25      U l	        X0l        X l        U(       a)  [        U[        5      (       a   eU R                  U5        g g )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   r<   r8   r7   Úmsgs        r   r   ÚDib.__init__H   s¨   € ô �eœS×!Ñ!ØˆDØˆEØ‰|ØC�Ü  “oÐ%ð ð —:‘:ˆDØ—:‘:ˆDØÐ-Ó-Ü×$Ò$ TÓ*ˆDÜ—Z‘Z×'Ñ'¨Ó3ˆŒ
ØŒ	ØŒ	ÞÜ! %¬×-Ñ-Ð-Ð-Ø�J‰J�uÕð r   c                ó`  • [        U5      n[        U[        5      (       aS  U R                  R	                  U5      n U R                  R                  U5        U R                  R                  X#5        gU R                  R                  U5        g! U R                  R                  X#5        f = f)zø
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   r4   r#   r<   ÚgetdcÚexposeÚ	releasedc)r   ÚhandleÚ
handle_intr   s       r   rB   Ú
Dib.expose]   s   € ô ˜“[ˆ
Ü�fœd×#Ñ#Ø—‘×!Ñ! *Ó-ˆBð5Ø—
‘
×!Ñ! "Ô%à—
‘
×$Ñ$ ZÕ4à�J‰J×Ñ˜jÕ)øð —
‘
×$Ñ$ ZÕ4ús   ½B ÂB-c                óˆ  • Uc  SU R                   -   n[        U5      n[        U[        5      (       aT  U R                  R                  U5      n U R                  R                  XRU5        U R                  R                  XE5        gU R                  R                  XBU5        g! U R                  R                  XE5        f = f)a5  
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   )r8   r   r4   r#   r<   rA   ÚdrawrC   )r   rD   ÚdstÚsrcrE   r   s         r   rH   ÚDib.drawo   s’   € ð ‰;Ø˜4Ÿ9™9Ñ$ˆCÜ˜“[ˆ
Ü�fœd×#Ñ#Ø—‘×!Ñ! *Ó-ˆBð5Ø—
‘
—‘ ¨Ô-à—
‘
×$Ñ$ ZÕ4à�J‰J�O‰O˜J¨SÕ1øð —
‘
×$Ñ$ ZÕ4ús   ÁB$ Â$Cc                ód  • [        U5      n[        U[        5      (       aT  U R                  R	                  U5      n U R                  R                  U5      nU R                  R                  X5        U$ U R                  R                  U5      nU$ ! U R                  R                  X5        f = f)a  
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   r4   r#   r<   rA   Úquery_paletterC   )r   rD   rE   Úresults       r   rM   ÚDib.query_paletteŠ   s‘   € ô ˜“[ˆ
Ü�fœd×#Ñ#Ø—Z‘Z×%Ñ% jÓ1ˆFð5ØŸ™×1Ñ1°&Ó9�à—
‘
×$Ñ$ VÔ4ð ˆð —Z‘Z×-Ñ-¨jÓ9ˆFØˆøð —
‘
×$Ñ$ VÕ4ús   ½B ÂB/c                ó4  • UR                  5         U R                  UR                  :w  a  UR                  U R                  5      nU(       a'  U R                  R	                  UR
                  U5        gU R                  R	                  UR
                  5        g)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)Úloadr7   Úconvertr<   r=   Úim)r   rS   Úboxs      r   r=   Ú	Dib.paste¤   s`   € ð 	�‰Œ	Ø�9‰9˜Ÿ™ÓØ—‘˜DŸI™IÓ&ˆBÞØ�J‰J×Ñ˜RŸU™U CÕ(à�J‰J×Ñ˜RŸU™UÕ#r   c                ó:   • U R                   R                  U5        g)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   Úbuffers     r   rW   ÚDib.frombytesº   s   € ð 	�
‰
×Ñ˜VÕ$r   c                ó6   • U R                   R                  5       $ )za
Copy display memory contents to bytes object.

:return: A bytes object containing display data.
)r<   Útobytesr   s    r   r[   ÚDib.tobytesÃ   s   € ð �z‰z×!Ñ!Ó#Ð#r   )r<   r7   r8   r
   )r<   zImage.Image | strr8   ztuple[int, int] | Noner   r   )rD   úint | HDC | HWNDr   r   )rD   r]   rI   ztuple[int, int, int, int]rJ   ú tuple[int, int, int, int] | Noner   r   )rD   r]   r   r   )rS   zImage.ImagerT   r^   r   r   )rX   Úbytesr   r   )r   r_   )r   r   r   r   r   r   rB   rH   rM   r=   rW   r[   r    r!   r   r   r,   r,   4   s“   † ñð( HLðØ&ðØ.Dðà	õô**ð, 15ð	2à ð2ð 'ð2ð .ð	2ð
 
õ2ô6ð6 HLð$Øð$Ø$Dð$à	õ$ô,%÷$r   r,   c                  ó|   • \ rS rSrSr S       SS jjrSS jrSS jrSS jrSS jr	SS	 jr
SS
 jrSS jrSrg)ÚWindowéÌ   z*Create a Window with the given title size.Nc                óˆ   • [         R                  R                  XR                  U=(       d    SU=(       d    S5      U l        g )Nr   )r   r:   ÚcreatewindowÚ_Window__dispatcherÚhwnd)r   ÚtitleÚwidthÚheights       r   r   ÚWindow.__init__Ï   s/   € ô —J‘J×+Ñ+Ø×$Ñ$ e§j¨q°&·+¸Aó
ˆ�	r   c                ó(   • [        U SU 35      " U6   g )NÚ
ui_handle_)Úgetattr)r   ÚactionÚargss      r   Ú__dispatcherÚWindow.__dispatcherÖ   s   € Ü�˜
 6 (Ð+Ô,¨dÒ3r   c                ó   • g r
   r!   ©r   r   Úx0Úy0Úx1Úy1s         r   Úui_handle_clearÚWindow.ui_handle_clearÙ   ó   € Ør   c                ó   • g r
   r!   )r   rt   ru   rv   rw   s        r   Úui_handle_damageÚWindow.ui_handle_damageÜ   rz   r   c                ó   • g r
   r!   r   s    r   Úui_handle_destroyÚWindow.ui_handle_destroyß   rz   r   c                ó   • g r
   r!   rs   s         r   Úui_handle_repairÚWindow.ui_handle_repairâ   rz   r   c                ó   • g r
   r!   )r   rh   ri   s      r   Úui_handle_resizeÚWindow.ui_handle_resizeå   rz   r   c                ó@   • [         R                  R                  5         g r
   )r   r:   Ú	eventloopr   s    r   ÚmainloopÚWindow.mainloopè   s   € Ü�
‰
×ÑÕr   )rf   )ÚPILNN)rg   r5   rh   ú
int | Noneri   rŒ   r   r   )rn   r5   ro   r   r   r   ©r   r   rt   r   ru   r   rv   r   rw   r   r   r   )
rt   r   ru   r   rv   r   rw   r   r   r   )r   r   )rh   r   ri   r   r   r   )r   r   r   r   r   r   re   rx   r|   r   r‚   r…   r‰   r    r!   r   r   ra   ra   Ì   sT   † Ù4ð RVð
Øð
Ø)3ð
ØDNð
à	õ
ô4ôôôôô÷r   ra   c                  ó>   ^ • \ rS rSrSrSSU 4S jjjrSS jrSrU =r$ )	ÚImageWindowéì   z6Create an image window which displays the given image.c                óŠ   >• [        U[        5      (       d  [        U5      nXl        UR                  u  p4[        TU ]  X#US9  g )N)rh   ri   )r4   r,   r<   r8   Úsuperr   )r   r<   rg   rh   ri   Ú	__class__s        €r   r   ÚImageWindow.__init__ï   s;   ø€ Ü˜%¤×%Ñ%Ü˜“JˆEØŒ
ØŸ
™
‰ˆÜ‰Ñ˜°FÐÒ;r   c                ó@   • U R                   R                  XX4U45        g r
   )r<   rH   rs   s         r   r‚   ÚImageWindow.ui_handle_repairö   s   € Ø�
‰
�‰˜ ¨Ð,Õ-r   )r<   )r‹   )r<   zImage.Image | Dibrg   r5   r   r   r�   )	r   r   r   r   r   r   r‚   r    Ú__classcell__)r“   s   @r   r�   r�   ì   s   ø† Ù@÷<ñ <÷.ò .r   r�   N)	Ú
__future__r   r/   r   r   r#   r,   ra   r�   r!   r   r   Ú<module>r™      sE   ðõ& #å ÷ñ ÷ñ ÷U$ñ U$÷pñ ô@.�&õ .r   