+ // 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(__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)
+
+
+// ----------------------------------------------------------------------------
+// wxBitmapHelpers: container for various bitmap methods common to all ports.
+// ----------------------------------------------------------------------------
+
+// Unfortunately, currently wxBitmap does not inherit from wxBitmapBase on all
+// platforms and this is not easy to fix. So we extract at least some common
+// methods into this class from which both wxBitmapBase (and hence wxBitmap on
+// all platforms where it does inherit from it) and wxBitmap in wxMSW and other
+// exceptional ports (only wxPM and old wxCocoa) inherit.
+class WXDLLIMPEXP_CORE wxBitmapHelpers
+{
+public:
+ // Create a new wxBitmap from the PNG data in the given buffer.
+ static wxBitmap NewFromPNGData(const void* data, size_t size);
+};
+
+
+// All ports except wxMSW and wxOS2 use wxBitmapHandler and wxBitmapBase as
+// base class for wxBitmapHandler; wxMSW and wxOS2 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: