mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-24 17:06:16 +03:00
a7e3b2e47b
There are two main issues fixed with this commit: * bytes vs. str: All file, image, and palette data are now handled as bytes. A new _binary module consolidates the hacks needed to do this across Python versions. tostring/fromstring methods have been renamed to tobytes/frombytes, but the Python 2.6/2.7 versions alias them to the old names for compatibility. Users should move to tobytes/frombytes. One other potentially-breaking change is that text data in image files (such as tags, comments) are now explicitly handled with a specific character encoding in mind. This works well with the Unicode str in Python 3, but may trip up old code expecting a straight byte-for-byte translation to a Python string. This also required a change to Gohlke's tags tests (in Tests/test_file_png.py) to expect Unicode strings from the code. * True div vs. floor div: Many division operations used the "/" operator to do floor division, which is now the "//" operator in Python 3. These were fixed. As of this commit, on the first pass, I have one failing test (improper handling of a slice object in a C module, test_imagepath.py) in Python 3, and three that that I haven't tried running yet (test_imagegl, test_imagegrab, and test_imageqt). I also haven't tested anything on Windows. All but the three skipped tests run flawlessly against Pythons 2.6 and 2.7.
108 lines
3.3 KiB
ReStructuredText
108 lines
3.3 KiB
ReStructuredText
=======================
|
|
The PIL.ImageWin Module
|
|
=======================
|
|
|
|
The PIL.ImageWin Module
|
|
=======================
|
|
|
|
**Dib(image, size=None)** (class) [`# <#PIL.ImageWin.Dib-class>`_]
|
|
Create a Windows bitmap with the given mode and size.
|
|
|
|
For more information about this class, see `*The Dib
|
|
Class* <#PIL.ImageWin.Dib-class>`_.
|
|
|
|
**HDC(dc)** (class) [`# <#PIL.ImageWin.HDC-class>`_]
|
|
The ImageWin module contains support to create and display images
|
|
under Windows 95/98, NT, 2000 and later.
|
|
|
|
For more information about this class, see `*The HDC
|
|
Class* <#PIL.ImageWin.HDC-class>`_.
|
|
|
|
**ImageWindow(image, title="PIL")** (class)
|
|
[`# <#PIL.ImageWin.ImageWindow-class>`_]
|
|
Create an image window which displays the given image.
|
|
|
|
For more information about this class, see `*The ImageWindow
|
|
Class* <#PIL.ImageWin.ImageWindow-class>`_.
|
|
|
|
**Window(title="PIL", width=None, height=None)** (class)
|
|
[`# <#PIL.ImageWin.Window-class>`_]
|
|
Create a Window with the given title size.
|
|
|
|
For more information about this class, see `*The Window
|
|
Class* <#PIL.ImageWin.Window-class>`_.
|
|
|
|
The Dib Class
|
|
-------------
|
|
|
|
**Dib(image, size=None)** (class) [`# <#PIL.ImageWin.Dib-class>`_]
|
|
Create 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.
|
|
|
|
**\_\_init\_\_(image, size=None)**
|
|
[`# <#PIL.ImageWin.Dib.__init__-method>`_]
|
|
|
|
*image*
|
|
*size*
|
|
|
|
**expose(handle)** [`# <#PIL.ImageWin.Dib.expose-method>`_]
|
|
|
|
*handle*
|
|
Device context (HDC), cast to a Python integer, or a HDC or HWND
|
|
instance. In PythonWin, you can use the **GetHandleAttrib**
|
|
method of the **CDC** class to get a suitable handle.
|
|
|
|
**frombytes(buffer)** [`# <#PIL.ImageWin.Dib.frombytes-method>`_]
|
|
(For Python 2.6/2.7, this is also available as fromstring(buffer).)
|
|
|
|
*buffer*
|
|
A byte buffer containing display data (usually data returned
|
|
from **tobytes**)
|
|
|
|
**paste(im, box=None)** [`# <#PIL.ImageWin.Dib.paste-method>`_]
|
|
|
|
*im*
|
|
*box*
|
|
|
|
**query\_palette(handle)**
|
|
[`# <#PIL.ImageWin.Dib.query_palette-method>`_]
|
|
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.
|
|
|
|
*handle*
|
|
Returns:
|
|
|
|
**tobytes()** [`# <#PIL.ImageWin.Dib.tobytes-method>`_]
|
|
|
|
Returns:
|
|
|
|
The HDC Class
|
|
-------------
|
|
|
|
**HDC(dc)** (class) [`# <#PIL.ImageWin.HDC-class>`_]
|
|
The **ImageWin** module contains support to create and display
|
|
images under Windows 95/98, NT, 2000 and later.
|
|
|
|
The ImageWindow Class
|
|
---------------------
|
|
|
|
**ImageWindow(image, title="PIL")** (class)
|
|
[`# <#PIL.ImageWin.ImageWindow-class>`_]
|
|
|
|
The Window Class
|
|
----------------
|
|
|
|
**Window(title="PIL", width=None, height=None)** (class)
|
|
[`# <#PIL.ImageWin.Window-class>`_]
|