*/
virtual ~wxImageHandler();
+ /**
+ Returns @true if this handler supports the image format contained in the
+ given stream.
+
+ This function doesn't modify the current stream position (because it
+ restores the original position before returning; this however requires the
+ stream to be seekable; see wxStreamBase::IsSeekable).
+ */
+ bool CanRead( wxInputStream& stream );
+
+ /**
+ Returns @true if this handler supports the image format contained in the
+ file with the given name.
+
+ This function doesn't modify the current stream position (because it
+ restores the original position before returning; this however requires the
+ stream to be seekable; see wxStreamBase::IsSeekable).
+ */
+ bool CanRead( const wxString& filename );
+
/**
Gets the preferred file extension associated with this handler.
@param stream
Opened input stream for reading image data.
- Currently, the stream must support seeking.
+ This function doesn't modify the current stream position (because it
+ restores the original position before returning; this however requires the
+ stream to be seekable; see wxStreamBase::IsSeekable).
@return Number of available images. For most image handlers, this is 1
- (exceptions are TIFF and ICO formats).
+ (exceptions are TIFF and ICO formats as well as animated GIFs
+ for which this function returns the number of frames in the
+ animation).
*/
virtual int GetImageCount(wxInputStream& stream);
The constants ::wxIMAGE_ALPHA_TRANSPARENT and ::wxIMAGE_ALPHA_OPAQUE can be
used to indicate those values in a more readable form.
- Unlike RGB data, not all images have an alpha channel and before using
- wxImage::GetAlpha you should check if this image contains an alpha channel
- with wxImage::HasAlpha. Note that currently only the PNG format has full
- alpha channel support so only the images loaded from PNG files can have
+ While all images have RGB data, not all images have an alpha channel. Before
+ using wxImage::GetAlpha you should check if this image contains an alpha
+ channel with wxImage::HasAlpha. 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
wxImage::SetAlpha, you should save it in PNG format to avoid losing it.
/**
- Returns @true if the current image handlers can read this file
+ Returns @true if at least one of the available image handlers can read
+ the file with the given name.
+
+ See wxImageHandler::CanRead for more info.
*/
static bool CanRead(const wxString& filename);
+
+ /**
+ Returns @true if at least one of the available image handlers can read
+ the data in the given stream.
+
+ See wxImageHandler::CanRead for more info.
+ */
+ static bool CanRead(wxInputStream& stream);
//@{
/**
For the overload taking the parameter @a filename, that's the name
of the file to query.
- For the overload taking the parameter @a stream, that's the ppened input
- stream with image data. Currently, the stream must support seeking.
+ For the overload taking the parameter @a stream, that's the opened input
+ stream with image data.
+
+ See wxImageHandler::GetImageCount() for more info.
The parameter @a type may be one of the following values:
@li wxBITMAP_TYPE_BMP: Load a Windows bitmap file.
@li wxBITMAP_TYPE_ANY: Will try to autodetect the format.
@return Number of available images. For most image handlers, this is 1
- (exceptions are TIFF and ICO formats).
+ (exceptions are TIFF and ICO formats as well as animated GIFs
+ for which this function returns the number of frames in the
+ animation).
*/
static int GetImageCount(const wxString& filename,
wxBitmapType type = wxBITMAP_TYPE_ANY);