File: bitmap_overview.rst

package info (click to toggle)
wxpython4.0 4.2.3%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 221,752 kB
  • sloc: cpp: 962,555; python: 230,573; ansic: 170,731; makefile: 51,756; sh: 9,342; perl: 1,564; javascript: 584; php: 326; xml: 200
file content (99 lines) | stat: -rw-r--r-- 2,816 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.. include:: headings.inc


.. _bitmaps and icons:

======================================
|phoenix_title|  **Bitmaps and Icons**
======================================


The :ref:`wx.Bitmap` class encapsulates the concept of a
platform-dependent bitmap, either monochrome or colour.
Platform-specific methods for creating a :ref:`wx.Bitmap` object from
an existing file are catered for.

A bitmap created dynamically or loaded from a file can be selected
into a memory device context (an instance of :ref:`wx.MemoryDC`). This
enables the bitmap to be copied to a window or memory device context
using :meth:`wx.DC.Blit`(), or to be used as a drawing surface.

.. seealso:: :ref:`wx.MemoryDC` for an example of drawing onto a bitmap.


All wxPython platforms support XPMs for small bitmaps and icons.



.. _supported bitmap file formats:

Supported Bitmap File Formats
-----------------------------

The following lists the formats handled on different platforms. Note
that missing or partially-implemented formats are automatically
supplemented by using :ref:`wx.Image` to load the data, and then
converting it to :ref:`wx.Bitmap` form. Note that using
:ref:`wx.Image` is the preferred way to load images in wxPython, with
the exception of resources (XPM-files or native Windows resources).


wx.Bitmap
^^^^^^^^^

Under Windows, :ref:`wx.Bitmap` may load the following formats:

- Windows bitmap resource (``wx.BITMAP_TYPE_BMP_RESOURCE``)
- Windows bitmap file (``wx.BITMAP_TYPE_BMP``)
- XPM data and file (``wx.BITMAP_TYPE_XPM``)
- All formats that are supported by the :ref:`wx.Image` class.


Under wxGTK, :ref:`wx.Bitmap` may load the following formats:

- XPM data and file (``wx.BITMAP_TYPE_XPM``)
- All formats that are supported by the :ref:`wx.Image` class.


Under wxMotif and wxX11, :ref:`wx.Bitmap` may load the following formats:

- XBM data and file (``wx.BITMAP_TYPE_XBM``)
- XPM data and file (``wx.BITMAP_TYPE_XPM``)
- All formats that are supported by the :ref:`wx.Image` class.


wx.Icon
^^^^^^^

Under Windows, :ref:`wx.Icon` may load the following formats:

- Windows icon resource (``wx.BITMAP_TYPE_ICO_RESOURCE``)
- Windows icon file (``wx.BITMAP_TYPE_ICO``)
- XPM data and file (``wx.BITMAP_TYPE_XPM``)


Under wxGTK, :ref:`wx.Icon` may load the following formats:

- XPM data and file (``wx.BITMAP_TYPE_XPM``)
- All formats that are supported by the :ref:`wx.Image` class.



wx.Cursor
^^^^^^^^^

Under Windows, :ref:`wx.Cursor` may load the following formats:

- Windows cursor resource (``wx.BITMAP_TYPE_CUR_RESOURCE``)
- Windows cursor file (``wx.BITMAP_TYPE_CUR``)
- Windows icon file (``wx.BITMAP_TYPE_ICO``)
- Windows bitmap file (``wx.BITMAP_TYPE_BMP``)


Under wxGTK, :ref:`wx.Cursor` may load the following formats (in
addition to stock cursors):

- None (stock cursors only).