+ Returns @true if this image has alpha channel, @false otherwise.
+
+ @see GetAlpha(), SetAlpha()
+ */
+ bool HasAlpha() const;
+
+ /**
+ Returns @true if there is a mask active, @false otherwise.
+ */
+ bool HasMask() const;
+
+ /**
+ Returns @true if the given option is present.
+ The function is case-insensitive to @a name.
+
+ The lists of the currently supported options are in GetOption() and
+ GetOptionInt() function docs.
+
+ @see SetOption(), GetOption(), GetOptionInt()
+ */
+ bool HasOption(const wxString& name) const;
+
+ /**
+ Returns @true if image data is present.
+ */
+ bool IsOk() const;
+
+ /**
+ Returns @true if the given pixel is transparent, i.e. either has the mask
+ colour if this image has a mask or if this image has alpha channel and alpha
+ value of this pixel is strictly less than @a threshold.
+ */
+ bool IsTransparent(int x, int y,
+ unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD) const;
+
+ //@}
+
+
+ /**
+ @name Loading and saving functions
+ */
+ //@{
+
+ /**
+ Loads an image from an input stream.
+
+ @param stream
+ Opened input stream from which to load the image.
+ Currently, the stream must support seeking.
+ @param type
+ May be one of the following:
+ @li wxBITMAP_TYPE_BMP: Load a Windows bitmap file.
+ @li wxBITMAP_TYPE_GIF: Load a GIF bitmap file.
+ @li wxBITMAP_TYPE_JPEG: Load a JPEG bitmap file.
+ @li wxBITMAP_TYPE_PNG: Load a PNG bitmap file.
+ @li wxBITMAP_TYPE_PCX: Load a PCX bitmap file.
+ @li wxBITMAP_TYPE_PNM: Load a PNM bitmap file.
+ @li wxBITMAP_TYPE_TIFF: Load a TIFF bitmap file.
+ @li wxBITMAP_TYPE_TGA: Load a TGA bitmap file.
+ @li wxBITMAP_TYPE_XPM: Load a XPM bitmap file.
+ @li wxBITMAP_TYPE_ICO: Load a Windows icon file (ICO).
+ @li wxBITMAP_TYPE_CUR: Load a Windows cursor file (CUR).
+ @li wxBITMAP_TYPE_ANI: Load a Windows animated cursor file (ANI).
+ @li wxBITMAP_TYPE_ANY: Will try to autodetect the format.
+ @param index
+ Index of the image to load in the case that the image file contains
+ multiple images. This is only used by GIF, ICO and TIFF handlers.
+ The default value (-1) means "choose the default image" and is
+ interpreted as the first image (index=0) by the GIF and TIFF handler
+ and as the largest and most colourful one by the ICO handler.
+
+ @return @true if the operation succeeded, @false otherwise.
+ If the optional index parameter is out of range, @false is
+ returned and a call to wxLogError() takes place.
+
+ @remarks Depending on how wxWidgets has been configured, not all formats
+ may be available.
+
+ @note
+ You can use GetOptionInt() to get the hotspot when loading cursor files:
+ @code
+ int hotspot_x = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_X);
+ int hotspot_y = image.GetOptionInt(wxIMAGE_OPTION_CUR_HOTSPOT_Y);
+ @endcode
+
+ @see SaveFile()
+ */
+ virtual bool LoadFile(wxInputStream& stream,
+ wxBitmapType type = wxBITMAP_TYPE_ANY,
+ int index = -1);
+
+ /**
+ Loads an image from a file.
+ If no handler type is provided, the library will try to autodetect the format.
+
+ @param name
+ Name of the file from which to load the image.
+ @param type
+ See the description in the LoadFile(wxInputStream&, wxBitmapType, int) overload.
+ @param index
+ See the description in the LoadFile(wxInputStream&, wxBitmapType, int) overload.
+ */
+ virtual bool LoadFile(const wxString& name,
+ wxBitmapType type = wxBITMAP_TYPE_ANY,
+ int index = -1);
+
+ /**
+ Loads an image from a file.
+ If no handler type is provided, the library will try to autodetect the format.
+
+ @param name
+ Name of the file from which to load the image.
+ @param mimetype
+ MIME type string (for example 'image/jpeg')
+ @param index
+ See the description in the LoadFile(wxInputStream&, wxBitmapType, int) overload.
+ */
+ virtual bool LoadFile(const wxString& name, const wxString& mimetype,
+ int index = -1);
+
+ /**
+ Loads an image from an input stream.
+
+ @param stream
+ Opened input stream from which to load the image.
+ Currently, the stream must support seeking.
+ @param mimetype
+ MIME type string (for example 'image/jpeg')
+ @param index
+ See the description in the LoadFile(wxInputStream&, wxBitmapType, int) overload.
+ */
+ virtual bool LoadFile(wxInputStream& stream, const wxString& mimetype,
+ int index = -1);
+
+ /**
+ Saves an image in the given stream.
+
+ @param stream
+ Opened output stream to save the image to.
+ @param mimetype
+ MIME type.
+
+ @return @true if the operation succeeded, @false otherwise.
+
+ @remarks Depending on how wxWidgets has been configured, not all formats
+ may be available.
+
+ @note
+ You can use SetOption() to set the hotspot when saving an image
+ into a cursor file (default hotspot is in the centre of the image):
+ @code
+ image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_X, hotspotX);
+ image.SetOption(wxIMAGE_OPTION_CUR_HOTSPOT_Y, hotspotY);
+ @endcode
+
+ @see LoadFile()
+ */
+ virtual bool SaveFile(wxOutputStream& stream,
+ const wxString& mimetype) const;
+
+ /**
+ Saves an image in the named file.
+
+ @param name
+ Name of the file to save the image to.
+ @param type
+ Currently these types can be used:
+ @li wxBITMAP_TYPE_BMP: Save a BMP image file.
+ @li wxBITMAP_TYPE_JPEG: Save a JPEG image file.
+ @li wxBITMAP_TYPE_PNG: Save a PNG image file.
+ @li wxBITMAP_TYPE_PCX: Save a PCX image file
+ (tries to save as 8-bit if possible, falls back to 24-bit otherwise).
+ @li wxBITMAP_TYPE_PNM: Save a PNM image file (as raw RGB always).
+ @li wxBITMAP_TYPE_TIFF: Save a TIFF image file.
+ @li wxBITMAP_TYPE_XPM: Save a XPM image file.
+ @li wxBITMAP_TYPE_ICO: Save a Windows icon file (ICO).
+ The size may be up to 255 wide by 127 high. A single image is saved
+ in 8 colors at the size supplied.
+ @li wxBITMAP_TYPE_CUR: Save a Windows cursor file (CUR).
+ */
+ virtual bool SaveFile(const wxString& name, wxBitmapType type) const;
+
+ /**
+ Saves an image in the named file.
+
+ @param name
+ Name of the file to save the image to.
+ @param mimetype
+ MIME type.
+ */
+ virtual bool SaveFile(const wxString& name, const wxString& mimetype) const;
+
+ /**
+ Saves an image in the named file.
+
+ File type is determined from the extension of the file name.
+ Note that this function may fail if the extension is not recognized!
+ You can use one of the forms above to save images to files with
+ non-standard extensions.
+
+ @param name
+ Name of the file to save the image to.
+ */
+ virtual bool SaveFile(const wxString& name) const;
+
+ /**
+ Saves an image in the given stream.
+
+ @param stream
+ Opened output stream to save the image to.
+ @param type
+ MIME type.
+ */
+ virtual bool SaveFile(wxOutputStream& stream, wxBitmapType type) const;
+
+ //@}
+
+
+
+ /**
+ @name Setters
+ */
+ //@{
+
+ /**
+ This function is similar to SetData() and has similar restrictions.
+
+ The pointer passed to it may however be @NULL in which case the function
+ will allocate the alpha array internally -- this is useful to add alpha
+ channel data to an image which doesn't have any.
+
+ If the pointer is not @NULL, it must have one byte for each image pixel
+ and be allocated with malloc().
+ wxImage takes ownership of the pointer and will free it unless @a static_data
+ parameter is set to @true -- in this case the caller should do it.
+ */
+ void SetAlpha(unsigned char* alpha = NULL,
+ bool static_data = false);
+
+ /**
+ Sets the alpha value for the given pixel.
+ This function should only be called if the image has alpha channel data,
+ use HasAlpha() to check for this.
+ */
+ void SetAlpha(int x, int y, unsigned char alpha);
+
+ /**
+ Removes the alpha channel from the image.
+
+ This function should only be called if the image has alpha channel data,
+ use HasAlpha() to check for this.
+
+ @since 2.9.1
+ */
+ void ClearAlpha();
+
+ /**
+ Sets the image data without performing checks.
+
+ The data given must have the size (width*height*3) or results will be
+ unexpected. Don't use this method if you aren't sure you know what you
+ are doing.
+
+ The data must have been allocated with @c malloc(), @b NOT with
+ @c operator new.
+
+ If @a static_data is @false, after this call the pointer to the data is
+ owned by the wxImage object, that will be responsible for deleting it.
+ Do not pass to this function a pointer obtained through GetData().
+ */
+ void SetData(unsigned char* data, bool static_data = false);
+
+ /**
+ @overload
+ */
+ void SetData(unsigned char* data, int new_width, int new_height,
+ bool static_data = false);
+
+ /**
+ Specifies whether there is a mask or not.
+
+ The area of the mask is determined by the current mask colour.
+ */
+ void SetMask(bool hasMask = true);
+
+ /**
+ Sets the mask colour for this image (and tells the image to use the mask).