#include "wx/utils.h"
#include "wx/app.h"
#include "wx/palette.h"
+#include "wx/dcmemory.h"
#include "wx/bitmap.h"
#include "wx/icon.h"
#endif
if (m_bitmapMask)
delete m_bitmapMask;
m_bitmapMask = NULL;
+
}
wxList wxBitmap::sm_handlers;
LPBITMAPINFO lpDib;
void *lpBits = NULL;
+/*
wxASSERT( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) );
tmpBitmap.SetPalette(this->GetPalette());
memDC.SetPalette(this->GetPalette());
hPal = (HPALETTE) this->GetPalette()->GetHPALETTE();
+*/
+ if( this->GetPalette() && this->GetPalette()->Ok() && (this->GetPalette()->GetHPALETTE() != 0) )
+ {
+ tmpBitmap.SetPalette(* this->GetPalette());
+ memDC.SelectObject(tmpBitmap);
+ memDC.SetPalette(* this->GetPalette());
+ hPal = (HPALETTE) this->GetPalette()->GetHPALETTE();
+ }
+ else
+ {
+ hPal = (HPALETTE) ::GetStockObject(DEFAULT_PALETTE);
+ wxPalette palette;
+ palette.SetHPALETTE( (WXHPALETTE)hPal );
+ tmpBitmap.SetPalette( palette );
+ memDC.SelectObject(tmpBitmap);
+ memDC.SetPalette( palette );
+ }
// set the height negative because in a DIB the order of the lines is reversed
createDIB(this->GetWidth(), -this->GetHeight(), this->GetDepth(), hPal, &lpDib);