+ const int w = bmp.GetWidth();
+ const int h = bmp.GetHeight();
+ int d = bmp.GetDepth();
+ if ( d == -1 )
+ d = wxDisplayDepth();
+
+ if ( !Create(w, h, d) )
+ return false;
+
+ // we could have used GetDIBits() too but GetBitmapBits() is simpler
+ if ( !::GetBitmapBits
+ (
+ GetHbitmapOf(bmp), // the source DDB
+ GetLineSize(w, d)*h, // the number of bytes to copy
+ m_data // the pixels will be copied here
+ ) )
+ {
+ wxLogLastError(wxT("GetDIBits()"));