*******************************************************************************/
// For compilers that support precompilation, includes "wx.h".
-#define IN_WX_MAIN_CPP
#include "wx/wxprec.h"
#if defined(__BORLANDC__)
#ifndef WX_PRECOMP
#include "wx/setup.h"
#include "wx/defs.h"
+#include "wx/bitmap.h"
#endif
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
+
+#if !defined(__MWERKS__) && !defined(__SALFORDC__)
#include <memory.h>
+#endif
#include "wx/msw/dib.h"
+#ifndef __TWIN32__
#ifdef __GNUWIN32__
#include "wx/msw/gnuwin32/extra.h"
#endif
+#endif
#ifndef SEEK_CUR
/* flags for _lseek */
dwLen = bi.biSize + PaletteSize(&bi);
- hdc = GetDC(NULL);
+ hdc = GetDC((HWND) NULL);
hpal = SelectPalette(hdc, hpal, FALSE);
RealizePalette(hdc);
GlobalUnlock(hdib);
hdib = NULL;
SelectPalette(hdc, hpal, FALSE);
- ReleaseDC(NULL, hdc);
+ ReleaseDC((HWND) NULL, hdc);
return NULL;
}
goto ErrExit;
}
- if (!(nNumColors = (WORD)lpbi->biClrUsed))
+ nNumColors = (WORD)lpbi->biClrUsed;
+ if ( nNumColors == 0 )
{
/* no color table for 24-bit, default size otherwise */
if (lpbi->biBitCount != 24)
lpInfo = (LPBITMAPINFOHEADER) GlobalLock(hDIB);
#endif
- if ((hPalette = MakeDIBPalette(lpInfo)))
+ hPalette = MakeDIBPalette(lpInfo);
+ if ( hPalette )
{
// Need to realize palette for converting DIB to bitmap.
hOldPal = SelectPalette(hDC, hPalette, TRUE);
return((HPALETTE) GetStockObject(DEFAULT_PALETTE));
}
-bool wxLoadIntoBitmap(char *filename, wxBitmap *bitmap, wxColourMap **pal)
+bool wxLoadIntoBitmap(char *filename, wxBitmap *bitmap, wxPalette **pal)
{
HBITMAP hBitmap;
HPALETTE hPalette;
{
if (pal)
{
- *pal = new wxColourMap;
+ *pal = new wxPalette;
(*pal)->SetHPALETTE((WXHPALETTE) hPalette);
}
else
else return FALSE;
}
-wxBitmap *wxLoadBitmap(char *filename, wxColourMap **pal)
+wxBitmap *wxLoadBitmap(char *filename, wxPalette **pal)
{
wxBitmap *bitmap = new wxBitmap;
if (wxLoadIntoBitmap(filename, bitmap, pal))
return hDIB;
}
-bool wxSaveBitmap(char *filename, wxBitmap *bitmap, wxColourMap *colourmap)
+bool wxSaveBitmap(char *filename, wxBitmap *bitmap, wxPalette *colourmap)
{
HPALETTE hPalette = 0;
if (colourmap)