wxBitmapHandler

See Overview.

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 initialisation.

Derived from

wxObject

Include files

<wx/bitmap.h>

See also

wxBitmap, wxIcon, wxCursor



wxBitmapHandler::wxBitmapHandler



wxBitmapHandler(void)

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



wxBitmapHandler::~wxBitmapHandler



~wxBitmapHandler(void)

Destroys the wxBitmapHandler object.



wxBitmapHandler::Create



virtual bool Create(wxBitmap* bitmap, void* data, int type, int width, int height, int depth = -1)

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 -1, the screen depth is used.

data
Data whose type depends on the value of type.

type
A bitmap type identifier - see wxBitmapHandler::wxBitmapHandler for a list of possible values.

Return value

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



wxBitmapHandler::GetName

wxString GetName(void) const

Gets the name of this handler.



wxBitmapHandler::GetExtension

wxString GetExtension(void) const

Gets the file extension associated with this handler.



wxBitmapHandler::GetType

long GetType(void) const

Gets the bitmap type associated with this handler.



wxBitmapHandler::LoadFile



bool LoadFile(wxBitmap* bitmap, const wxString& name, long type)

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 wxBitmap::wxBitmap for values this can take.

Return value

true if the operation succeeded, false otherwise.

See also

wxBitmap::LoadFile
wxBitmap::SaveFile
wxBitmapHandler::SaveFile



wxBitmapHandler::SaveFile



bool SaveFile(wxBitmap* bitmap, const wxString& name, int type, wxPalette* palette = NULL)

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 wxBitmap::wxBitmap for values this can take.

palette
An optional palette used for saving the bitmap.

Return value

true if the operation succeeded, false otherwise.

See also

wxBitmap::LoadFile
wxBitmap::SaveFile
wxBitmapHandler::LoadFile



wxBitmapHandler::SetName



void SetName(const wxString& name)

Sets the handler name.

Parameters

name
Handler name.



wxBitmapHandler::SetExtension



void SetExtension(const wxString& extension)

Sets the handler extension.

Parameters

extension
Handler extension.



wxBitmapHandler::SetType



void SetType(long type)

Sets the handler type.

Parameters

name
Handler type.

ymasuda 平成17年11月19日