B ¥.¦^ ã@sXddlmZGdd„dƒZGdd„dƒZGdd„dƒZGdd „d ƒZGd d „d eƒZd S) é)ÚImagec@s eZdZdZdd„Zdd„ZdS)Ú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. cCs ||_dS)N)Údc)Úselfr©rú0/tmp/pip-install-mwhup7aw/Pillow/PIL/ImageWin.pyÚ__init__sz HDC.__init__cCs|jS)N)r)rrrrÚ__int__!sz HDC.__int__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__rr rrrrrsrc@s eZdZdZdd„Zdd„ZdS)Ú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. cCs ||_dS)N)Úwnd)rrrrrr,sz HWND.__init__cCs|jS)N)r)rrrrr /sz HWND.__int__N)r r r r rr rrrrr%src@sNeZdZdZddd„Zdd„Zddd„Zd d „Zdd d „Zd d„Z dd„Z dS)Ú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 greylevels are allocated. For an "RGB" image, a 6x6x6 colour cube is used, together with 20 greylevels. 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. NcCsjt|dƒr"t|dƒr"|j}|j}n|}d}|dkrtobytes) )rÚ frombytes)rÚbufferrrrr)«sz Dib.frombytescCs |j ¡S)zy Copy display memory contents to bytes object. :return: A bytes object containing display data. )rÚtobytes)rrrrr+´sz Dib.tobytes)N)N)N) r r r r rrr"r%rr)r+rrrrr3s    rc@sReZdZdZddd„Zdd„Zdd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dS)ÚWindowz*Create a Window with the given title size.ÚPILNcCs"tj ||j|pd|pd¡|_dS)Nr!)rrZ createwindowÚ_Window__dispatcherZhwnd)rÚtitleÚwidthÚheightrrrrÀszWindow.__init__cGst|d|ƒ|ŽS)NZ ui_handle_)Úgetattr)rÚactionÚargsrrrZ __dispatcherÅszWindow.__dispatchercCsdS)Nr)rrÚx0Úy0Úx1Úy1rrrÚui_handle_clearÈszWindow.ui_handle_clearcCsdS)Nr)rr5r6r7r8rrrÚui_handle_damageËszWindow.ui_handle_damagecCsdS)Nr)rrrrÚui_handle_destroyÎszWindow.ui_handle_destroycCsdS)Nr)rrr5r6r7r8rrrÚui_handle_repairÑszWindow.ui_handle_repaircCsdS)Nr)rr0r1rrrÚui_handle_resizeÔszWindow.ui_handle_resizecCstj ¡dS)N)rrZ eventloop)rrrrÚmainloop×szWindow.mainloop)r-NN) r r r r rr.r9r:r;r<r=r>rrrrr,½s r,cs*eZdZdZd‡fdd„ Zdd„Z‡ZS)Ú ImageWindowz6Create an image window which displays the given image.r-cs8t|tƒst|ƒ}||_|j\}}tƒj|||d�dS)N)r0r1)rrrrÚsuperr)rrr/r0r1)Ú __class__rrrÞs   zImageWindow.__init__cCs|j |||||f¡dS)N)rr")rrr5r6r7r8rrrr<åszImageWindow.ui_handle_repair)r-)r r r r rr<Ú __classcell__rr)rArr?Ûsr?N)Úrrrrr,r?rrrrÚs