Team Ai
Datasetpublic

codekingpro/portable-devtools

sourceHugging Faceupdated 5mo agoView on Hugging Face
1likes15kdownloads
ImageWin.cpython-313.pyc140 linesDownload Raw Back to __pycache__
1�

2v�j� ���SSKJr SSKJr "SS5r"SS5r"SS	5r"S3S5r"SS
\5rg)�)�annotations�)�Imagec�,�\rSrSrSrSSjrSSjrSrg)	�HDC�z�4Wraps an HDC integer. The resulting object can be passed to the5:py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`6methods.7c��Xlg�N��dc)�selfrs  �RD:\code\apps\devtools\python\user_packages\Python313\site-packages\PIL/ImageWin.py�__init__�HDC.__init__s����c��UR$r8r�r
s r�__int__�HDC.__int__"s���w�w�rrN)r�int�return�None�rr��__name__�9__module__�__qualname__�__firstlineno__�__doc__rr�__static_attributes__�rrrrs����rrc�,�\rSrSrSrSSjrSSjrSrg)	�HWND�&z�10Wraps an HWND integer. The resulting object can be passed to the11:py:meth:`~PIL.ImageWin.Dib.draw` and :py:meth:`~PIL.ImageWin.Dib.expose`12methods, instead of a DC.13c��Xlgr14��wnd)r
r's  rr�
HWND.__init__-s���rc��UR$r15r&rs rr�HWND.__int__0s���x�x�rr&N)r'rrrrrr!rrr#r#&s����rr#c��\rSrSrSrSS
SjjrSSjrSSSjjrSSjrSSSjjr	SS	jr16SS17jrSrg)�Dib�4a�18A Windows bitmap with the given mode and size.  The mode can be one of "1",19"L", "P", or "RGB".20 21If the display requires a palette, this constructor creates a suitable22palette and associates it with the image. For an "L" image, 128 graylevels23are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together24with 20 graylevels.25 26To make sure that palettes work properly under Windows, you must call the27``palette`` method upon certain events from Windows.28 29:param image: Either a PIL image, or a mode string. If a mode string is30              used, a size must also be given.  The mode can be one of "1",31              "L", "P", or "RGB".32:param size: If the first argument is a mode string, this33             defines the size of the image.34Nc��[U[5(aUnSnUc
Sn[U5eOURnURnUS;a[35R"U5n[36RRX25Ul	X0lX lU(a)[U[5(aeURU5 gg)N�z+If first argument is mode, size is required)�1�L�P�RGB)�37isinstance�str�38ValueError�mode�sizer�getmodebase�core�display�image�paste)r
r<r8r7�msgs     rr�Dib.__init__Hs����e�S�!�!��D��E��|�C�� ��o�%���:�:�D��:�:�D��-�-��$�$�T�*�D��Z�Z�'�'��3��39��	��	��!�%��-�-�-�-��J�J�u��rc�`�[U5n[U[5(aSURR	U5nURRU5 URR
X#5 gURRU5 g!URR
X#5 f=f)z�40Copy the bitmap contents to a device context.41 42:param handle: Device context (HDC), cast to a Python integer, or an43               HDC or HWND instance.  In PythonWin, you can use44               ``CDC.GetHandleAttrib()`` to get a suitable handle.45N)rr4r#r<�getdc�expose�	releasedc)r
�handle�46handle_intrs    rrB�47Dib.expose]s����[�48��f�d�#�#����!�!�*�-�B�
5��49�50�!�!�"�%��51�52�$�$�Z�4��J�J���j�)���53�54�$�$�Z�4�s�B�B-c��UcSUR-n[U5n[U[5(aTURRU5nURR
XRU5 URRXE5 gURR
XBU5 g!URRXE5 f=f)a555Same as expose, but allows you to specify where to draw the image, and56what part of it to draw.57 58The destination and source areas are given as 4-tuple rectangles. If59the source is omitted, the entire image is copied. If the source and60the destination have different sizes, the image is resized as61necessary.62N)rr)r8rr4r#r<rA�drawrC)r
rD�dst�srcrErs      rrH�Dib.drawos����;��4�9�9�$�C���[�63��f�d�#�#����!�!�*�-�B�
5��64�65�����-��66�67�$�$�Z�4��J�J�O�O�J�S�1���68�69�$�$�Z�4�s�B$�$Cc�d�[U5n[U[5(aTURR	U5nURRU5nURR
X5 U$URRU5nU$!URR
X5 f=f)a70Installs the palette associated with the image in the given device71context.72 73This method should be called upon **QUERYNEWPALETTE** and74**PALETTECHANGED** events from Windows. If this method returns a75non-zero value, one or more display palette entries were changed, and76the image should be redrawn.77 78:param handle: Device context (HDC), cast to a Python integer, or an79               HDC or HWND instance.80:return: The number of entries that were changed (if one or more entries,81         this indicates that the image should be redrawn).82)rr4r#r<rA�
query_paletterC)r
rDrE�results    rrM�Dib.query_palette�s�����[�83��f�d�#�#��Z�Z�%�%�j�1�F�
5����1�1�&�9���84�85�$�$�V�4��
��Z�Z�-�-�j�9�F��
���86�87�$�$�V�4�s�B�B/c�4�UR5 URUR:waURUR5nU(a'URR	UR88U5 gURR	UR895 g)a�90Paste a PIL image into the bitmap image.91 92:param im: A PIL image.  The size must match the target region.93           If the mode does not match, the image is converted to the94           mode of the bitmap image.95:param box: A 4-tuple defining the left, upper, right, and96            lower pixel coordinate.  See :ref:`coordinate-system`. If97            None is given instead of a tuple, all of the image is98            assumed.99N)�loadr7�convertr<r=�im)r
rS�boxs   rr=�	Dib.paste�s`��	���	��9�9��������D�I�I�&�B���J�J���R�U�U�C�(��J�J���R�U�U�#rc�:�URRU5 g)z�100Load display memory contents from byte data.101 102:param buffer: A buffer containing display data (usually103               data returned from :py:func:`~PIL.ImageWin.Dib.tobytes`)104N)r<�	frombytes)r
�buffers  rrW�
Dib.frombytes�s��	
�105�106���V�$rc�6�URR5$)za107Copy display memory contents to bytes object.108 109:return: A bytes object containing display data.110)r<�tobytesrs rr[�Dib.tobytes�s���z�z�!�!�#�#r)r<r7r8r111)r<zImage.Image | strr8ztuple[int, int] | Nonerr)rD�int | HDC | HWNDrr)rDr]rIztuple[int, int, int, int]rJ� tuple[int, int, int, int] | Nonerr)rDr]rr)rSzImage.ImagerTr^rr)rX�bytesrr)rr_)
rrrrrrrBrHrMr=rWr[r r!rrr,r,4s����(HL��&��.D��	
��**�,15�	2� �2�'�2�.�	2�112113�2�6�6HL�$��$�$D�$�	
�$�,%�$rr,c�|�\rSrSrSrS
SSjjrSSjrSSjrSSjrSSjr	SS	jr114SS115jrSSjrSr
g)�Window��z*Create a Window with the given title size.Nc��[RRXRU=(d SU=(d S5Ulg)Nr)rr:�createwindow�_Window__dispatcher�hwnd)r
�title�width�heights    rr�Window.__init__�s/���J�J�+�+��$�$�e�j�q�&�+�A�116��	rc�(�[USU35"U6 g)N�117ui_handle_)�getattr)r
�action�argss   r�__dispatcher�Window.__dispatcher�s����118�6�(�+�,�d�3rc��gr119r!�r
r�x0�y0�x1�y1s      r�ui_handle_clear�Window.ui_handle_clear����rc��gr120r!)r
rtrurvrws     r�ui_handle_damage�Window.ui_handle_damage�rzrc��gr121r!rs r�ui_handle_destroy�Window.ui_handle_destroy�rzrc��gr122r!rss      r�ui_handle_repair�Window.ui_handle_repair�rzrc��gr123r!)r
rhris   r�ui_handle_resize�Window.ui_handle_resize�rzrc�@�[RR5 gr124)rr:�	eventlooprs r�mainloop�Window.mainloop�s��
�125�126���r)rf)�PILNN)rgr5rh�127int | Nonerir�rr)rnr5rorrr�rrrtrrurrvrrwrrr)128rtrrurrvrrwrrr)rr)rhrrirrr)rrrrrrrerxr|rr�r�r�r r!rrrara�sT��4�RV�129��130�)3�131�DN�132�	
�133�4�
�
�
�
�
�rrac�>^�\rSrSrSrSSU4SjjjrSSjrSrU=r$)	�ImageWindow��z6Create an image window which displays the given image.c�>�[U[5(d[U5nXlURup4[TU]X#US9 g)N)rhri)r4r,r<r8�superr)r
r<rgrhri�	__class__s     �rr�ImageWindow.__init__�s;����%��%�%���J�E��134��135�136�
��
����F��;rc�@�URRXX4U45 gr137)r<rHrss      rr��ImageWindow.ui_handle_repair�s���138�139������,�-r)r<)r�)r<zImage.Image | Dibrgr5rrr�)	rrrrrrr�r �
__classcell__)r�s@rr�r��s���@�<�<�.�.rr�N)	�140__future__rr/rrr#r,rar�r!rr�<module>r�sE��&#������U$�U$�p��@.�&�.r
codekingpro/portable-devtools · Team Ai