hdr.bfSize = GlobalSize(hdib) + sizeof(BITMAPFILEHEADER);
hdr.bfReserved1 = 0;
hdr.bfReserved2 = 0;
- hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + lpbi->biSize +
+ hdr.bfOffBits = (DWORD) sizeof(BITMAPFILEHEADER) + lpbi->biSize +
PaletteSize(lpbi);
/* Write the file header */
if (lpbi->biSize == sizeof(BITMAPCOREHEADER))
return NumColors * sizeof(RGBTRIPLE);
- else
+ else
return NumColors * sizeof(RGBQUAD);
}
return (WORD) lpbi->biClrUsed;
bits = lpbi->biBitCount;
}
- else
+ else
bits = lpbc->bcBitCount;
switch (bits) {
DWORD PASCAL lread(int fh, void far *pv, DWORD ul)
{
DWORD ulT = ul;
-#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__)
+#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__)
BYTE *hp = (BYTE *) pv;
#else
BYTE huge *hp = (BYTE huge *) pv;
DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul)
{
DWORD ulT = ul;
-#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__)
+#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__)
BYTE *hp = (BYTE *) pv;
#else
BYTE huge *hp = (BYTE huge *) pv;
* is loaded, the function also creates a bitmap and
* palette out of the DIB for a device-dependent form.
*
- * RETURNS : TRUE - DIB loaded and bitmap/palette created
+ * RETURNS : TRUE - DIB loaded and bitmap/palette created
* The DIBINIT structure pointed to by pInfo is
* filled with the appropriate handles.
* FALSE - otherwise
fh = OpenFile (lpFileName, &of, OF_READ);
if (fh == -1) {
- wsprintf(str,"Can't open file '%ls'", (LPSTR)lpFileName);
+ wsprintf(str,"Can't open file '%s'", lpFileName);
MessageBox(NULL, str, "Error", MB_ICONSTOP | MB_OK);
return (0);
}
-
- hDIB = GlobalAlloc(GHND, (DWORD)(sizeof(BITMAPINFOHEADER) +
+
+ hDIB = GlobalAlloc(GHND, (DWORD)(sizeof(BITMAPINFOHEADER) +
256 * sizeof(RGBQUAD)));
if (!hDIB)
return(0);
* lpbi->biHeight;
}
- /* get a proper-sized buffer for header, color table and bits */
+ /* get a proper-sized buffer for header, color table and bits */
GlobalUnlock(hDIB);
hDIB = GlobalReAlloc(hDIB, lpbi->biSize +
nNumColors * sizeof(RGBQUAD) +
* to be used for a device-dependent representation of
* of the image.
*
- * RETURNS : TRUE --> success. phPal and phBitmap are filled with
+ * RETURNS : TRUE --> success. phPal and phBitmap are filled with
* appropriate handles. Caller is responsible
* for freeing objects.
* FALSE --> unable to create objects. both pointer are
hOldPal = SelectPalette(hDC, hPalette, TRUE);
RealizePalette(hDC);
- lpBits = (LPSTR)lpInfo + (WORD)lpInfo->biSize +
+ lpBits = (LPSTR)lpInfo + (WORD)lpInfo->biSize +
(WORD)lpInfo->biClrUsed * sizeof(RGBQUAD);
- hBitmap = CreateDIBitmap(hDC, lpInfo, CBM_INIT, lpBits,
+ hBitmap = CreateDIBitmap(hDC, lpInfo, CBM_INIT, lpBits,
(LPBITMAPINFO)lpInfo, DIB_RGB_COLORS);
SelectPalette(hDC, hOldPal, TRUE);
* *
* FUNCTION : MakeDIBPalette(lpInfo) *
* *
- * PURPOSE : Given a BITMAPINFOHEADER, create a palette based on
+ * PURPOSE : Given a BITMAPINFOHEADER, create a palette based on
* the color table.
- *
+ *
* *
- * RETURNS : non-zero - handle of a corresponding palette
+ * RETURNS : non-zero - handle of a corresponding palette
* zero - unable to create palette
* *
****************************************************************************/
HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER lpInfo)
{
+#ifdef __WXWINE__
+ return (FALSE);
+#else
NPLOGPALETTE npPal;
RGBQUAD far *lpRGB;
- HPALETTE hLogPal;
+ HPALETTE hLogPal;
WORD i;
/* since biClrUsed field was filled during the loading of the DIB,
if (lpInfo->biClrUsed)
{
/*
- npPal = (NPLOGPALETTE)LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) +
+ npPal = (NPLOGPALETTE)LocalAlloc(LMEM_FIXED, sizeof(LOGPALETTE) +
(WORD)lpInfo->biClrUsed * sizeof(PALETTEENTRY));
*/
- npPal = (NPLOGPALETTE)malloc(sizeof(LOGPALETTE) +
+ npPal = (NPLOGPALETTE)malloc(sizeof(LOGPALETTE) +
(WORD)lpInfo->biClrUsed * sizeof(PALETTEENTRY));
-
if (!npPal)
return(FALSE);
hLogPal = CreatePalette((LPLOGPALETTE)npPal);
// LocalFree((HANDLE)npPal);
free(npPal);
-
+
return(hLogPal);
}
*/
else
return((HPALETTE) GetStockObject(DEFAULT_PALETTE));
+#endif
+
}
bool wxLoadIntoBitmap(char *filename, wxBitmap *bitmap, wxPalette **pal)
//
// History: Date Reason
// 11/07/91 Created
-//
+//
//---------------------------------------------------------------------
void InitBitmapInfoHeader (LPBITMAPINFOHEADER lpBmInfoHdr,
//
// History: Date Reason
// 6/01/91 Created
-//
+//
//---------------------------------------------------------------------
HANDLE BitmapToDIB (HBITMAP hBitmap, HPALETTE hPal)
if (!GetObject (hBitmap, sizeof (Bitmap), (LPSTR) &Bitmap))
return NULL;
- InitBitmapInfoHeader (&bmInfoHdr,
- Bitmap.bmWidth,
- Bitmap.bmHeight,
+ InitBitmapInfoHeader (&bmInfoHdr,
+ Bitmap.bmWidth,
+ Bitmap.bmHeight,
Bitmap.bmPlanes * Bitmap.bmBitsPixel);
// Now allocate memory for the DIB. Then, set the BITMAPINFOHEADER
// into this memory, and find out where the bitmap bits go.
- hDIB = GlobalAlloc (GHND, sizeof (BITMAPINFOHEADER) +
+ hDIB = GlobalAlloc (GHND, sizeof (BITMAPINFOHEADER) +
PaletteSize ((LPSTR) &bmInfoHdr) + bmInfoHdr.biSizeImage);
if (!hDIB)
// it party on our bitmap. It will fill in the color table,
// and bitmap bits of our global memory block.
- if (!GetDIBits (hMemDC,
- hBitmap,
- 0,
- Bitmap.bmHeight,
- lpBits,
- (LPBITMAPINFO) lpbmInfoHdr,
+ if (!GetDIBits (hMemDC,
+ hBitmap,
+ 0,
+ Bitmap.bmHeight,
+ lpBits,
+ (LPBITMAPINFO) lpbmInfoHdr,
DIB_RGB_COLORS))
{
GlobalUnlock (hDIB);