wxImageHandler Class Reference
[Miscellaneous]

#include <wx/image.h>

Inheritance diagram for wxImageHandler:

wxObject

List of all members.


Detailed Description

This is the base class for implementing image file loading/saving, and image creation from data. It is used within wxImage and is not normally seen by the application.

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.

Note that all wxImageHandlers provided by wxWidgets are part of the wxCore library. For details about the default handlers, please see the section Available image handlers in the wxImage class documentation.

Note (Legal Issue)

This software is based in part on the work of the Independent JPEG Group. (Applies when wxWidgets is linked with JPEG support. wxJPEGHandler uses libjpeg created by IJG.)

Predefined objects/pointers: wxNullImage

Library:  wxCore

Category:  Miscellaneous

See also:
wxImage, wxInitAllImageHandlers()

Public Member Functions

 wxImageHandler ()
virtual ~wxImageHandler ()
const wxStringGetExtension () const
virtual int GetImageCount (wxInputStream &stream)
const wxStringGetMimeType () const
const wxStringGetName () const
wxBitmapType GetType () const
virtual bool LoadFile (wxImage *image, wxInputStream &stream, bool verbose=true, int index=-1)
virtual bool SaveFile (wxImage *image, wxOutputStream &stream, bool verbose=true)
void SetExtension (const wxString &extension)
void SetMimeType (const wxString &mimetype)
void SetName (const wxString &name)

Constructor & Destructor Documentation

wxImageHandler::wxImageHandler (  ) 

Default constructor.

In your own default constructor, initialise the members m_name, m_extension and m_type.

virtual wxImageHandler::~wxImageHandler (  )  [virtual]

Destroys the wxImageHandler object.


Member Function Documentation

const wxString& wxImageHandler::GetExtension (  )  const

Gets the file extension associated with this handler.

virtual int wxImageHandler::GetImageCount ( wxInputStream stream  )  [virtual]

If the image file contains more than one image and the image handler is capable of retrieving these individually, this function will return the number of available images.

Parameters:
stream Opened input stream for reading image data. Currently, the stream must support seeking.
Returns:
Number of available images. For most image handlers, this is 1 (exceptions are TIFF and ICO formats).

const wxString& wxImageHandler::GetMimeType (  )  const

Gets the MIME type associated with this handler.

const wxString& wxImageHandler::GetName (  )  const

Gets the name of this handler.

wxBitmapType wxImageHandler::GetType (  )  const

Gets the image type associated with this handler.

virtual bool wxImageHandler::LoadFile ( wxImage image,
wxInputStream stream,
bool  verbose = true,
int  index = -1 
) [virtual]

Loads a image from a stream, putting the resulting data into image.

If the image file contains more than one image and the image handler is capable of retrieving these individually, index indicates which image to read from the stream.

Parameters:
image The image object which is to be affected by this operation.
stream Opened input stream for reading image data.
verbose If set to true, errors reported by the image handler will produce wxLogMessages.
index The index of the image in the file (starting from zero).
Returns:
true if the operation succeeded, false otherwise.
See also:
wxImage::LoadFile, wxImage::SaveFile, SaveFile()

virtual bool wxImageHandler::SaveFile ( wxImage image,
wxOutputStream stream,
bool  verbose = true 
) [virtual]

Saves a image in the output stream.

Parameters:
image The image object which is to be affected by this operation.
stream Opened output stream for writing the data.
verbose If set to true, errors reported by the image handler will produce wxLogMessages.
Returns:
true if the operation succeeded, false otherwise.
See also:
wxImage::LoadFile, wxImage::SaveFile, LoadFile()

void wxImageHandler::SetExtension ( const wxString extension  ) 

Sets the handler extension.

Parameters:
extension Handler extension.

void wxImageHandler::SetMimeType ( const wxString mimetype  ) 

Sets the handler MIME type.

Parameters:
mimetype Handler MIME type.

void wxImageHandler::SetName ( const wxString name  ) 

Sets the handler name.

Parameters:
name Handler name.



wxWidgets logo

[ top ]