ó <×ï[c@s‚ddlmZdefd„ƒYZdefd„ƒYZdefd„ƒYZdefd „ƒYZd efd „ƒYZd S( i(tImagetHDCcBs eZdZd„Zd„ZRS(s¤ 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(tdc(tselfR((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyt__init__scCs|jS(N(R(R((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyt__int__ s(t__name__t __module__t__doc__RR(((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyRs tHWNDcBs eZdZd„Zd„ZRS(s¶ 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(twnd(RR ((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR*scCs|jS(N(R (R((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR-s(RRRRR(((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR $s tDibcBsVeZdZdd„Zd„Zdd„Zd„Zdd„Zd„Z d„Z RS( s& 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. cCs¡t|dƒr3t|dƒr3|j}|j}n |}d}|dkr]tj|ƒ}ntjj||ƒ|_||_||_|r|j |ƒndS(Ntmodetsizet1tLtPtRGB(RRRR( thasattrR R tNoneRt getmodebasetcoretdisplaytimagetpaste(RRR R ((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyREs     cCsgt|tƒrQ|jj|ƒ}z|jj|ƒ}Wd|jj||ƒXn|jj|ƒ}|S(s) 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 the :py:meth:`CDC.GetHandleAttrib` to get a suitable handle. N(t isinstanceR Rtgetdctexposet releasedc(RthandleRtresult((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyRTscCs‰|sd|j}nt|tƒrm|jj|ƒ}z|jj|||ƒ}Wd|jj||ƒXn|jj|||ƒ}|S(sm 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. iN(ii(R RR RRtdrawR(RRtdsttsrcRR((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyRfs cCsgt|tƒrQ|jj|ƒ}z|jj|ƒ}Wd|jj||ƒXn|jj|ƒ}|S(se 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: A true value if one or more entries were changed (this indicates that the image should be redrawn). N(RR RRt query_paletteR(RRR((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR"|scCsg|jƒ|j|jkr1|j|jƒ}n|rP|jj|j|ƒn|jj|jƒdS(sõ 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(tloadR tconvertRRtim(RR%tbox((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR•s cCs|jj|ƒS(sº Load display memory contents from byte data. :param buffer: A buffer containing display data (usually data returned from tobytes) (Rt frombytes(Rtbuffer((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR'©scCs |jjƒS(sy Copy display memory contents to bytes object. :return: A bytes object containing display data. (Rttobytes(R((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR)²sN( RRRRRRRR"RR'R)(((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR 1s      tWindowcBs_eZdZdd d d„Zd„Zd„Zd„Zd„Zd„Z d„Z d „Z RS( s*Create a Window with the given title size.tPILcCs1tjj||j|pd|p$dƒ|_dS(Ni(RRt createwindowt_Window__dispatcherthwnd(Rttitletwidththeight((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR¾s cGst|d|ƒ|ŒS(Nt ui_handle_(tgetattr(Rtactiontargs((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyt __dispatcherÃscCsdS(N((RRtx0ty0tx1ty1((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pytui_handle_clearÆscCsdS(N((RR7R8R9R:((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pytui_handle_damageÉscCsdS(N((R((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pytui_handle_destroyÌscCsdS(N((RRR7R8R9R:((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pytui_handle_repairÏscCsdS(N((RR0R1((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pytui_handle_resizeÒscCstjjƒdS(N(RRt eventloop(R((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pytmainloopÕsN( RRRRRR-R;R<R=R>R?RA(((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR*»s      t ImageWindowcBs#eZdZdd„Zd„ZRS(s6Create an image window which displays the given image.R+cCsVt|tƒst|ƒ}n||_|j\}}tj||d|d|ƒdS(NR0R1(RR RR R*R(RRR/R0R1((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyRÜs  cCs#|jj|||||fƒdS(N(RR(RRR7R8R9R:((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyR>ãs(RRRRR>(((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyRBÙs N(tRtobjectRR R R*RB(((s,/tmp/pip-build-SKekGm/pillow/PIL/ImageWin.pyts   Š