3 }\1@s`ddlmZGdddeZGdddeZGdddeZGdd d eZGd 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)selfrrd/private/var/folders/pf/wv4htv3x0qs2c2mp0dnn0kchsvlck3/T/pip-install-i584jbuk/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 |jjS)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,rrrrr1s    rc@sReZdZdZdddZddZdd Zd d Zd d ZddZ ddZ ddZ dS)Windowz*Create a Window with the given title size.PILNcCs"tjj||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)rr6r7r8r9rrrui_handle_damageszWindow.ui_handle_damagecCsdS)Nr)rrrrui_handle_destroyszWindow.ui_handle_destroycCsdS)Nr)rrr6r7r8r9rrrui_handle_repairszWindow.ui_handle_repaircCsdS)Nr)rr1r2rrrui_handle_resizeszWindow.ui_handle_resizecCstjjdS)N)rrZ eventloop)rrrrmainloopszWindow.mainloop)r.NN) r r r r rr/r:r;r<r=r>r?rrrrr-s r-c@s"eZdZdZdddZddZdS) ImageWindowz6Create an image window which displays the given image.r.cCs8t|tst|}||_|j\}}tj||||ddS)N)r1r2)rrrrr-r)rrr0r1r2rrrrs   zImageWindow.__init__cCs|jj|||||fdS)N)rr#)rrr6r7r8r9rrrr=szImageWindow.ui_handle_repairN)r.)r r r r rr=rrrrr@s r@N)robjectrrrr-r@rrrrs