+ // this function is called from Create() to free the existing mask data
+ virtual void FreeData() = 0;
+
+ // these functions must be overridden to implement the corresponding public
+ // Create() methods, they shouldn't call FreeData() as it's already called
+ // by the public wrappers
+ virtual bool InitFromColour(const wxBitmap& bitmap,
+ const wxColour& colour) = 0;
+ virtual bool InitFromMonoBitmap(const wxBitmap& bitmap) = 0;
+};
+
+#if defined(__WXMGL__) || \
+ defined(__WXDFB__) || \
+ defined(__WXMAC__) || \
+ defined(__WXGTK__) || \
+ defined(__WXCOCOA__) || \
+ defined(__WXMOTIF__) || \
+ defined(__WXX11__)
+ #define wxUSE_BITMAP_BASE 1
+#else
+ #define wxUSE_BITMAP_BASE 0
+#endif
+
+// a more readable way to tell
+#define wxBITMAP_SCREEN_DEPTH (-1)
+
+
+// All ports except wxMSW,wxOS2,wxPalmOS use wxBitmapHandler and wxBitmapBase as base class
+// for wxBitmapHandler; wxMSW,wxOS2,wxPalmOS use wxGDIImageHandler as base class
+// since it allows some code reuse there.
+#if wxUSE_BITMAP_BASE
+
+// ----------------------------------------------------------------------------
+// wxBitmapHandler: class which knows how to create/load/save bitmaps in
+// different formats
+// ----------------------------------------------------------------------------
+
+class WXDLLIMPEXP_CORE wxBitmapHandler : public wxObject
+{
+public:
+ wxBitmapHandler() { m_type = wxBITMAP_TYPE_INVALID; }
+ virtual ~wxBitmapHandler() { }
+
+ // NOTE: the following functions should be pure virtuals, but they aren't
+ // because otherwise almost all ports would have to implement
+ // them as "return false"...
+
+ virtual bool Create(wxBitmap *WXUNUSED(bitmap), const void* WXUNUSED(data),
+ wxBitmapType WXUNUSED(type), int WXUNUSED(width), int WXUNUSED(height),
+ int WXUNUSED(depth) = 1)
+ { return false; }
+
+ virtual bool LoadFile(wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name),
+ wxBitmapType WXUNUSED(type), int WXUNUSED(desiredWidth),
+ int WXUNUSED(desiredHeight))
+ { return false; }
+
+ virtual bool SaveFile(const wxBitmap *WXUNUSED(bitmap), const wxString& WXUNUSED(name),
+ wxBitmapType WXUNUSED(type), const wxPalette *WXUNUSED(palette) = NULL) const
+ { return false; }
+
+ void SetName(const wxString& name) { m_name = name; }
+ void SetExtension(const wxString& ext) { m_extension = ext; }
+ void SetType(wxBitmapType type) { m_type = type; }
+ const wxString& GetName() const { return m_name; }
+ const wxString& GetExtension() const { return m_extension; }
+ wxBitmapType GetType() const { return m_type; }
+
+private: