\section{\class{wxImage}}\label{wximage}
This class encapsulates a platform-independent image. An image can be created
-from data, or using the constructor taking a wxBitmap object. An image
+from data, or using \helpref{wxBitmap::ConvertToImage}{wxbitmapconverttoimage}. An image
can be loaded from a file in a variety of formats, and is extensible to new formats
via image format handlers. Functions are available to set and get image bits, so
it can be used for basic image manipulation.
A wxImage cannot (currently) be drawn directly to a \helpref{wxDC}{wxdc}. Instead,
a platform-specific \helpref{wxBitmap}{wxbitmap} object must be created from it using
-the \helpref{ConvertToBitmap}{wximageconverttobitmap} function. This bitmap can then
+the \helpref{wxBitmap::wxBitmap(wxImage,int depth)}{wxbitmapconstr} constructor.
+This bitmap can then
be drawn in a device context, using \helpref{wxDC::DrawBitmap}{wxdcdrawbitmap}.
One colour value of the image may be used as a mask colour which will lead to the automatic
\twocolitem{\indexit{wxGIFHandler}}{Only for loading, due to legal issues.}
\twocolitem{\indexit{wxPCXHandler}}{For loading and saving (see below).}
\twocolitem{\indexit{wxPNMHandler}}{For loading and saving (see below).}
-\twocolitem{\indexit{wxTIFFHandler}}{For loading.}
+\twocolitem{\indexit{wxTIFFHandler}}{For loading and saving.}
+\twocolitem{\indexit{wxXPMHandler}}{For loading and saving.}
\end{twocollist}
When saving in PCX format, {\bf wxPCXHandler} will count the number of
\func{}{wxImage}{\param{const wxBitmap\&}{ bitmap}}
-Constructs an image from a platform-dependent bitmap. This preserves
+(Deprecated form, use \helpref{wxBitmap::ConvertToImage}{wxbitmapconverttoimage}
+instead.) Constructs an image from a platform-dependent bitmap. This preserves
mask information so that bitmaps and images can be converted back
and forth without loss in that respect.
Creates an image with the given width and height.
-\func{}{wxImage}{\param{int}{ width}, \param{int}{ height}, \param{unsigned char*}{ data}, \param{bool}{ static_data=FALSE}}
+\func{}{wxImage}{\param{int}{ width}, \param{int}{ height}, \param{unsigned char*}{ data}, \param{bool}{ static\_data=FALSE}}
Creates an image from given data with the given width and height. If
-{\it static_data} is TRUE, then wxImage will not delete the actual
+{\it static\_data} is TRUE, then wxImage will not delete the actual
image data in its destructor, otherwise it will free it by calling
{\it free()}.
\twocolitem{\indexit{wxBITMAP\_TYPE\_PCX}}{Load a PCX bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_PNM}}{Load a PNM bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_TIF}}{Load a TIFF bitmap file.}
+\twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
\end{twocollist}}
\helpref{wxImageHandler}{wximagehandler}
-\pythonnote{In wxPython this static method is named {\tt wxImage_AddHandler}.}
+\pythonnote{In wxPython this static method is named {\tt wxImage\_AddHandler}.}
\membersection{wxImage::CleanUpHandlers}
\func{static void}{CleanUpHandlers}{\void}
\constfunc{wxBitmap}{ConvertToBitmap}{\void}
-Converts the image to a platform-specific bitmap object. This has to be done
-to actually display an image as you cannot draw an image directly on a window.
-The resulting bitmap will use the colour depth of the current system which entails
-that a colour reduction has to take place.
+Deprecated, use equivalent \helpref{wxBitmap constructor}{wxbitmapconstr}
+(which takes wxImage and depth as its arguments) instead.
-When in 8-bit mode (PseudoColour mode), the GTK port will use a color cube created
-on program start-up to look up colors. This ensures a very fast conversion, but
-the image quality won't be perfect (and could be better for photo images using more
-sophisticated dithering algorithms).
+\membersection{wxImage::ConvertToMono}\label{wxbitmapconverttomono}
-On Windows, if there is a palette present (set with SetPalette), it will be used when
-creating the wxBitmap (most useful in 8-bit display mode). On other platforms,
-the palette is currently ignored.
+\constfunc{wxImage}{ConvertToMono}{\param{unsigned char}{ r}, \param{unsigned char}{ g}, \param{unsigned char}{ b}}
+
+Returns monochromatic version of the image. The returned image has white
+colour where the original has {\it (r,g,b)} colour and black colour
+everywhere else.
\membersection{wxImage::Copy}\label{wximagecopy}
\constfunc{const wxPalette\&}{GetPalette}{\void}
Returns the palette associated with the image. Currently the palette is only
-used in ConvertToBitmap under Windows.
+used when converting to wxBitmap under Windows.
Eventually wxImage handlers will set the palette if one exists in the image file.
\twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Load a PNG image file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Load a PNM image file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_TIF}}{Load a TIFF image file.}
+\twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Load a XPM image file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_ANY}}{Will try to autodetect the format.}
\end{twocollist}}
\twocolitem{{\bf wxBITMAP\_TYPE\_PNG}}{Save a PNG image file.}
\twocolitem{{\bf wxBITMAP\_TYPE\_PCX}}{Save a PCX image file (tries to save as 8-bit if possible, falls back to 24-bit otherwise).}
\twocolitem{{\bf wxBITMAP\_TYPE\_PNM}}{Save a PNM image file (as raw RGB always).}
+\twocolitem{{\bf wxBITMAP\_TYPE\_TIFF}}{Save a TIFF image file.}
+\twocolitem{{\bf wxBITMAP\_TYPE\_XPM}}{Save a XPM image file.}
\end{twocollist}}
\docparam{mimetype}{MIME type.}
if ( bmp.GetWidth() != 32 || bmp.GetHeight() != 32 )
{
wxImage image(bmp);
- bmp = image.Scale(32, 32).ConvertToBitmap();
+ bmp = wxBitmap(image.Scale(32, 32));
// another possibility:
image.Rescale(32, 32);
\func{void}{SetPalette}{\param{const wxPalette\&}{ palette}}
-Associates a palette with the image. The palette may be used in ConvertToBitmap (MSW only at present)
-or in file save operations (none as yet).
+Associates a palette with the image. The palette may be used when converting
+wxImage to wxBitmap (MSW only at present) or in file save operations (none as yet).
\membersection{wxImage::SetRGB}\label{wximagesetrgb}