File: //lib/python3/dist-packages/PIL/__pycache__/ImageWin.cpython-38.pyc
U
g�
^
� @ sX d dl mZ G dd� d�ZG dd� d�ZG dd� d�ZG dd � d �ZG d
d� de�ZdS )
� )�Imagec @ s e Zd ZdZdd� 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.
c C s
|| _ d S �N��dc)�selfr � r �./usr/lib/python3/dist-packages/PIL/ImageWin.py�__init__ s zHDC.__init__c C s | j S r r �r r r r �__int__! s zHDC.__int__N��__name__�
__module__�__qualname__�__doc__r
r r r r r r s r c @ s e Zd ZdZdd� 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.
c C s
|| _ d S r ��wnd)r r r r r r
, s z
HWND.__init__c C s | j S r r r r r r r / s zHWND.__int__Nr
r r r r r % s r c @ sN e Zd ZdZddd�Zdd� Zddd�Zd d
� Zddd�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.
Nc C sj t |d�r"t |d�r"|j}|j}n|}d }|dkr<t�|�}tj�||�| _|| _|| _|rf| �|� d S )N�mode�size)�1�L�PZRGB) �hasattrr r r Zgetmodebase�coreZdisplay�image�paste)r r r r r r r r
G s
zDib.__init__c
C sJ t |t�r:| j�|�}z| j�|�}W 5 | j�||� X n| j�|�}|S )a)
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.
)�
isinstancer r �getdc� releasedc�expose)r �handler �resultr r r r"