Public Member Functions

# wxBitmapHandler Class Reference
[Graphics Device Interface (GDI)]

`#include <wx/bitmap.h>`

Inheritance diagram for wxBitmapHandler:
[legend]

## Detailed Description

This is the base class for implementing bitmap file loading/saving, and bitmap creation from data.

It is used within wxBitmap and is not normally seen by the application.

If you wish to extend the capabilities of wxBitmap, derive a class from wxBitmapHandler and add the handler using wxBitmap::AddHandler() in your application initialization.

Note that all wxBitmapHandlers provided by wxWidgets are part of the wxCore library. For details about the default handlers, please see the note in the wxBitmap class documentation.

##

Library: wxCore
Category: Graphics Device Interface (GDI)

See also:
  Bitmaps and Icons, wxBitmap, wxIcon, wxCursor

## Public Member Functions
| wxBitmapHandler ()
| Default constructor.
virtual | ~wxBitmapHandler ()
| Destroys the wxBitmapHandler object.
virtual bool | Create (wxBitmap *bitmap, const void *data, wxBitmapType type, int width, int height, int depth=1)
| Creates a bitmap from the given data, which can be of arbitrary type.
const wxString & | GetExtension () const
| Gets the file extension associated with this handler.
const wxString & | GetName () const
| Gets the name of this handler.
wxBitmapType | GetType () const
| Gets the bitmap type associated with this handler.
virtual bool | LoadFile (wxBitmap *bitmap, const wxString &name, wxBitmapType type, int desiredWidth, int desiredHeight)
| Loads a bitmap from a file or resource, putting the resulting data into bitmap.
virtual bool | SaveFile (const wxBitmap *bitmap, const wxString &name, wxBitmapType type, const wxPalette *palette=NULL) const
| Saves a bitmap in the named file.
void | SetExtension (const wxString &extension)
| Sets the handler extension.
void | SetName (const wxString &name)
| Sets the handler name.
void | SetType (wxBitmapType type)
| Sets the handler type.

List of all members.

## Constructor & Destructor Documentation

wxBitmapHandler::wxBitmapHandler | ( |  | ) |

Default constructor.

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

virtual wxBitmapHandler::~wxBitmapHandler | ( |  | ) | `[virtual]`

Destroys the wxBitmapHandler object.

## Member Function Documentation

virtual bool wxBitmapHandler::Create | ( | wxBitmap * | bitmap,
|  | const void * | data,
|  | wxBitmapType | type,
|  | int | width,
|  | int | height,
|  | int | depth = `1` |
| ) |  |  | `[virtual]`

Creates a bitmap from the given data, which can be of arbitrary type.

The wxBitmap object bitmap is manipulated by this function.

Parameters:

  | bitmap | The wxBitmap object.
  | width | The width of the bitmap in pixels.
  | height | The height of the bitmap in pixels.
  | depth | The depth of the bitmap in pixels. If this is wxBITMAP_SCREEN_DEPTH, the screen depth is used.
  | data | Data whose type depends on the value of type.
  | type | A bitmap type identifier - see wxBitmapType for a list of possible values.

Returns:
  true if the call succeeded, false otherwise (the default).

const wxString& wxBitmapHandler::GetExtension | ( |  | ) | const

Gets the file extension associated with this handler.

const wxString& wxBitmapHandler::GetName | ( |  | ) | const

Gets the name of this handler.

wxBitmapType wxBitmapHandler::GetType | ( |  | ) | const

Gets the bitmap type associated with this handler.

virtual bool wxBitmapHandler::LoadFile | ( | wxBitmap * | bitmap,
|  | const wxString & | name,
|  | wxBitmapType | type,
|  | int | desiredWidth,
|  | int | desiredHeight |
| ) |  |  | `[virtual]`

Loads a bitmap from a file or resource, putting the resulting data into bitmap.

Parameters:

  | bitmap | The bitmap object which is to be affected by this operation.
  | name | Either a filename or a Windows resource name. The meaning of name is determined by the type parameter.
  | type | See wxBitmapType for values this can take.
  | desiredWidth | The desired width for the loaded bitmap.
  | desiredHeight | The desired height for the loaded bitmap.

Returns:
  true if the operation succeeded, false otherwise.

See also:
  wxBitmap::LoadFile, wxBitmap::SaveFile, SaveFile()

virtual bool wxBitmapHandler::SaveFile | ( | const wxBitmap * | bitmap,
|  | const wxString & | name,
|  | wxBitmapType | type,
|  | const wxPalette * | palette = `NULL` |
| ) |  |  | const`[virtual]`

Saves a bitmap in the named file.

Parameters:

  | bitmap | The bitmap object which is to be affected by this operation.
  | name | A filename. The meaning of name is determined by the type parameter.
  | type | See wxBitmapType for values this can take.
  | palette | An optional palette used for saving the bitmap.

Returns:
  true if the operation succeeded, false otherwise.

See also:
  wxBitmap::LoadFile, wxBitmap::SaveFile, LoadFile()

void wxBitmapHandler::SetExtension | ( | const wxString & | extension | ) |

Sets the handler extension.

Parameters:

  | extension | Handler extension.

void wxBitmapHandler::SetName | ( | const wxString & | name | ) |

Sets the handler name.

Parameters:

  | name | Handler name.

void wxBitmapHandler::SetType | ( | wxBitmapType | type | ) |

Sets the handler type.

Parameters:

  | type | Handler type.

|  | [ top ]