wxBitmap *bitmap = (wxBitmap *)data;
HBITMAP hBitmap = (HBITMAP)bitmap->GetHBITMAP();
// NULL palette means to use the system one
- HANDLE hDIB = BitmapToDIB(hBitmap, (HPALETTE)NULL);
+ HANDLE hDIB = wxBitmapToDIB(hBitmap, (HPALETTE)NULL);
handle = SetClipboardData(CF_DIB, hDIB);
#endif
break;
#if wxUSE_RESOURCE_LOADING_IN_MSW
HBITMAP hBitmap = 0;
HPALETTE hPalette = 0;
- bool success = ReadDIB(WXSTRINGCAST cursor_file, &hBitmap, &hPalette) != 0;
+ bool success = wxReadDIB(WXSTRINGCAST cursor_file, &hBitmap, &hPalette) != 0;
if (!success)
return;
if (hPalette)
* *
* FUNCTIONS : *
* *
- * ReadDIB() - Reads a DIB *
+ * wxReadDIB() - Reads a DIB *
* *
* WriteDIB() - Writes a global handle in CF_DIB format*
* to a file. *
WORD DibNumColors (VOID FAR * pv);
// HANDLE DibFromBitmap (HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal);
BOOL PASCAL MakeBitmapAndPalette(HDC,HANDLE,HPALETTE *,HBITMAP *);
-HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER);
-BOOL ReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette);
/****************************************************************************
* *
* *
****************************************************************************/
-BOOL WriteDIB(LPTSTR szFile, HANDLE hdib)
+static BOOL WriteDIB(LPTSTR szFile, HANDLE hdib)
{
BITMAPFILEHEADER hdr;
LPBITMAPINFOHEADER lpbi;
* *
****************************************************************************/
-WORD PaletteSize(VOID FAR * pv)
+static WORD PaletteSize(VOID FAR * pv)
{
LPBITMAPINFOHEADER lpbi;
WORD NumColors;
* *
****************************************************************************/
-WORD DibNumColors(VOID FAR *pv)
+static WORD DibNumColors(VOID FAR *pv)
{
int bits;
BITMAPINFOHEADER *lpbi;
****************************************************************************/
#if NOTHING
-HANDLE DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal)
+static HANDLE DibFromBitmap(HBITMAP hbm, DWORD biStyle, WORD biBits, HPALETTE hpal)
{
BITMAP bm;
BITMAPINFOHEADER bi;
* *
****************************************************************************/
-DWORD PASCAL lread(int fh, void far *pv, DWORD ul)
+static DWORD PASCAL lread(int fh, void far *pv, DWORD ul)
{
DWORD ulT = ul;
#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__)
* *
****************************************************************************/
-DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul)
+static DWORD PASCAL lwrite(int fh, VOID FAR *pv, DWORD ul)
{
DWORD ulT = ul;
#if defined(WINNT) || defined(__WIN32__) || defined(__WIN32__) || defined(__WXWINE__)
* FALSE - otherwise
*
****************************************************************************/
-BOOL ReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette)
+BOOL wxReadDIB(LPTSTR lpFileName, HBITMAP *bitmap, HPALETTE *palette)
{
int fh;
LPBITMAPINFOHEADER lpbi;
* not valid
*
****************************************************************************/
-BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB,
+static BOOL PASCAL MakeBitmapAndPalette(HDC hDC, HANDLE hDIB,
HPALETTE * phPal, HBITMAP * phBitmap)
{
LPBITMAPINFOHEADER lpInfo;
lpInfo = (LPBITMAPINFOHEADER) GlobalLock(hDIB);
#endif
- hPalette = MakeDIBPalette(lpInfo);
+ hPalette = wxMakeDIBPalette(lpInfo);
if ( hPalette )
{
// Need to realize palette for converting DIB to bitmap.
/****************************************************************************
* *
- * FUNCTION : MakeDIBPalette(lpInfo) *
+ * FUNCTION : wxMakeDIBPalette(lpInfo) *
* *
* PURPOSE : Given a BITMAPINFOHEADER, create a palette based on
* the color table.
* zero - unable to create palette
* *
****************************************************************************/
-HPALETTE MakeDIBPalette(LPBITMAPINFOHEADER lpInfo)
+HPALETTE wxMakeDIBPalette(LPBITMAPINFOHEADER lpInfo)
{
#ifdef __WXWINE__
return (FALSE);
HBITMAP hBitmap;
HPALETTE hPalette;
- bool success = (ReadDIB(filename, &hBitmap, &hPalette) != 0);
+ bool success = (wxReadDIB(filename, &hBitmap, &hPalette) != 0);
if (!success)
{
//
//---------------------------------------------------------------------
-void InitBitmapInfoHeader (LPBITMAPINFOHEADER lpBmInfoHdr,
+static void InitBitmapInfoHeader (LPBITMAPINFOHEADER lpBmInfoHdr,
DWORD dwWidth,
DWORD dwHeight,
int nBPP)
-LPSTR FindDIBBits (LPSTR lpbi)
+LPSTR wxFindDIBBits (LPSTR lpbi)
{
return (lpbi + *(LPDWORD)lpbi + PaletteSize (lpbi));
}
//
//---------------------------------------------------------------------
-HANDLE BitmapToDIB (HBITMAP hBitmap, HPALETTE hPal)
+HANDLE wxBitmapToDIB (HBITMAP hBitmap, HPALETTE hPal)
{
BITMAP Bitmap;
BITMAPINFOHEADER bmInfoHdr;
#endif
*lpbmInfoHdr = bmInfoHdr;
- lpBits = FindDIBBits ((LPSTR) lpbmInfoHdr);
+ lpBits = wxFindDIBBits ((LPSTR) lpbmInfoHdr);
// Now, we need a DC to hold our bitmap. If the app passed us
if (colourmap)
hPalette = (HPALETTE) colourmap->GetHPALETTE();
- HANDLE dibHandle = BitmapToDIB((HBITMAP) bitmap->GetHBITMAP(), hPalette);
+ HANDLE dibHandle = wxBitmapToDIB((HBITMAP) bitmap->GetHBITMAP(), hPalette);
if (dibHandle)
{
bool success = (WriteDIB(filename, dibHandle) != 0);
* mapping for fast performance.
*/
-void ClearSystemPalette(void)
+void wxClearSystemPalette(void)
{
//*** A dummy palette setup
struct
* bits....
*/
-int DibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi)
+int wxDibWriteFile(LPTSTR szFile, LPBITMAPINFOHEADER lpbi)
{
HFILE fh;
OFSTRUCT of;
return 0;
}
- long size = DibSize(lpbi);
+ long size = wxDibSize(lpbi);
// write file header
BITMAPFILEHEADER bmf;
bmf.bfSize = sizeof(bmf) + size;
bmf.bfReserved1 = 0;
bmf.bfReserved2 = 0;
- bmf.bfOffBits = sizeof(bmf) + (char FAR*)(DibPtr(lpbi)) - (char FAR*)lpbi;
+ bmf.bfOffBits = sizeof(bmf) + (char FAR*)(wxDibPtr(lpbi)) - (char FAR*)lpbi;
#if defined( __WATCOMC__) || defined(__VISUALC__) || defined(__SC__) || defined(__SALFORDC__) || defined(__MWERKS__) || defined(wxUSE_NORLANDER_HEADERS)
if (_hwrite(fh, (LPCSTR)(&bmf), sizeof(bmf))<0 ||
_hwrite(fh, (LPCSTR)lpbi, size)<0) {
return 1;
}
-PDIB DibOpenFile(LPTSTR szFile)
+PDIB wxDibOpenFile(LPTSTR szFile)
{
HFILE fh;
DWORD dwLen;
if (fh == -1)
return NULL;
- pdib = DibReadBitmapInfo(fh);
+ pdib = wxDibReadBitmapInfo(fh);
if (!pdib)
return NULL;
/* How much memory do we need to hold the DIB */
dwBits = pdib->biSizeImage;
- dwLen = pdib->biSize + DibPaletteSize(pdib) + dwBits;
+ dwLen = pdib->biSize + wxDibPaletteSize(pdib) + dwBits;
/* Can we get more memory? */
if (pdib)
{
/* read in the bits */
- _hread(fh, (LPBYTE)pdib + (UINT)pdib->biSize + DibPaletteSize(pdib), dwBits);
+ _hread(fh, (LPBYTE)pdib + (UINT)pdib->biSize + wxDibPaletteSize(pdib), dwBits);
}
_lclose(fh);
* bitmap formats, but will always return a "new" BITMAPINFO.
*/
-PDIB DibReadBitmapInfo(HFILE fh)
+PDIB wxDibReadBitmapInfo(HFILE fh)
{
DWORD off;
int size;
break;
}
- nNumColors = DibNumColors(&bi);
+ nNumColors = wxDibNumColors(&bi);
#if 0
if (bi.biSizeImage == 0)
bi.biSizeImage = DibSizeImage(&bi);
if (bi.biClrUsed == 0)
- bi.biClrUsed = DibNumColors(&bi);
+ bi.biClrUsed = wxDibNumColors(&bi);
#else
- FixBitmapInfo(&bi);
+ wxFixBitmapInfo(&bi);
#endif
pdib = (PDIB)GlobalAllocPtr(GMEM_MOVEABLE,(LONG)bi.biSize + nNumColors * sizeof(RGBQUAD));
*pdib = bi;
- pRgb = DibColors(pdib);
+ pRgb = wxDibColors(pdib);
if (nNumColors)
{
* in the passed palette
*/
-BOOL DibSetUsage(PDIB pdib, HPALETTE hpal,UINT wUsage)
+BOOL wxDibSetUsage(PDIB pdib, HPALETTE hpal,UINT wUsage)
{
PALETTEENTRY ape[256];
RGBQUAD FAR * pRgb;
if (!pdib)
return FALSE;
- nColors = DibNumColors(pdib);
+ nColors = wxDibNumColors(pdib);
- if (nColors == 3 && DibCompression(pdib) == BI_BITFIELDS)
+ if (nColors == 3 && wxDibCompression(pdib) == BI_BITFIELDS)
nColors = 0;
if (nColors > 0)
{
- pRgb = DibColors(pdib);
+ pRgb = wxDibColors(pdib);
switch (wUsage)
{
* given number of bits per pixel
*/
-PDIB DibCreate(int bits, int dx, int dy)
+PDIB wxDibCreate(int bits, int dx, int dy)
{
LPBITMAPINFOHEADER lpbi ;
DWORD dwSizeImage;
* the colors of the given palette.
*/
-BOOL DibMapToPalette(PDIB pdib, HPALETTE hpal)
+BOOL wxDibMapToPalette(PDIB pdib, HPALETTE hpal)
{
LPBITMAPINFOHEADER lpbi;
PALETTEENTRY pe;
return FALSE;
lpbi = (LPBITMAPINFOHEADER)pdib;
- lpRgb = DibColors(pdib);
+ lpRgb = wxDibColors(pdib);
GetObject(hpal,sizeof(int),(LPSTR)&nPalColors);
- nDibColors = DibNumColors(pdib);
+ nDibColors = wxDibNumColors(pdib);
if ((SizeImage = lpbi->biSizeImage) == 0)
- SizeImage = DibSizeImage(lpbi);
+ SizeImage = wxDibSizeImage(lpbi);
//
// build a xlat table. from the current DIB colors to the given
for (n=0; n<nDibColors; n++)
xlat[n] = (BYTE)GetNearestPaletteIndex(hpal,RGB(lpRgb[n].rgbRed,lpRgb[n].rgbGreen,lpRgb[n].rgbBlue));
- lpBits = (LPBYTE)DibPtr(lpbi);
+ lpBits = (LPBYTE)wxDibPtr(lpbi);
lpbi->biClrUsed = nPalColors;
//
if (nPalColors > nDibColors)
{
GlobalReAllocPtr(lpbi, lpbi->biSize + nPalColors*sizeof(RGBQUAD) + SizeImage, 0);
- hmemmove((BYTE _huge *)DibPtr(lpbi), (BYTE _huge *)lpBits, SizeImage);
- lpBits = (LPBYTE)DibPtr(lpbi);
+ hmemmove((BYTE _huge *)wxDibPtr(lpbi), (BYTE _huge *)lpBits, SizeImage);
+ lpBits = (LPBYTE)wxDibPtr(lpbi);
}
else if (nPalColors < nDibColors)
{
- hmemcpy(DibPtr(lpbi), lpBits, SizeImage);
+ hmemcpy(wxDibPtr(lpbi), lpBits, SizeImage);
GlobalReAllocPtr(lpbi, lpbi->biSize + nPalColors*sizeof(RGBQUAD) + SizeImage, 0);
- lpBits = (LPBYTE)DibPtr(lpbi);
+ lpBits = (LPBYTE)wxDibPtr(lpbi);
}
//
}
-HPALETTE MakePalette(const BITMAPINFO FAR* Info, UINT flags)
+HPALETTE wxMakePalette(const BITMAPINFO FAR* Info, UINT flags)
{
HPALETTE hPalette;
const RGBQUAD FAR* rgb = Info->bmiColors;
}
RawImage = 0;
Palette = 0;
- lpbi = DibCreate(Depth, Width, Height);
+ lpbi = wxDibCreate(Depth, Width, Height);
if (lpbi) {
- RawImage = (ImagePointerType)DibPtr(lpbi);
+ RawImage = (ImagePointerType)wxDibPtr(lpbi);
EfeWidth = (long)(((long)Width*Depth + 31) / 32) * 4;
imageOK = TRUE;
}
return FALSE;
ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
Palette = colourmap;
- return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+ return (wxDibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
}
bool
if (!b) b = g;
Palette->Create(n, r, g, b);
ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
- return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+ return (wxDibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
}
bool
Palette->Create(n, r, g, b);
ColorType |= (COLORTYPE_PALETTE | COLORTYPE_COLOR);
- return (DibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
+ return (wxDibSetUsage(lpbi, (HPALETTE) Palette->GetHPALETTE(), WXIMA_COLORS ) != 0);
}
void wxPNGReader::NullData()
WXHBITMAP wxToolBarMSW::CreateMappedBitmap(WXHINSTANCE hInstance, WXHBITMAP hBitmap)
{
- HANDLE hDIB = BitmapToDIB((HBITMAP) hBitmap, 0);
+ HANDLE hDIB = wxBitmapToDIB((HBITMAP) hBitmap, 0);
if (hDIB)
{
#ifdef __WINDOWS_386__