#include "wx/msw/dibutils.h"
+#ifdef __WXWINE__
+ #include <module.h>
+#endif
+
#if defined(__WIN32__)
#if !defined(__MWERKS__) && !defined(__SALFORDC__)
#include <memory.h> // for _fmemcpy()
BOOL bOK = FALSE;
int nOK = 0;
- //*** Reset everything in the system palette to black
+ // *** Reset everything in the system palette to black
for(Counter = 0; Counter < 256; Counter++)
{
Palette.aEntries[Counter].peRed = 0;
Palette.aEntries[Counter].peFlags = PC_NOCOLLAPSE;
}
- //*** Create, select, realize, deselect, and delete the palette
+ // *** Create, select, realize, deselect, and delete the palette
+#ifdef __WXWINE__
+ ScreenDC = GetDC((HWND)NULL);
+#else
ScreenDC = GetDC(NULL);
+#endif
ScreenPalette = CreatePalette((LOGPALETTE *)&Palette);
if (ScreenPalette)
bOK = DeleteObject(ScreenPalette);
}
+#ifdef __WXWINE__
+ nOK = ReleaseDC((HWND)NULL, ScreenDC);
+#else
nOK = ReleaseDC(NULL, ScreenDC);
+#endif
return;
}
* bits....
*/
-int DibWriteFile(LPSTR szFile, LPBITMAPINFOHEADER lpbi)
+int DibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi)
{
HFILE fh;
OFSTRUCT of;
- fh = OpenFile(szFile, &of, OF_WRITE | OF_CREATE);
+ fh = OpenFile(wxConvFile.cWX2MB(szFile), &of, OF_WRITE | OF_CREATE);
if (!fh) {
// printf("la regamos0");
bmf.bfReserved1 = 0;
bmf.bfReserved2 = 0;
bmf.bfOffBits = sizeof(bmf) + (char far*)(DibPtr(lpbi)) - (char far*)lpbi;
-#if defined( __WATCOMC__) || defined(__VISUALC__) || defined(__SC__) || defined(__SALFORDC__)
+#if defined( __WATCOMC__) || defined(__VISUALC__) || defined(__SC__) || defined(__SALFORDC__) || defined(__MWERKS__)
if (_hwrite(fh, (LPCSTR)(&bmf), sizeof(bmf))<0 ||
_hwrite(fh, (LPCSTR)lpbi, size)<0) {
_lclose(fh);
return 1;
}
-PDIB DibOpenFile(LPSTR szFile)
+PDIB DibOpenFile(LPTSTR szFile)
{
HFILE fh;
DWORD dwLen;
#define GetCurrentInstance() (HINSTANCE)SELECTOROF((LPVOID)&of)
#endif
- fh = OpenFile(szFile, &of, OF_READ);
+ fh = OpenFile(wxConvFile.cWX2MB(szFile), &of, OF_READ);
if (fh == -1)
{
// TODO: Unicode version
#ifdef __WIN16__
h = FindResource(GetCurrentInstance(), szFile, RT_BITMAP);
+#elif wxUSE_UNICODE
+ h = FindResourceW(GetCurrentInstance(), szFile, RT_BITMAP);
#else
h = FindResourceA(GetCurrentInstance(), szFile, RT_BITMAP);
#endif
PDIB DibReadBitmapInfo(HFILE fh)
{
DWORD off;
- HANDLE hbi = NULL;
int size;
int i;
int nNumColors;