Unlike RGB data, not all images have an alpha channel and before using
\helpref{GetAlpha}{wximagegetalpha} you should check if this image contains
-an alpha channel with \helpref{HasAlpha}{wximagehasalpha}. Note that currently only
-images loaded from PNG files with transparency information will have an alpha
-channel but alpha support will be added to the other formats as well (as well
-as support for saving images with alpha channel which also isn't implemented).
+an alpha channel with \helpref{HasAlpha}{wximagehasalpha}. Note that currently
+only the PNG format has full alpha channel support so only the images loaded
+from PNG files can have alpha and, if you initialize the image alpha channel
+yourself using \helpref{SetAlpha}{wximagesetalpha}, you should save it in PNG
+format to avoid losing it.
+
\wxheading{Available image handlers}
The following image handlers are available. {\bf wxBMPHandler} is always
installed by default. To use other image formats, install the appropriate
-handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or
+handler with \helpref{wxImage::AddHandler}{wximageaddhandler} or call
\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}.
\twocolwidtha{5cm}%
\twocolitem{\indexit{wxPCXHandler}}{For loading and saving (see below).}
\twocolitem{\indexit{wxPNMHandler}}{For loading and saving (see below).}
\twocolitem{\indexit{wxTIFFHandler}}{For loading and saving.}
+\twocolitem{\indexit{wxTGAHandler}}{For loading only.}
\twocolitem{\indexit{wxIFFHandler}}{For loading only.}
\twocolitem{\indexit{wxXPMHandler}}{For loading and saving.}
\twocolitem{\indexit{wxICOHandler}}{For loading and saving.}
<wx/image.h>
+\wxheading{Library}
+
+\helpref{wxCore}{librarieslist}
+
\wxheading{See also}
\helpref{wxBitmap}{wxbitmap},
\func{}{wxImage}{\param{const wxImage\& }{image}}
-Copy constructor.
+Copy constructor, uses \helpref{reference counting}{trefcount}.
\func{}{wxImage}{\param{const wxBitmap\&}{ bitmap}}
Loads an image from an input stream.
-\func{}{wxImage}{\param{const char** }{xpmData}}
+\func{}{wxImage}{\param{const char* const* }{xpmData}}
Creates an image from XPM data.
\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\_TGA}}{Load a TGA bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_XPM}}{Load a XPM bitmap file.}
\twocolitem{\indexit{wxBITMAP\_TYPE\_ICO}}{Load a Windows icon file (ICO).}
\twocolitem{\indexit{wxBITMAP\_TYPE\_CUR}}{Load a Windows cursor file (CUR).}
\func{}{\destruct{wxImage}}{\void}
Destructor.
+See \helpref{reference-counted object destruction}{refcountdestruct} for more info.
\membersection{wxImage::AddHandler}\label{wximageaddhandler}
\func{wxImage}{Blur}{\param{int}{ blurRadius}}
-Blurs the image in both horizontal and vertical directions by the specified pixel {\it blurRadius}.
+Blurs the image in both horizontal and vertical directions by the specified pixel
+{\it blurRadius}. This should not be used when using a single mask colour
+for transparency.
\wxheading{See also}
\func{wxImage}{BlurHorizontal}{\param{int}{ blurRadius}}
-Blurs the image in the horizontal direction only.
-
+Blurs the image in the horizontal direction only. This should not be used
+when using a single mask colour for transparency.
\wxheading{See also}
\helpref{Blur}{wximageblur}
\func{wxImage}{BlurVertical}{\param{int}{ blurRadius}}
-Blurs the image in the vertical direction only.
+Blurs the image in the vertical direction only. This should not be used
+when using a single mask colour for transparency.
\wxheading{See also}
Example:
\begin{verbatim}
- wxFileDialog FileDlg( this, "Choose Image", ::wxGetCwd(), "", _("Image Files ") + wxImage::GetImageExtWildcard(), wxOPEN );
+ wxFileDialog FileDlg( this, "Choose Image", ::wxGetCwd(), "", _("Image Files ") + wxImage::GetImageExtWildcard(), wxFD_OPEN );
\end{verbatim}
\wxheading{See also}
\wxheading{See also}
\helpref{wxImageHandler}{wximagehandler},
-\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers}
+\helpref{wxInitAllImageHandlers}{wxinitallimagehandlers},
+\helpref{wxQuantize}{wxquantize}
\membersection{wxImage::InsertHandler}\label{wximageinserthandler}
-\membersection{wxImage::Ok}\label{wximageok}
+\membersection{wxImage::IsOk}\label{wximageisok}
-\constfunc{bool}{Ok}{\void}
+\constfunc{bool}{IsOk}{\void}
Returns true if image data is present.
indicates the orientation.
+\membersection{wxImage::Paste}\label{wximagepaste}
+
+\func{void}{Paste}{\param{const wxImage\& }{image}, \param{int }{x}, \param{int }{y}}
+
+Copy the data of the given \arg{image} to the specified position in this image.
+
\membersection{wxImage::Replace}\label{wximagereplace}
\func{void}{Replace}{\param{unsigned char}{ r1}, \param{unsigned char}{ g1}, \param{unsigned char}{ b1},
scaling bitmaps in general as the only other way to scale bitmaps
is to blit a wxMemoryDC into another wxMemoryDC.
-It may be mentioned that the GTK port uses this function internally
-to scale bitmaps when using mapping modes in wxDC.
-
\docparam{quality}{Determines what method to use for resampling the image. Can be one of the following:
\twocolwidtha{5cm}%
looking results it is a slower method. Downsampling will use the box averaging method
which seems to operate very fast. If you are upsampling larger images using
this method you will most likely notice that it is a bit slower and in extreme cases
-it will be quite substantially slower as the bicubic algorithm has to process a lot of data.
+it will be quite substantially slower as the bicubic algorithm has to process a lot of
+data.
+
+It should also be noted that the high quality scaling may not work as expected
+when using a single mask colour for transparency, as the scaling will blur the
+image and will therefore remove the mask partially. Using the alpha channel
+will work.
Example:
with the given colour or cropping as necessary. The image is pasted into a new
image with the given {\it size} and background colour at the position {\it pos}
relative to the upper left of the new image. If {\it red = green = blue = -1}
-then use either the current mask colour if set or find, use, and set a
-suitable mask colour for any newly exposed areas.
+then the areas of the larger image not covered by this image are made
+transparent by filling them with the image mask colour (which will be allocated
+automatically if it isn't currently set). Otherwise, the areas will be filled
+with the colour with the specified RGB components.
\wxheading{See also}
\func{wxImage\& }{operator $=$}{\param{const wxImage\& }{image}}
-Assignment operator. This operator does not copy any data, but instead
-passes a pointer to the data in {\it image} and increments a reference
-counter. It is a fast operation.
+Assignment operator, using \helpref{reference counting}{trefcount}.
\wxheading{Parameters}
Returns 'this' object.
-\membersection{wxImage::operator $==$}\label{wximageequal}
-
-\constfunc{bool}{operator $==$}{\param{const wxImage\& }{image}}
-
-Equality operator. This operator tests whether the internal data pointers are
-equal (a fast test).
-
-\wxheading{Parameters}
-
-\docparam{image}{Image to compare with 'this'}
-
-\wxheading{Return value}
-
-Returns true if the images were effectively equal, false otherwise.
-
-
-\membersection{wxImage::operator $!=$}\label{wximagenotequal}
-
-\constfunc{bool}{operator $!=$}{\param{const wxImage\& }{image}}
-
-Inequality operator. This operator tests whether the internal data pointers are
-unequal (a fast test).
-
-\wxheading{Parameters}
-
-\docparam{image}{Image to compare with 'this'}
-
-\wxheading{Return value}
-
-Returns true if the images were unequal, false otherwise.
\section{\class{wxImageHandler}}\label{wximagehandler}
<wx/image.h>
+\wxheading{Library}
+
+\helpref{wxCore}{librarieslist}
+
\wxheading{See also}
\helpref{wxImage}{wximage},
\membersection{wxImageHandler::GetName}\label{wximagehandlergetname}
-\constfunc{wxString}{GetName}{\void}
+\constfunc{const wxString\&}{GetName}{\void}
Gets the name of this handler.
\membersection{wxImageHandler::GetExtension}\label{wximagehandlergetextension}
-\constfunc{wxString}{GetExtension}{\void}
+\constfunc{const wxString\&}{GetExtension}{\void}
Gets the file extension associated with this handler.
\membersection{wxImageHandler::GetMimeType}\label{wximagehandlergetmimetype}
-\constfunc{wxString}{GetMimeType}{\void}
+\constfunc{const wxString\&}{GetMimeType}{\void}
Gets the MIME type associated with this handler.