+class WXDLLEXPORT wxDIB
+{
+public:
+ // ctors and such
+ // --------------
+
+ // create an uninitialized DIB with the given width, height and depth (only
+ // 24 and 32 bpp DIBs are currently supported)
+ //
+ // after using this ctor, GetData() and GetHandle() may be used if IsOk()
+ // returns true
+ wxDIB(int width, int height, int depth)
+ { Init(); (void)Create(width, height, depth); }
+
+ // create a DIB from the DDB
+ wxDIB(const wxBitmap& bmp)
+ { Init(); (void)Create(bmp); }
+
+ // load a DIB from file (any depth is supoprted here unlike above)
+ //
+ // as above, use IsOk() to see if the bitmap was loaded successfully
+ wxDIB(const wxString& filename)
+ { Init(); (void)Load(filename); }
+
+ // same as the corresponding ctors but with return value
+ bool Create(int width, int height, int depth);
+ bool Create(const wxBitmap& bmp);
+ bool Load(const wxString& filename);
+
+ // dtor is not virtual, this class is not meant to be used polymorphically
+ ~wxDIB();
+
+
+ // operations
+ // ----------
+
+ // create a bitmap compatiblr with the given HDC (or screen by default) and
+ // return its handle, the caller is responsible for freeing it (using
+ // DeleteObject())
+ HBITMAP CreateDDB(HDC hdc = 0) const;
+
+ // get the handle from the DIB and reset it, i.e. this object won't destroy
+ // the DIB after this (but the caller should do it)
+ HBITMAP Detach() { HBITMAP hbmp = m_handle; m_handle = 0; return hbmp; }
+
+#if wxUSE_PALETTE
+ // create a palette for this DIB (always a trivial/default one for 24bpp)
+ wxPalette *CreatePalette() const;
+#endif // wxUSE_PALETTE
+
+ // save the DIB as a .BMP file to the file with the given name
+ bool Save(const wxString& filename);
+
+
+ // accessors
+ // ---------
+
+ // return true if DIB was successfully created, false otherwise
+ bool IsOk() const { return m_handle != 0; }
+
+ // get the bitmap size
+ wxSize GetSize() const { DoGetObject(); return wxSize(m_width, m_height); }
+ int GetWidth() const { DoGetObject(); return m_width; }
+ int GetHeight() const { DoGetObject(); return m_height; }
+
+ // get the number of bits per pixel, or depth
+ int GetDepth() const { DoGetObject(); return m_depth; }
+
+ // get the DIB handle
+ HBITMAP GetHandle() const { return m_handle; }
+
+ // get raw pointer to bitmap bits, you should know what you do if you
+ // decide to use it
+ void *GetData() const { DoGetObject(); return m_data; }
+
+
+ // HBITMAP conversion
+ // ------------------
+
+ // these functions are only used by wxWindows internally right now, please
+ // don't use them directly if possible as they're subject to change
+
+ // creates a DDB compatible with the given (or screen) DC from either
+ // a plain DIB or a DIB section (in which case the last parameter must be
+ // non NULL)
+ static HBITMAP ConvertToBitmap(const BITMAPINFO *pbi,
+ HDC hdc = 0,
+ void *bits = NULL);