B .^ @sXddlmZGdddZGdddZGdddZGdd d ZGd d d eZd S) )Imagec@s eZdZdZddZddZdS)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)selfrr0/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 eZdZdZddZddZdS)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@sNeZdZdZdddZddZdddZd d Zdd d Zd dZ ddZ 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|dr"t|dr"|j}|j}n|}d}|dkrtobytes) )r frombytes)rbufferrrrr)sz Dib.frombytescCs |jS)zy Copy display memory contents to bytes object. :return: A bytes object containing display data. )rtobytes)rrrrr+sz Dib.tobytes)N)N)N) r r r r rrr"r%rr)r+rrrrr3s    rc@sReZdZdZdddZddZdd Zd d Zd d ZddZ ddZ ddZ dS)Windowz*Create a Window with the given title size.PILNcCs"tj||j|pd|pd|_dS)Nr!)rrZ createwindow_Window__dispatcherZhwnd)rtitlewidthheightrrrrszWindow.__init__cGst|d||S)NZ ui_handle_)getattr)ractionargsrrrZ __dispatcherszWindow.__dispatchercCsdS)Nr)rrx0y0x1y1rrrui_handle_clearszWindow.ui_handle_clearcCsdS)Nr)rr5r6r7r8rrrui_handle_damageszWindow.ui_handle_damagecCsdS)Nr)rrrrui_handle_destroyszWindow.ui_handle_destroycCsdS)Nr)rrr5r6r7r8rrrui_handle_repairszWindow.ui_handle_repaircCsdS)Nr)rr0r1rrrui_handle_resizeszWindow.ui_handle_resizecCstjdS)N)rrZ eventloop)rrrrmainloopszWindow.mainloop)r-NN) r r r r rr.r9r:r;r<r=r>rrrrr,s r,cs*eZdZdZdfdd ZddZZS) ImageWindowz6Create an image window which displays the given image.r-cs8t|tst|}||_|j\}}tj|||ddS)N)r0r1)rrrrsuperr)rrr/r0r1) __class__rrrs   zImageWindow.__init__cCs|j|||||fdS)N)rr")rrr5r6r7r8rrrr<szImageWindow.ui_handle_repair)r-)r r r r rr< __classcell__rr)rArr?sr?N)rrrrr,r?rrrrs