If you wish to extend the capabilities of wxImage, derive a class from
wxImageHandler and add the handler using wxImage::AddHandler in your
- application initialisation.
+ application initialization.
Note that all wxImageHandlers provided by wxWidgets are part of
the @ref page_libs_wxcore library.
::wxNullImage
@library{wxcore}
- @category{misc}
+ @category{gdi}
@see wxImage, wxInitAllImageHandlers()
*/
/**
Register an image handler.
+ See @ref image_handlers for a list of the available handlers.
*/
static void AddHandler(wxImageHandler* handler);
*/
unsigned long ComputeHistogram(wxImageHistogram& histogram) const;
+ //@{
/**
If the image has alpha channel, this method converts it to mask.
- All pixels with alpha value less than @a threshold are replaced with mask
- colour and the alpha channel is removed. Mask colour is chosen automatically
- using FindFirstUnusedColour().
+ If the image has an alpha channel, all pixels with alpha value less
+ than @a threshold are replaced with the mask colour and the alpha
+ channel is removed. Otherwise nothing is done.
- If the image image doesn't have alpha channel, ConvertAlphaToMask() does nothing.
+ The mask colour is chosen automatically using
+ FindFirstUnusedColour() by this function, see the overload below if you
+ this is not appropriate.
@return @false if FindFirstUnusedColour returns @false, @true otherwise.
*/
bool ConvertAlphaToMask(unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
+ /**
+ If the image has alpha channel, this method converts it to mask using
+ the specified colour as the mask colour.
+
+ If the image has an alpha channel, all pixels with alpha value less
+ than @a threshold are replaced with the mask colour and the alpha
+ channel is removed. Otherwise nothing is done.
+
+ @since 2.9.0
+
+ @param mr
+ The red component of the mask colour.
+ @param mg
+ The green component of the mask colour.
+ @param mb
+ The blue component of the mask colour.
+ @param threshold
+ Pixels with alpha channel values below the given threshold are
+ considered to be transparent, i.e. the corresponding mask pixels
+ are set. Pixels with the alpha values above the threshold are
+ considered to be opaque.
+
+ */
+ void ConvertAlphaToMask(unsigned char mr, unsigned char mg, unsigned char mb,
+ unsigned char threshold = wxIMAGE_ALPHA_THRESHOLD);
+ //@}
+
/**
Returns a greyscale version of the image.
/**
Initializes all available image handlers. For a list of available handlers,
see wxImage.
+ If you don't need/want all image handlers loaded
@see wxImage, wxImageHandler